[ Previous | Next |
Table Of Contents

7.1 PVISUALCONFIG pglChooseConfig( hab, attriblist)

PVISUALCONFIG pglChooseConfig( hab, attriblist)

Description:

A PVISUALCONFIG is required when creating an OpenGL context. This call will return a suitable PVISUALCONFIG based on the minimum requirements passed in through attriblist. Each Boolean attribute will be matched exactly, and each integer attribute will meet or exceed the specified value. All Boolean attributes default to False, except PGL_USE_GL, which defaults to True. Default attributes are superseded by the attributes listed in attriblist. Boolean attributes included in attriblist are understood to be true, integer attributes are followed immediately by the corresponding desired or minimum value. Attributes which are not specified have default values listed below. The attriblist is terminated by None. A PVISUALCONFIG is needed when creating an OpenGL rendering context.

Parameters:
HAB hab Handle to Anchor Block 
int *attriblist Specifies a list of Boolean attributes and integer attribute/value pairs. The last attribute in the list must be None.

Return Values:
PVISUALCONFIG Pointer to a Visual Configuration structure meeting the requirements of attriblist 
NULL No suitable VisualConfig was found

Notes:

The interpretations of the various PGL visual attributes are as follows:
PGL_USE_GL Ignored. Only visual configs that can be rendered with OpenGL are considered. 
PGL_BUFFER_SIZE  Must be followed by a nonnegative integer that indicates the desired color index buffer size. The smallest index buffer of at least the specified size is preferred. Ignored if PGL_RGBA is asserted. 
PGL_LEVEL  Must be followed by an integer buffer-level specification. This specification is honored exactly. Buffer level zero corresponds to the default frame buffer of the display. Buffer level one is the first overlay frame buffer, level two the second overlay frame buffer, and so on. Negative buffer levels correspond to underlay frame buffers. 
PGL_RGBA  If present, only RGBA visual configs are considered. Otherwise, Color Index visual configs are considered. 
PGL_DOUBLEBUFFER  If present, only double bufferered visual configs are considered. Otherwise both single buffered and double buffered visual configs may be considered. 
PGL_SINGLEBUFFER  If present, only single buffered visual configs are considered. Otherwise both single buffered and double buffered visual config may be considered. 
PGL_STEREO  If present, only stereo visual configs are considered. Otherwise, both monoscopic and stereoscopic visual configs are considered. 
PGL_AUX_BUFFERS  Must be followed by a nonnegative integer that indicates the desired number of auxiliary buffers. Visual configs with the smallest number of auxiliary buffers that meets or exceeds the specified number are preferred. 
PGL_RED_SIZE  Must be followed by a nonnegative mini- mum size specification. If this value is zero, the smallest available red buffer is preferred. Otherwise, the largest available red buffer of at least the minimum size is preferred. 
PGL_GREEN_SIZE  Must be followed by a nonnegative mini- mum size specification. If this value is zero, the smallest available green buffer is preferred. Otherwise, the largest available green buffer of at least the minimum size is preferred. 
PGL_BLUE_SIZE  Must be followed by a nonnegative mini- mum size specification. If this value is zero, the smallest available blue buffer is preferred. Otherwise, the largest available blue buffer of at least the minimum size is preferred. 
PGL_ALPHA_SIZE  Must be followed by a nonnegative mini- mum size specification. If this value is zero, the smallest available alpha buffer is preferred. Otherwise, the largest available alpha buffer of at least the minimum size is preferred. 
PGL_DEPTH_SIZE  Must be followed by a nonnegative mini- mum size specification. If this value is zero, visual configs with no depth buffer are preferred. Otherwise, the largest available depth buffer of at least the minimum size is preferred. 
PGL_STENCIL_SIZE  Must be followed by a nonnegative inte- ger that indicates the desired number of stencil bitplanes. The smallest stencil buffer of at least the specified size is preferred. If the desired value is zero, visual configs with no stencil buffer are preferred. 
PGL_ACCUM_RED_SIZE  Must be followed by a nonnegative minimum size specification. If this value is zero, visual configs with no red accumulation buffer are preferred. Otherwise, the largest possible red accumulation buffer of at least the minimum size is preferred. 
PGL_ACCUM_GREEN_SIZE  Must be followed by a nonnegative minimum size specification. If this value is zero, visual configs with no green accumulation buffer are preferred. Otherwise, the largest possible green accumulation buffer of at least the minimum size is preferred. 
PGL_ACCUM_BLUE_SIZE  Must be followed by a nonnegative minimum size specification. If this value is zero, visual configs with no blue accumulation buffer are preferred. Otherwise, the largest possible blue accumulation buffer of at least the minimum size is preferred. 
PGL_ACCUM_ALPHA_SIZE  Must be followed by a nonnegative minimum size specification. If this value is zero, visual configs with no alpha accumulation buffer are preferred. Otherwise, the largest possible alpha accumulation buffer of at least the minimum size is preferred.

Attriblist example:

attribList ={ PGL_RGBA, PGL_RED_SIZE, 4, 
              PGL_GREEN_SIZE, 4,PGL_BLUE_SIZE, 
              4,PGL_DOUBLEBUFFER, None};
Specifies a double-buffered RGB visual config in the normal frame buffer, not an overlay or underlay buffer. The returned visual configuration supports at least four bits each of red, green, and blue, and possibly no bits of alpha. It does not support color index mode, or stereo display. It may or may not have one or more auxiliary color buffers, a depth buffer, a stencil buffer, or an accumulation buffer.

The user should not modify the fields of the returned PVISUALCONFIG structure.

When the user is done with the PVISUALCONFIG returned, the memory can be freed by calling the C library routine free(). 


[ Previous | Next | Table Of Contents ]