I create the texture on the GPU and pass it to my own framebuffer object. It works fine, and the texture is displayed in WebGLTexture, which I can pass to other shaders. However, I want to access the WebGLTexture pixels in javascript. Is there any way to do this?
I am currently using gl.ReadPixels to read pixels after I have drawn a texture for my framebuffer. This works fine, but wouldn’t it be better for me to directly access pixels in a WebGLTextureObject?
I'm trying to accomplish this: I have a Perlin noise reduction shaker that can display a high def heightmap graphic file and a normal map on the screen. I want to pass a height map to the CPU so that I can generate vertices for the grid. I could, of course, just position the vertices in the vertex shader, but I need this on the CPU to detect collisions.
Hope my question is clear. Any feedback is appreciated!
Thanks!
source share