3D Graphics Programming with QuickDraw 3D
Q3MacDrawContext_New
or Q3PixMapDrawContext_New
. These functions Q3MacDrawContext_New
function a pointer to a structure of type TQ3MacDrawContextData
, defined as follows:
typedef struct TQ3MacDrawContextData { TQ3DrawContextData drawContextData; CWindowPtr window; TQ3MacDrawContext2DLibrary library; gxViewPort viewPort; CGrafPtr grafPort; } TQ3MacDrawContextData;The first field is just a draw context data structure that contains basic information about the draw context (see page 12-4). The remaining fields contain specific information about the Macintosh window and 2D graphics library associated with the draw context.
See Listing 1-7 on page 127 for a sample routine that creates a Macintosh
draw context.
Q3DrawContext_SetDoubleBufferState
or by setting the doubleBufferState
field of a draw context data structure to kQ3True
before calling the draw context constructor method.In general, QuickDraw3D will take advantage of any double buffering capabilities available on the target window system.<8bat>u
When double buffering is active for a draw context, the draw context is associated with two buffers, the front buffer and the back buffer. The front buffer is the area of memory that is being displayed on the screen. The back buffer is some other area of memory that has the same size as the front buffer.
When double buffering is active, all drawing (as performed by routines such as Q3Group_Submit
in a rendering loop) is done into the back buffer, and the front buffer is updated only after the call to Q3View_EndRendering
on the final pass through your rendering loop. Some renderers (especially those that rely on hardware accelerators) may return control to your application before the image on the screen has been updated. You can call the Q3Renderer_Sync
function to block execution until the renderer is done drawing in the screen's draw context. You might want to do this if you intend to grab the image on the screen or if you intend to allow the user to pick objects displayed on the screen. See the chapter "Renderer Objects" for complete information about calling Q3Renderer_Sync
.
Let us know what you think of these prototype pages.
Generated with Harlequin WebMaker