Offscreen buffering to BufferedImage

Hi,
I’d like to know how i could render offscreen with the same GLEventListener to a Jpeg which is much more bigger that the GLJPanel.

I tried using a GLPBuffer and it seems to be filled now but how can i get the content of a GLPBuffer in a BufferedImage for example ?

			if (evt.getKeyCode() == KeyEvent.VK_C) {
			
				GLDrawableFactory factory = GLDrawableFactory.getFactory();
				if(factory.canCreateGLPbuffer())
				{
					GLPbuffer pbuffer = factory.createGLPbuffer(panel.getChosenGLCapabilities(), new DefaultGLCapabilitiesChooser(), 1650, 1050, panel.getContext());
					pbuffer.addGLEventListener(this.cube);
					pbuffer.display();
					
					//TODO get the content of the pbuffer
					
					pbuffer.destroy();
				}
		}

I’m not comfortable with the screenshot class which requires to be in the same thread as the one which displays. Isn’t it possible to render than get the result and place it in a file?

Thanks

One way or another you are going to need to read back the contents of the GLPbuffer into system memory. You can look at the source code for the GLJPanel to see how it does this. However the Screenshot class is there to make your life easier so I would recommend you use it if possible.