On 09/11/2012 04:31 PM, gouessej [via jogamp] wrote:
> Yes you must call readToBufferedImage only when the OpenGL context is current,
> for example in GLEventListener.display(), you cannot call it directly in your
> main method, you have to create a canvas, set a GLEventListener to it, use an
> animator and it will work fine.
I recommend using GLReadBufferUtil as demonstrated in UITest's snapshot(..):
gl.glFinish(); // just make sure rendering finished ..
if(readBufferUtil.readPixels(gl, false)) {
readBufferUtil.write(new File("snap.png"));
}
It benefits of being toolkit independent and works well w/ ES1, ES2
and desktop GL profiles.
UITest is our JUnit test super-class.
~Sven