문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top