Search code examples
javatexturesbufferedimagejoglfbo

Converting JOGL texture into BufferedImage


I am very very new to JOGL. I am trying to create a BufferedImage object(which is used in other part of my code) out of a textrure (not a Texture object but a texture with a handle, storage). In the internet so far my searches gave me results to get a trexture from BufferImage but not the other way around which is my problem.

Is there a way to do this ?? by the way the texture is generated by a Frame buffer object to which I do a off screen rendering.

I create my texture in a very stright forward way with the following steps: bindTexture Setup the properties of textrure Generate it from the data unbind the texture.


Solution

  • You can use glReadPixels to read the FBO pixels into a byteBuffer

    the answer from here does that and returns a bufferedimage: ReadPixel in Jogl