Pixel information from a Texture?

Is there any way to get the pixel information from a Texture? All I need are the colors. Currently I’m storing both a BufferedImage and an OpenGL Texture just to access pixel information, which is obviously wasteful if there’s another way to do it.

Thanks.

While I’m here it would actually be useful to be able to directly edit the pixel information in a texture as well. Currently I’m editing the buffered image and then creating a new texture.

You should be able to use glGetTexImage() to get the pixels from a texture. I’ve never used that myself, though. Personally I would keep BufferedImage in memory as well for modifications, unless memory usage is the problem. To upload changes back to the texture, use glTexSubImage2D() instead of recreating the whole texture. :slight_smile:

Cool, I’ll try those out!