Hi
If you create a GLPBuffer somewhere in your program at the point you want to take the screenshot using the GLDrawableFactory, then add the same GLEventListener as you would for your GLCanvas and then call your offscreen to call display() then it should work. Also you would put the Screenshot code in your display() method,
Code something like this should work, where glEventListener is your own GLEventListener:
offScreen = true;
offScreenCanvas = GLDrawableFactory.getFactory().createGLPbuffer(cap, new DefaultGLCapabilitiesChooser(), width, height, null);
offScreenCanvas.addGLEventListener( glEventListener );
outputFile = new File( dumpname );
// this causes all the events to fire
// Also screen capture is done inside the Display loop.
offScreenCanvas.display();
// tidy up the event listener - upto you to do this
offScreenCanvas.removeGLEventListener(this);
offScreenCanvas.destroy();
Something like this in your display method for glEventListener:
if ( offScreen ) {
try {
Screenshot.writeToFile( outputFile, screenDim.width, screenDim.height );
}
catch( IOException ioe ) {
System.err.println( "Error Creating File: " + ioe.getMessage() );
}
}
Hope this is some help
Mike