Login  Register

AWTGLReadBufferUtil not able to render textures when reading to a BufferedImage?

Posted by Martin on Jun 05, 2018; 9:28pm
URL: https://forum.jogamp.org/AWTGLReadBufferUtil-not-able-to-render-textures-when-reading-to-a-BufferedImage-tp4038909.html

Hi,

One of my plots is using Point Sprites which works properly with live rendering in canvas : point are replaced by textures



When rendering offscreen with AWTGLReadBufferUtil, the point texture are replaced by squares in the BufferedImage.

AWTGLReadBufferUtil screenshot = new AWTGLReadBufferUtil(gl.getGLProfile(), true);
screenshot.readPixelsToBufferedImage(gl, true);

leads to :



When using GLReadBufferUtil and saving to disk directly, the point sprite renders correctly (see first image).

In both cases I use :

GLCaps[rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]]

I have already been able to show in a separate code sample that AWTGLReadBufferUtil IS able to render Point Sprites correctly so I am a bit lost.

I enable point sprite as follow :

gl.getGL2().glEnable(GL2.GL_TEXTURE_2D);
gl.getGL2().glEnable(GL2.GL_POINT_SPRITE);
gl.getGL2().glTexEnvi(GL2.GL_POINT_SPRITE, GL2.GL_COORD_REPLACE, GL2.GL_TRUE);
gl.getGL2().glBindTexture(GL.GL_TEXTURE_2D, resource.getTexture(gl).getTextureObject(gl));
...
gl.getGL2().glDisable(GL2.GL_POINT_SPRITE);
gl.getGL2().glDisable(GL2.GL_TEXTURE_2D);

Any idea why my point sprite texture render as square?

Thanks in advance!