-
Notifications
You must be signed in to change notification settings - Fork 9
Draw Context Properties
Draw context properties are values that may be attached to a draw context object, using Q3Object_SetProperty, to request special rendering behavior. The request may be handled by only some renderers (e.g., only the OpenGL renderer) or only some platforms.
Data type: TQ3Boolean
Default value: kQ3True
Normally, the OpenGL depth buffer is cleared at the beginning of the first pass through the rendering loop. By setting this flag to kQ3False, you can request that the depth buffer not be cleared. This may be useful in special schemes in which more than one rendering loop renders a single frame.
Data type: TQ3Float64
Default value: 1.0
When the OpenGL depth buffer is cleared, it is filled with this value. This is rarely used.
Data type: TQ3Boolean
Default value: kQ3True
By setting this property to kQ3False, you can make the OpenGL depth buffer read-only.
Data type: TQ3Uns32
Default value: GL_LESS
Typically, at least in the first pass through the rendering loop, the OpenGL renderer uses glDepthFunc( GL_LESS )
, meaning that a fragment passes the depth test if its depth is less than the depth recorded in the depth buffer. Occasionally, it may be useful to change this behavior for special purposes.
Data type: TQ3Boolean
Default value: kQ3True
This property requests that the OpenGL drawing context share textures (and similar objects such as vertex buffer objects (VBOs)) with previously-created OpenGL contexts if possible. This is usually desirable, since it saves video memory.
Data type: TQ3Uns32
Default value: 0
This sets the number of bits per pixel in the OpenGL stencil buffer. If you have requested rendering with shadows (see kQ3RendererPropertyShadows), then the stencil depth is forced to be at least 8, which is typically also the maximum. Therefore, unless you are not rendering with shadows but have some other reason to use a stencil buffer, you will not need to set this property.
Data type: TQ3Boolean
Default value: kQ3True
In a double-buffered context, the back buffer is normally swapped to the front (i.e., made visible) at the end of the last pass through the rendering loop. In special situations, you may want to do more rendering before the swap.
Data type: TQ3Boolean
Default value: kQ3False
If true, requests that the renderer synchronize drawing with the screen refresh rate. This may reduce "tearing" effects. This feature is available on Mac (Carbon and Cocoa) contexts.
Data type: TQ3Boolean
Default value: kQ3False
On the Mac, OpenGL drawing occurs in a drawing surface that is behind or in front of the associated window. By default, the OpenGL surface is in front. In some cases it may be useful to put the drawing surface behind the window, and make part of the window transparent so that you can see the OpenGL drawing. Currently this feature is only implemented for Carbon contexts, but it would not be difficult to implement it for Cocoa.
Data type: TQ3Uns32
Unlike most draw context properties, this is set by Quesa itself and read by clients. When used with OpenGL-based renderers, the count is incremented whenever the associated OpenGL context is rebuilt. As an example of why you might want to use this property, suppose you have queried the availability of certain OpenGL features using glGetString( GL EXTENSIONS )
. If the OpenGL context has been rebuilt, you would need to query the OpenGL state again.
Data type: TQ3GLContextDestructionCallback
Default value: NULL
If this function pointer is not NULL, it will be called whenever the OpenGL context is about to be destroyed.
Data type: TQ3AcceleratedOffscreenPropertyData
This property, which may only be used with a pixmap draw context, requests that the context use hardware acceleration if possible. The hardware acceleration is accomplished using a framebuffer object (FBO). As part of the TQ3AcceleratedOffscreenPropertyData structure, you must provide an on-screen draw context that has already been rendered, so that its OpenGL draw context will exist.
Data type: AGLPixelFormat on Mac/Carbon, NSOpenGLPixelFormat* on Mac/Cocoa, int on Windows.
This property requests a specific OpenGL pixel format. The most likely reason to do so is to permit full-screen antialiasing by creating a pixel format that supports multisampling. Note: in Mac/Cocoa, the preferred approach is to use a view that's an instance of a subclass of NSOpenGLView
, and set its pixelFormat
property as desired.