taking screenshots

hi all

can anyone tell me how to take screenshots of the contents of a JGLCanvas after some simple spheres and stuff have been drawn on it? I am creating the canvas in a Frame which also has the capture button which does the actionPerformed stuff. i just need to know how to actually get the pixel content and dump it in a .bmp or .jpg.

thanks for reading

on windows, push the “print” (in german “Druck”) button, this will copy the framebuffer content to the clipboard, and paste this in paint or word. Alternatively, there’s a program called “wingrab” which does this a little more comfortable.

in linux, there’s a program called “ksnapshot”.

nah you misunderstand, i’m developing the a molecule visualisation tool in java. i am using the java’s OpenGl libraries to draw the 3d stuff. i would like to include a screenshot feature which takes what ever is drawn on the screen and save it as a bmp of jpeg.

i mite be in the wrong place??

Originally posted by JanHH:
[b]on windows, push the “print” (in german “Druck”) button, this will copy the framebuffer content to the clipboard, and paste this in paint or word. Alternatively, there’s a program called “wingrab” which does this a little more comfortable.

in linux, there’s a program called “ksnapshot”.[/b]

Check out glReadPixels().

does it matter if the screenshot-button is in your program or in another window next to that? But if you want to save the OpenGL window to a file indeed you have to read it back with glReadPixels().

checked it out, read the documentation but not really understanding it, this is my first major work with opengl.

are there any working java examples using readPixels i could check out? searched yahoo and google but didn’t find a lot

cheers