Hello
I am trying to create an off screen buffer so that I can render into it and get the image to save.
This is the code I have so far:
Renderer tempR = new Renderer();
tempR.setSelectedDXFDocument(selectedDXFDocument);
tempR.setOptions(dxfCheckBoxes);
GLDrawableFactory fac = GLDrawableFactory.getFactory();
GLCapabilities glCap = new GLCapabilities();
glCap.setDoubleBuffered(false);
GLPbuffer buf = fac.createGLPbuffer(glCap, null, 2000, 2000, null);
buf.addGLEventListener(tempR);
GLContext context = buf.createContext(null);
context.makeCurrent();
buf.display();
BufferedImage image = Screenshot.readToBufferedImage(2000, 2000);
context.release();
try {
ScreenImage.writeImage(image, "glPanel.jpg");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
context.destroy();
buf.destroy();
The Render class works fine with an onscreen GLJPanel.
What am I missing ? Help please!
Thanks in advance
Rob Kovacs
ps I copied most of this from the following article:
http://today.java.net/pub/a/today/2008/10/30/integrating-glpbuffer-and-graphics2d.html