[fpc-pascal] Save image into BMP or JPEG using Free Pascal (Save screenshot of OpenGL scene)

Marco van de Voort marcov at stack.nl
Mon Feb 18 10:19:03 CET 2008


> On Sun, 17 Feb 2008, Jakub Marian wrote:
> > 
> > I need to save data stored in memory into .bmp or (which would be the better
> > variant) into .jpg file. Actually what I want to do is to save the OpenGL
> > screen (probably using glReadPixels() function) into image. I've downloaded
> > PasJPEG, but it doesn't seem to be working. When I try to compile example
> > program for PasJPEG, I get: 'Error: Wrong number of parameters specified for
> > call to "error_exit"'
> > 
> > Do you know any efficient way to save glReadPixels into .bmp or .jpeg file?
> > It would be very helpful for me.
> > 
> > I am looking forward for your answers. Thank you even for reading this post.
> > :-)
> 
> try using fpimage ? packages/fcl-image

fpimage doesn't support external image data. One can't tell it "here are the
pixels, here is the pallette, go save", one needs to manually convert it
first.  Moreover it is horribly complex and undocumented (as I found out
last weekend. Actually bmpcomn is now documented :-))

And since .bmp format is so simple (close to a memory dump of the pixel
info), one can better write convesion code to push it directly to disk,
specially if one is somewhat interested in speed.

To make that easier, one could recycle the bmp writer and code though.



More information about the fpc-pascal mailing list