[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
OpenGL 1.2 for AIX: Reference Manual

glXChooseFBConfig Subroutine

Purpose

Returns a list of GLX FBConfigs that match the attributes specified.

Library

OpenGL C bindings library: libGL.a

C Syntax

GLXFBConfig *glXChooseFBConfig(Display *dpy,

                               int screen,
                               int *AttributeList,
                               int *nelements)

Description

The glXChooseFBConfig subroutine returns a pointer to a list of GLX FBConfig structures that match a specified list of attributes. The GLX attributes of the returned GLX FBConfigs match or exceed the the specified values, based on the table, below. To free the data returned by this function, use the XFree subroutine.

If an attribute is not specified in AttributeList then the default value will be used instead. If the default value is GLX_DONT_CARE and the attribute is not in AttributeList then the attribute will not be checked. GLX_DONT_CARE may be specified for all attributes except GLX_LEVEL. If GLX_DONT_CARE is specified for an attribute then the attribute will not be checked. If AttributeList is NULL or empty (that is, the first attribute is None (or 0)), then the selection and sorting of the GLXFBConfigs is done according to the default values.

To retrieve a GLX FBConfig given its XID, use the GLX_FBCONFIG_ID attribute. When GLX_FBCONFIG_ID is specified, all other attributes are ignored and only the GLX FBConfig with the given XID is returned (NULL (or 0) is returned if it does not exist).

The following attributes can be specified in AttributeList but they will be ignored:

If GLX_TRANSPARENT_TYPE is set to GLX_NONE in AttributeList, then the following attributes can be included in AttributeList but they will be ignored:

Attribute1 Default Value Selection Criteria2 Sorting Criteria3 Sort Priority3
GLX_FBCONFIG_ID GLX_DONT_CARE Exact

GLX_BUFFER_SIZE 0 Larger Smaller 3
GLX_LEVEL 0 Exact

GLX_DOUBLEBUFFER GLX_DONT_CARE Exact Exact 4
GLX_STEREO False Exact

GLX_AUX_BUFFERS 0 Larger Smaller 5
GLX_RED_SIZE 0 Larger Larger 2
GLX_GREEN_SIZE 0 Larger Larger 2
GLX_BLUE_SIZE 0 Larger Larger 2
GLX_ALPHA_SIZE 0 Larger Larger 2
GLX_DEPTH_SIZE 0 Larger Larger 6
GLX_STENCIL_SIZE 0 Larger Larger 7
GLX_ACCUM_RED_SIZE 0 Larger Larger 8
GLX_ACCUM_GREEN_SIZE 0 Larger Larger 8
GLX_ACCUM_BLUE_SIZE 0 Larger Larger 8
GLX_ACCUM_ALPHA_SIZE 0 Larger Larger 8
GLX_RENDER_TYPE GLX_RGBA_BIT Mask

GLX_DRAWABLE_TYPE GLX_WINDOW_BIT Mask

GLX_X_RENDERABLE GLX_DONT_CARE Exact

GLX_X_VISUAL_TYPE GLX_DONT_CARE Exact Exact 9
GLX_CONFIG_CAVEAT GLX_DONT_CARE Exact Exact 1
GLX_TRANSPARENT_TYPE GLX_NONE Exact

GLX_TRANSPARENT_INDEX_VALUE GLX_DONT_CARE Exact

GLX_TRANSPARENT_RED_VALUE GLX_DONT_CARE Exact

GLX_TRANSPARENT_GREEN_VALUE GLX_DONT_CARE Exact

GLX_TRANSPARENT_BLUE_VALUE GLX_DONT_CARE Exact

GLX_TRANSPARENT_ALPHA_VALUE GLX_DONT_CARE Exact

Table Notes:

  1. See the glXGetFBConfigAttrib subroutine for the definition of each of the GLX FBConfig attributes.
  2. The values in the Selection criteria column have the following meaning:
    Larger GLX FBConfigs with an attribute value that meets or exceeds the specified value are returned
    Exact Only GLX FBConfigs whose attribute value exactly matches the requested value are considered.
    Mask Only GLX FBConfigs for which the set bits of attribute include all the bits that are set in the requested value are considered (additional bits might be set in the attribute).
  3. If more than one matching GLX FBConfig is found, then a list of GLX FBConfigs, sorted according to the best match criteria, is returned. The list is sorted according to the following precedence rules that are applied in ascending order:
    1. By GLX_CONFIG_CAVEAT where the precedence is:
      • GLX_NONE
      • GLX_SLOW_CONFIG
      • GLX_NON_CONFORMANT_CONFIG
    2. Larger total number of RGBA color bits (GLX_RED_SIZE, GLX_GREEN_SIZE, GLX_BLUE_SIZE, plus GLX_ALPHA_SIZE). If the requested number of bits in AttributeList for a particular color component is 0 or GLX_DONT_CARE, then the number of bits for that component is not considered.
    3. Smaller GLX_BUFFER_SIZE.
    4. Single-buffered configuration (GLX_DOUBLE_BUFFER is False) precedes a double-buffered configuration.
    5. Smaller GLX_AUX_BUFFERS.
    6. Larger GLX_DEPTH_SIZE.
    7. Smaller GLX_STENCIL_BITS.
    8. Larger total number of accumulation buffer color bits (GLX_ACCUM_RED_SIZE, GLX_ACCUM_GREEN_SIZE, GLX_ACCUM_BLUE_SIZE, plus GLX_ACCUM_ALPHA_SIZE). If the requested number of bits in AttributeList for a particular color component is 0 or GLX_DONT_CARE, then the number of bits for that color component is not considered.
    9. By GLX_X_VISUAL_TYPE where the precedence is:
      • GLX_TRUE_COLOR
      • GLX_DIRECT_COLOR
      • GLX_PSEUDO_COLOR
      • GLX_STATIC_COLOR
      • GLX_GRAY_SCALE
      • GLX_STATIC_GRAY

Parameters

dpy Specifies the connection to the X server.
screen Specifies the screen number.
AttributeList Specifies a list of attribute/value pairs. The last attribute must be None (or 0).
Note: The format of this list is not the same as found in glXChooseVisual. All attributes (including the boolean attributes) must be paired with a corresponding value in this list.
nelements Returns the number of FBConfigs that are in the returned list.

Notes

This subroutine requires GLX 1.3 support on both the GLX system on the client and on the specified screen on the X server.

Return Values

Null Indicates that either an undefined GLX attribute is encountered in the specified AttributeList, that no FBConfig matches the specified values for the GLX attributes or that screen is invalid.

Examples

The following example specifies a single-buffered RGB FBConfig in the normal frame buffer (not an overlay or underlay). The returned visual supports at least 4 bits each of red, green, and blue and possibly no alpha bits. It does not support color-index mode, double-buffering, stereo display or transparency. The code shown in the example may or may not have one or more auxiliary color buffers, a depth buffer, a stencil buffer, or an accumulation buffer.

AttributeList = { GLX_DOUBLE_BUFFER, False, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, None};

Files

/usr/include/GL/gl.h Contains C language constraints, variable type definitions, and ANSI function prototypes for OpenGL.
/usr/include/GL/glx.h Contains C language constraints, variable type definitions, and ANSI function prototypes for GLX.

Related Information

The glXCreateNewContext subroutine, glXGetFBConfigAttrib subroutine, glXGetFBConfigs subroutine.

OpenGL in the AIXwindows (GLX) Environment.

OpenGL Overview.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]