Getting GPU texture data to CPU

Started by
2 comments, last by V-man 16 years, 1 month ago
I'm using glTexSubImage2D a lot to update a texture in a component. For testing purposes, it would be quite handy to be able to retrieve the texture data from the GPU to perform checks at any time that the data loaded into it is correct. Is there any way of doing this in OpenGL?
Advertisement
Take a look at the OpenGL reference pages.
Unfortunately it seems you can only retrieve the whole texture and not just a part of it. A workaround would be to render the texture to the framebuffer or bind it to a framebuffer object, set the read buffer correctly and then read it with glReadPixels.
Thank you, I think retrieving the entire texture will work well for my application!
It better to use GLintercept for debugging. If you have any questions on how to use, ask away.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement