Hi
I tried using the built-in Screenshot utility, but with a funny result. What happened was that it wrote the wrong canvas to file…it wrote the canvas from a Java3D application I didnt even have running at the moment. So instead of getting a white triangle I got a red and yellow Java3D cube. I post my code below (taken from keyPressed event):
case KeyEvent.VK_F2:
{
canvas.getContext().makeCurrent();
try
{
Screenshot.writeToFile(new File("test2.png"), 640, 480);
}
catch(GLException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
canvas.getContext().release();
}
break;