Reputation: 2470
how can i retrieve texture RGB values at the time of draw call in opengl es?
how do I get the pointer to texels, or the pixels belonging to a particular texture?
glGetTexParameter doesnt seem to be giving an option to retrieve the individual texels, texture color state?
Upvotes: 1
Views: 110
Reputation: 45948
Since ES doesn't support glGetTexImage
, the only possible way would be to render the texture to the screen one-to-one (i.e. by rendering a screen-sized textured quad) and retrieveing the screen using glReadPixels
.
But I'm sure you don't really need to retrieve the texture image, since it was you who set it in the first place (using glTexImage2D
), so you know the image already (have it in some CPU memory buffer), and it hasn't changed since you have set it, anyway. You don't want to retrieve it either, since this would be a GPU-CPU copy of an image (a large bunch of data), which is pretty costly.
Just remember, the texture image hasn't changes since you have set it yourself. And if it has, then only because you rendered something into the texture (by using FBOs or glCopyTexImage2D
) and in this case you could just grab it from the screen (or render it into a renderbuffer instead of a texture), anyway.
Upvotes: 1