In OpenGL is it possible to retrieve the pixel array from a previously created texture given only the texture ID?
+2
A:
Yes.
bind it again and call glGetTexImage()
If you don't want to mess with the texture which is currently bound, you can bind it to a different texture unit. A texture unit is a container which hold a bound texture. you can have one texture bound to every texture unit. OpenGL 2.1 requires that an implementation will have atleast 2 texture units. The default texture unit which you regularly use is unit 0. to switch the current texture unit call glActiveTexture()
:
glActiveTexture(GL_TEXTURE1);
glBindTexture(texid);
glGetTexImage(...);
glActiveTexture(GL_TEXTURE0); // don't forget to switch it back
shoosh
2009-03-11 19:22:41
IMO a more consistent way to 'not mess' the currently bound texture is to use glPushAttrib or glGet with GL_TEXTURE_BINDING_2D to preserve it if needed. Switching and messing up the unit 1 is as arbitrary as messing unit 0...
rotoglup
2009-03-11 22:00:48