Login  Register

GLDrawableFactory.createOffscreenAutoDrawable loosing color information

Posted by Martin on Oct 16, 2015; 1:38am
URL: https://forum.jogamp.org/GLDrawableFactory-createOffscreenAutoDrawable-loosing-color-information-tp4035475.html

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