I want to dump raw texture data to disk (to read back later), and I'm not sure about glReadPixel will read from the currently bound texture.
How can I read the buffer from my texture?
I want to dump raw texture data to disk (to read back later), and I'm not sure about glReadPixel will read from the currently bound texture.
How can I read the buffer from my texture?
Thanks for the answer Gergonzale. I spent some time this morning trying to figure out how to get this to work with 16-bit textures, this code snippet may be useful to anyone else converting GL_UNSIGNED_SHORT_5_6_5 to GL_UNSIGNED_BYTE
glReadPixels function reads from framebuffers, not textures. To read a texture object you must use glGetTexImage but it isn't available in OpenGL ES :(
If you want to read the buffer from your texture then you can bind it to an FBO (FrameBuffer Object) and use glReadPixels:
Then, you only must call to glReadPixels when you want to read from your texture: