off screen rendering jogl2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

off screen rendering jogl2

neilt
We have just migrated from jogl version1 to 2 and we now have problems with off screen rendering of transparent objects, it was fine in version 1. Below are images of the on screen and off screen rendering results. The off screen was created via an GLOffscreenAutoDrawable. Any ideas what is wrong?

On screen result:



Off screen result:


Reply | Threaded
Open this post in threaded view
|

Re: off screen rendering jogl2

neilt
OK so I have fixed this myself, the problem was as follows:

In jogl 1.0 we used the following to get the buffered image :

CAPTURE = Screenshot.readToBufferedImage(OFFSCREEN_DIM.width,OFFSCREEN_DIM.height);

In jogl 2.0 we used:

CAPTURE = (new AWTGLReadBufferUtil(currentBuffer.getGLProfile() , true)).readPixelsToBufferedImage( currentBuffer.getGL() , true );

To fix the problem we changed the above line to false in the constructor:

CAPTURE = (new AWTGLReadBufferUtil(currentBuffer.getGLProfile() , false)).readPixelsToBufferedImage( currentBuffer.getGL() , true );

I have to say this was pure luck, the above class is completely undocumented so how are we supposed to use it successfully? What does the 'alpha' parameter that I changed to false indicate?

Reply | Threaded
Open this post in threaded view
|

Re: off screen rendering jogl2

jmaasing
AWTGLReadBufferUtil extends GLReadBufferUtil so look in the parent class.

http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/GLReadBufferUtil.html#GLReadBufferUtil(boolean,%20boolean)

Although I don't know more than that, maybe there is some pre-multiply with alpha going on somewhere for the off-screen buffer.