How to read pixels from a rendered texture?
I want to read the RGB values from specific texels in a textured polygon, where the texture is a rendered texture attached to a render node. For “normal” textures this works fine by reading from the data array obtained with the texture’s getImageData method.
However, for a texture created with viz.addRenderTexture and attached to the render node using attachTexture, there is no reference to any data returned.
I then tried to attach a texture created with viz.addBlankTexture to the render node. To my surprise this will render correctly to the texture which becomes visible on the rendered polygon. Also a valid reference to a data array is returned with getImageData. But this buffer is empty.
Any suggestions how to access the pixel buffer of a rendered texture?
|