It's really, really, easy to do a gl.readPixels() call as well and write out images directly, which is what I do. I save them as raw format and convert them in PSP to jpegs, but you can just as easily use some AWT/ImageIO to write them out directly in the format you want.

No that I implemented a simple skybox it was worth it to adda screen capture method - thanks for all you help!It works just fine, but the pictures don't have the rightcontrast... how can I solve this (without a paint program)?

instead and the colors will be fine. When using GL.BYTE it does a strange / 2 when grabbing the colors from the buffer and converting them to GL.BYTE. I don't know why. You can check out the exact conversions of every format in the OpenGL specification. For GL.UNSIGNED_BYTE it just grabs the exact values.

Grabbing the pixels to the buffer, converting the buffer to an array and creating a BufferedImage from it, sure is fast enough for a fullscreen capture, but saving this image as a .png (my favorite) takes much time. In my machine about 3-4 seconds. I would recommend using the new ImageIO formats released recently as an external API (you can find it at java.sun.com). I had some problems with it (it's still RC), but it's worth trying. It also supports some new kind of native stuff, accelerating IO (especially for PNGs).

That is if you want to provide easy capturing for your users. If you want it just for yourself, a raw format would be just fine, as princec suggests.

I've got a question here, but it's specifically about saving as a TGA. I pretty much want to convert frames from a 3D model into sprites of the model doing various things. I've got the models all loaded in and taking a sceenshot works, but I don't know how to turn everything that is not the model into part of the alpha channel for the TGA, thereby making it transparent. Anyone know how? I was thinking of changing the background to some obscure color and searching for any pixels matching that color, but I don't want to do anything like that because there is the off chance I will need the color I used.

I've got a question here, but it's specifically about saving as a TGA. I pretty much want to convert frames from a 3D model into sprites of the model doing various things. I've got the models all loaded in and taking a sceenshot works, but I don't know how to turn everything that is not the model into part of the alpha channel for the TGA, thereby making it transparent. Anyone know how? I was thinking of changing the background to some obscure color and searching for any pixels matching that color, but I don't want to do anything like that because there is the off chance I will need the color I used.

for 3d models you can usually do this with a 3d modeling program i've seen in programs such as 3ds max you can render the image to a bitmap or tga if you wish with alpha for the background! you can also just take a screenshot and edit in say the GIMP, where you can just fill paint the background into alpha and save as tga.

This is true, I could use a program, but I wanted to make my own that would save me a lot of time over doing it manually. Pretty much it just loads in the first frame of an animation, let's you choose as many camera angles as you like, and then saves each animation from each of those camera angles, thereby creating sprites. This way after some experimentation I could simply drag the 3D model into the application and have every single type of sprite I need automatically generated.

If you choose an 8-bit alpha channel for your OpenGL context using the PixelFormat class and set the background color to one with zero alpha using glClearColor, then if you read back the frame buffer in GL_ABGR_EXT format into a Targa file with alpha then the unrendered background pixels will automatically be transparent in the resulting .tga. For a concrete example, look in the JOGL source code for Screenshot.java, in particular writeToTargaFile(File file, int width, int height, boolean alpha).

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org