Login  Register

How to make screenshot on SWT

Posted by Paul on Oct 24, 2014; 10:54am
URL: https://forum.jogamp.org/How-to-make-screenshot-on-SWT-tp4033448.html

Hi everybody.
Since Screenshot class was removed, I found the particular commit which says to use AWTGLReadBufferUtil.readPixelsToBufferedImage method.
So I changed my code in my SWT app accordingly, but I'm getting weird exception

javax.media.opengl.GLException: Should not call this
        at jogamp.opengl.windows.wgl.WindowsExternalWGLContext$Drawable.getSurfaceWidth(WindowsExternalWGLContext.java:133) ~[jogl-all-2.2.4.jar:2.2.4]
        at com.jogamp.opengl.util.awt.AWTGLReadBufferUtil.readPixelsToBufferedImage(AWTGLReadBufferUtil.java:94) ~[jogl-all-2.2.4.jar:2.2.4]
        at com.jogamp.opengl.util.awt.AWTGLReadBufferUtil.readPixelsToBufferedImage(AWTGLReadBufferUtil.java:71) ~[jogl-all-2.2.4.jar:2.2.4]

How should I fix my code?
Thanks
Paul