Question

I have an array of pixels from a gl.readPixels() call. Can I put those pixels back to the drawing buffer or a framebuffer? i.e. I'd like to call something like gl.drawPixels, but there is none in the WebGL API. Am I to use a texture and render it flat, or am I missing something?

Était-ce utile?

La solution

Check out this short thread: http://www.opengl.org/discussion_boards/showthread.php/168346-Best-Substitute-for-glDrawPixels-Under-OpenGL-ES

What the Gold Book is telling you is correct. The fastest way to upload textures is to write to a texture bound to an FBO. But what you need to do is generate your pixels as geometry (optimised as much as possible) and then draw them to the FBO using an Orth matrix, GL_POINTS and glDrawArrays.

The optimal solution (WebGL is a branch of GL-ES) is a bit odd, but makes some sense becuase in a browser you don't want people messing with memory directly. Let the app and driver sort it out, at the expense of some voodoo-like constructions in the GL code.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top