[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glXChooseVisual Subroutine

Purpose

Returns a visual matching the attributes specified.

Library

OpenGL C bindings library: libGL.a

XVisualInfo Structure

XVisualInfo* glXChooseVisual(Display *dpy, 
         int  screen, 
         int *AttributeList)

Description

The glXChooseVisual subroutine returns a pointer to an XVisualInfo structure that describes the visual best meeting a minimum specification. The Boolean GLX attributes of the returned visual match the specified values; the integer GLX attributes meet or exceed the specified minimum values. If all other attributes are equivalent, then TrueColor and PseudoColor visuals have priority over DirectColor and StaticColor visuals, respectively. If no conforming visual exists, Null is returned. To free the data returned by this function, use the XFree subroutine.

All Boolean GLX attributes default to False, except for GLX_USE_GL. The GLX_USE_GL attribute defaults to True. All integer GLX attributes default to 0 (zero). Default specifications are superseded by attributes included in AttributeList specified. Boolean attributes included in the specified AttributeList are understood to be True. Integer attributes are followed immediately by the corresponding specified (or minimum) value. The AttributeList must be terminated with the None attribute.

The GLX visual attributes are defined as follows:

Attribute Definition
GLX_USE_GL This attribute is ignored. Only visuals that can be rendered with GLX are considered.
GLX_BUFFER_SIZE This attribute must be followed by a nonnegative integer indicating the desired color index buffer size. The smallest index buffer of at least the specified size is preferred. This attribute is ignored if the GLX_RGBA attribute is asserted.
GLX_LEVEL This attribute must be followed by an integer buffer-level specification. This specification is honored exactly. Buffer level 0 (zero) corresponds to the default frame buffer of the display. Buffer level 1 (one) is the first overlay frame buffer, level 2 the second overlay frame buffer, and so on. Negative buffer levels correspond to underlay frame buffers.
GLX_RGBA This attribute specifies that if present, only TrueColor and DirectColor visuals are considered. Otherwise, only PseudoColor and StaticColor visuals are considered.
GLX_DOUBLEBUFFER This attribute specifies that only double-buffered visuals are considered. Otherwise, only single-buffered visuals are considered.
GLX_STEREO This attribute specifies that only stereo visuals are to be considered. Otherwise, only monoscopic visuals are considered.
GLX_AUX_BUFFERS This attribute must be followed by a nonnegative integer indicating the desired number of auxiliary buffers (preferably visuals with the smallest number of auxiliary buffers that meets or exceeds the specified number).
GLX_RED_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, the smallest available red buffer is preferred. Otherwise, the largest available red buffer of at least the minimum size is preferred.
GLX_GREEN_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, the smallest available green buffer is preferred. Otherwise, the largest available green buffer of at least the minimum size is preferred.
GLX_BLUE_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, the smallest available blue buffer is preferred. Otherwise, the largest available blue buffer of at least the minimum size is preferred.
GLX_ALPHA_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, the smallest available alpha buffer is preferred. Otherwise, the largest available alpha buffer of at least the minimum size is preferred.
GLX_DEPTH_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, visuals with no depth buffer are preferred. Otherwise, the largest available depth buffer of at least the minimum size is preferred.
GLX_STENCIL_SIZE This attribute must be followed by a nonnegative integer indicating the desired number of stencil bitplanes. The smallest stencil buffer of at least the specified size is preferred. If the desired value is 0, visuals with no stencil buffer are preferred.
GLX_ACCUM_RED_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, visuals with no red accumulation buffer are preferred. Otherwise, the largest possible red accumulation buffer of at least the minimum size is preferred.
GLX_ACCUM_GREEN_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, visuals with no green accumulation buffer are preferred. Otherwise, the largest possible green accumulation buffer of at least the minimum size is preferred.
GLX_ACCUM_BLUE_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, visuals with no blue accumulation buffer are preferred. Otherwise, the largest possible blue accumulation buffer of at least the minimum size is preferred.
GLX_ACCUM_ALPHA_SIZE This attribute must be followed by a nonnegative minimum size specification. If 0, visuals with no alpha accumulation buffer are preferred. Otherwise, the largest possible alpha accumulation buffer of at least the minimum size is preferred.
GLX_TRANSPARENT_TYPE_EXT This attribute defines the type of transparency (if any) in the visual. It must be one of the following:

GLX_NONE_EXT
no transparency
GLX_TRANSPARENT_INDEX_EXT
PseudoColor transparency
GLX_TRANSPARENT_RGB_EXT
RGB Transparency
GLX_TRANSPARENT_RED_VALUE_EXT This attribute must be followed by the red value of the RGB transparent pixel.
GLX_TRANSPARENT_BLUE_VALUE_EXT This attribute must be followed by the blue value of the RGB transparent pixel.
GLX_TRANSPARENT_GREEN_VALUE_EXT This attribute must be followed by the green value of the RGB transparent pixel.
GLX_TRANSPARENT_ALPHA_VALUE_EXT This attribute must be followed by the alpha value of the RGB transparent pixel.
GLX_TRANSPARENT_INDEX_VALUE_EXT This attribute must be followed by the INDEX transparent pixel.
GLX_X_VISUAL_TYPE_EXT This attribute must be followed by the visual type:

GLX_TRUE_COLOR_EXT
TrueColor colormap
GLX_DIRECT_COLOR_EXT
DirectColor colormap
GLX_PSEUDO_COLOR_EXT
PseudoColor colormap
GLX_STATIC_COLOR_EXT
StaticColor colormap
GLX_GRAY_SCALE_EXT
Grayscale colormap
GLX_STATIC_GRAY_EXT
StaticGray colormap
GLX_VISUAL_CAVEAT_EXT This attribute must be followed by:

0 or GLX_NONE_EXT
no rating
GLX_SLOW_VISUAL_EXT
not an optimal visual

Parameters

dpy Specifies the connection to the X server.
screen Specifies the screen number.
AttributeList Specifies a list of Boolean attributes and integer attribute/value pairs. The last attribute must be None.

Notes

XVisualInfo is defined in the Xutil.h file. It is a structure that includes Visual, VisualID, Screen, and Depth elements.

glXChooseVisual is implemented as a client-side utility using only XGetVisualInfo and glXGetConfig. Calls to these two routines can be used to implement selection algorithms other than the generic one implemented by glXChooseVisual.

GLX implementers are strongly discouraged, but not proscribed, from changing the selection algorithm used by glXChooseVisual. Therefore, selections may change from release to release of the client-side library.

There is no direct filter for picking only visuals that support GLX pixmaps. GLX pixmaps are supported for visuals whose GLX_BUFFER_SIZE is one of the pixmap depths supported by the X server.

Return Values

Null Indicates that an undefined GLX attribute is encountered in the specified AttributeList.

Examples

The following example specifies a single-buffered RGB visual 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, or stereo display. 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_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, None};

GLX implementers are strongly discouraged from changing the selection algorithm used by the glXChooseVisual subroutine. Selections may change from between releases of the client-side library.

Files

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

Related Information

The glXCreateContext subroutine, glXGetConfig subroutine.

OpenGL in the AIXwindows (GLX) Environment.

OpenGL Overview.


[ Previous | Next | Contents | Glossary | Home | Search ]