PDA

View Full Version : Save Current Frame in 32bit-Bitmap -> How?



torud
03-10-2010, 11:56 PM
Hello,

im im using GLScene in combination with Delphi and i was trying to Save a Picture from the current Frame.

At the scene is only 1 Cube, nothing else.
As result i would like to receive a 32Bit-Bitmap or PNG or TGA, where i can see the cube and inside the alpha-Channel only the cube is white and rest is black.

Is there a chance or way to do this?
And if yes, could you show me a way how to do this?

Thank you
Tom

Kelvin
03-11-2010, 04:49 PM
The glReadPixels command can retrieve raw image data from the framebuffer, including the alpha channel data.

You will have to format the raw pixel data into a PNG, TGA, or other file format yourself before writing to disk. OpenGL does not provide file-format conversion services.

Ehsan Kamrani
03-11-2010, 07:11 PM
I have used this method to create a video of our game( We saved an screen shot each frame, then we converted all of those TGA file to one video file ) But I didn't add an alpha channel to the final TGA image.
The code has been written in pure C++ . Are you interested to see the code? I have no idea about Delphi and can't convert this code to that language :(