GLDrawableFactory.createOffscreenAutoDrawable loosing color information

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

GLDrawableFactory.createOffscreenAutoDrawable loosing color information

Martin
Hi,

I'm upgrading Jzy3d to 2.3.2 (was on 2.1.5-01).

To make offscreen canvas I formerly used GLPBuffer which is deprecated. So I now initialize with :

drawable = factory.createOffscreenAutoDrawable(factory.getDefaultDevice(), capabilities, null, width, height);

Unfortunately the screenshot looses all color information :


The code building the BufferedImage does :

AWTGLReadBufferUtil screenshot = new AWTGLReadBufferUtil(GLProfile.getGL2GL3(), true);
screenshot.readPixels(gl, true);
image = screenshot.getTextureData();
bufferedImage = screenshot.readPixelsToBufferedImage(gl, true);

Complete offscreen canvas code : https://github.com/jzy3d/jzy3d-api/blob/jogl2.3.1/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/canvas/OffscreenCanvas.java#L56
Complete screenshot code : https://github.com/jzy3d/jzy3d-api/blob/jogl2.3.1/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/AWTRenderer3d.java#L38
Reply | Threaded
Open this post in threaded view
|

Re: GLDrawableFactory.createOffscreenAutoDrawable loosing color information

gouessej
Administrator
Hi

Does it occur if you call capabilities.setPBuffer(true) just before creating the offscreen drawable?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLDrawableFactory.createOffscreenAutoDrawable loosing color information

Martin
It works!

Many thanks Julien for your help!
Reply | Threaded
Open this post in threaded view
|

Re: GLDrawableFactory.createOffscreenAutoDrawable loosing color information

gouessej
Administrator
You're welcome but it's just a workaround as it won't work where the pbuffers aren't available. We have to understand how to make it work with FBOs too.
Julien Gouesse | Personal blog | Website