PDA

View Full Version : taking screenshots



39smooth
03-14-2004, 08:29 AM
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

JanHH
03-14-2004, 11:28 AM
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".

39smooth
03-14-2004, 01:12 PM
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:
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".

Honk
03-14-2004, 11:16 PM
Check out glReadPixels().

JanHH
03-15-2004, 12:39 AM
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().

39smooth
03-15-2004, 09:46 AM
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