If I use OpenGL to generate a series of 3D drawings, how can I export them to files that can eventually be used to create Quicktime animations? I don’t see any agl call for saving images to common file formats such as PICT, GIF or TIFF.
Use glReadPixels to get a buffer and then a graphics export component to write the file (or simply add it to a movie directly).
Note that glReadPixels is really slow, though there are certain things you can do to speed it up.
I have now worked up the programming to use glReadPixels and then write the image in memory into a TIFF file. This works fine if I run the program (Carbon) under OSX: the TIFF files have proper images when examined with Resourcerer or GraphicConverter, etc. on either OSX or 9.2.
But if I run the program (or a version compiled as a Classic app) under 9.2, the image is garbage. The TIFF header is OK.
Is there a difference between the way glReadPixels works on OSX or 9.2 ?
No, should be the same, whats the code?
here is a code fragment that misbehaves:
outputsize = sizeof(tiffheader)+viewport*viewport*3;
Handle DH = ::NewHandleClear(outputsize);
glReadPixels(0,0,viewport,viewport,GL_RGB, GL_UNSIGNED_BYTE,*DH+sizeof(tiffheader) );
DH is then passed to PowerPlant LFile::WriteDataFork() in DoSave
Using CodeWarrior 7.0, on Mac OS10.1.2 and producing a Carbon application.
This works fine (other than putting the image upside down, which I can fix) when I run the application under OSX and open the image with a Mac OSX application such as Resourcerer. If I run under Mac OS 9 (either Carbon or Classic builds) the image is garbage.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.