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?
Asked
Active
Viewed 912 times
1 Answers
0
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.

bjorke
- 3,295
- 1
- 16
- 20
-
What does an orth matrix have to do with it? You don't need any matrices in WebGL – gman Dec 13 '12 at 07:28
-
just quoting. Your vertex shader can be matrix-free if you like. – bjorke Dec 13 '12 at 09:05