reading a subimage back from texture

Started by
1 comment, last by V-man 16 years ago
Is there a way to read a subimage from a stored texture? My google-fu has failed me. All I can find is that you need to read the entire texture back which is really slooooow.
Advertisement
Have you tried copying the subimage from the stored texture into a smaller texture? Maybe it would work roughly like this: 1) Create a new texture the size of your subimage, 2) Attach this texture to a FBO for render-to-texture functionality, 3) Setup ortographic projection, 4) Draw the part of the stored texture you're interested in reading back, 5) Disable the FBO and switch back to perspective projection, 6) Read back the new texture with glGetTexImage.
If it a standard texture, then no, there is no "sub image readback".
If it is a render to texture, then attach the FBO, use glReadPixels.
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