After opening a graphics importer and retrieving the necessary information about the texture, you can go ahead and draw the texture. There are three steps to drawing the texture.
QuickTime’s graphic importers need offscreen buffers to draw images. Call the function QTNewGWorldFromPtr() to create an offscreen buffer. This function takes eight arguments.
Pixel formats deserve more explanation. Each pixel has a color value with three color components: red, green, and blue. The color value may have a fourth component, alpha, that measures transparency. The pixel format defines the size of each color component. There are four pixel formats for QTNewGWorldFromPtr() on Mac OS X.
Unless you’re writing code specifically for Intel Macs, you should use one of the pixel formats with PowerPC byte ordering. Macs with an Intel processor can use pixel formats with PowerPC byte ordering, but PowerPC Macs cannot use pixel formats with Intel byte ordering. The following code demonstrates how to create an offscreen buffer using QuickTime:
Ptr imageData; GworldPtr offscreenBuffer; long bytesPerRow; OSErr error; bytesPerRow = width * depth / 8; error = QTNewGWorldFromPtr(&offscreenBuffer, k32ARGBPixelFormat, &imageRect, NULL, NULL, kNativeEndianPixMap, imageData, bytesPerRow);
After creating the offscreen buffer, you must set the graphics importer to use the offscreen buffer and draw the texture. Call the function GraphicsImportSetGWorld() to set the graphics importer. Call GraphicsImportDraw() to draw the texture.
ComponentResult error; error = GraphicsImportSetGWorld(fileImporter, offscreenBuffer, NULL); error = GraphicsImportDraw(fileImporter);
Next (Specifying the Texture in OpenGL)
Previous (Retrieving Information about the Texture)