GLXCHOOSEVISUAL(3gl)GLXCHOOSEVISUAL(3gl)NAME
glXChooseVisual - return a visual that matches specified attributes
C SPECIFICATION
XVisualInfo* glXChooseVisual( Display *dpy,
int screen,
int *attribList )
PARAMETERS
dpy Specifies the connection to the X server.
screen Specifies the screen number.
attribList Specifies a list of boolean attributes and integer
attribute/value pairs. The last attribute must be None.
DESCRIPTION
glXChooseVisual returns a pointer to an XVisualInfo structure describ‐
ing the visual that best meets a minimum specification. The boolean
GLX attributes of the visual that is returned will match the specified
values, and the integer GLX attributes will meet or exceed the speci‐
fied 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
XFree.
All boolean GLX attributes default to False except GLX_USE_GL, which
defaults to True. All integer GLX attributes default to zero. Default
specifications are superseded by attributes included in attribList.
Boolean attributes included in attribList are understood to be True.
Integer attributes and enumerated type attributes are followed immedi‐
ately by the corresponding desired or minimum value. The list must be
terminated with None.
The interpretations of the various GLX visual attributes are as fol‐
lows:
GLX_USE_GL Ignored. Only visuals that can be rendered with
GLX are considered.
GLX_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 speci‐
fied size is preferred. Ignored if GLX_RGBA is
asserted.
GLX_LEVEL Must be followed by an integer buffer-level spec‐
ification. This specification is honored
exactly. Buffer level zero corresponds to the
main frame buffer of the display. Buffer level
one is the first overlay frame buffer, level two
the second overlay frame buffer, and so on. Neg‐
ative buffer levels correspond to underlay frame
buffers.
GLX_RGBA If present, only TrueColor and DirectColor visu‐
als are considered. Otherwise, only PseudoColor
and StaticColor visuals are considered.
GLX_DOUBLEBUFFER If present, only double-buffered visuals are con‐
sidered. Otherwise, only single-buffered visu‐
als are considered.
GLX_STEREO If present, only stereo visuals are considered.
Otherwise, only monoscopic visuals are consid‐
ered.
GLX_AUX_BUFFERS Must be followed by a nonnegative integer that
indicates the desired number of auxiliary buf‐
fers. Visuals with the smallest number of aux‐
iliary buffers that meets or exceeds the speci‐
fied number are preferred.
GLX_RED_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, the small‐
est available red buffer is preferred. Other‐
wise, the largest available red buffer of at
least the minimum size is preferred.
GLX_GREEN_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, the small‐
est available green buffer is preferred. Other‐
wise, the largest available green buffer of at
least the minimum size is preferred.
GLX_BLUE_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, the small‐
est available blue buffer is preferred. Other‐
wise, the largest available blue buffer of at
least the minimum size is preferred.
GLX_ALPHA_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, the small‐
est available alpha buffer is preferred. Other‐
wise, the largest available alpha buffer of at
least the minimum size is preferred.
GLX_DEPTH_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, visuals
with no depth buffer are preferred. Otherwise,
the largest available depth buffer of at least
the minimum size is preferred.
GLX_STENCIL_SIZE Must be followed by a nonnegative integer that
indicates the desired number of stencil bit‐
planes. The smallest stencil buffer of at least
the specified size is preferred. If the desired
value is zero, visuals with no stencil buffer are
preferred.
GLX_ACCUM_RED_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, 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 Must be followed by a nonnegative minimum size
specification. If this value is zero, visuals
with no green accumulation buffer are preferred.
Otherwise, the largest possible green accumula‐
tion buffer of at least the minimum size is pre‐
ferred.
GLX_ACCUM_BLUE_SIZE Must be followed by a nonnegative minimum size
specification. If this value is zero, 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 Must be followed by a nonnegative minimum size
specification. If this value is zero, visuals
with no alpha accumulation buffer are preferred.
Otherwise, the largest possible alpha accumula‐
tion buffer of at least the minimum size is pre‐
ferred.
GLX_X_VISUAL_TYPE_EXT Must be followed by GLX_TRUE_COLOR_EXT,
GLX_DIRECT_COLOR_EXT, GLX_PSEUDO_COLOR_EXT,
GLX_STATIC_COLOR_EXT, GLX_GRAY_SCALE_EXT, or
GLX_STATIC_GRAY_EXT corresponding to the
requested X visual class.
GLX_TRANSPARENT_TYPE_EXT
Must be followed by GLX_NONE_EXT, GLX_TRANSPAR‐
ENT_RGB_EXT, or GLX_TRANSPARENT_INDEX_EXT. If
GLX_TRANSPARENT_TYPE_EXT is not included in
attribList, then the atrribute will be treated as
a "don't care" and a visual with or without a
transparent pixel may be chosen.
GLX_TRANSPARENT_INDEX_VALUE_EXT
Must be followed by a nonnegative integer value.
If GLX_TRANSPARENT_TYPE_EXT is not included in
attribList or if it is set to GLX_NONE_EXT, then
inclusion of GLX_TRANSPARENT_INDEX_VALUE_EXT,
GLX_TRANSPARENT_RED_VALUE_EXT, GLX_TRANSPAR‐
ENT_GREEN_VALUE_EXT, GLX_TRANSPAR‐
ENT_BLUE_VALUE_EXT or GLX_TRANSPAR‐
ENT_ALPHA_VALUE_EXT will be ignored
GLX_TRANSPARENT_RED_VALUE_EXT
Must be followed by an nonnegative integer value,
which specifies the red component size of RGB
transparent pixel.
GLX_TRANSPARENT_GREEN_VALUE_EXT
Must be followed by an nonnegative integer value,
which specifies the green component size of RGB
transparent pixel.
GLX_TRANSPARENT_BLUE_VALUE_EXT
Must be followed by an nonnegative integer value,
which specifies the blue component size of RGB
transparent pixel.
GLX_TRANSPARENT_ALPHA_VALUE_EXT
Must be followed by an nonnegative integer value,
which specifies the alpha component size of RGBA
transparent pixel.
GLX_SAMPLE_BUFFERS_ARB
Must be followed by an nonnegative integer value
(1 or 0), which specifies the number of sample
buffers.
GLX_SAMPLES_ARB Must be followed by an nonnegative integer value,
which specifies the number of samples per pixel.
GLX_VIDEO_RESIZE_SUN Must be followed by an nonnegative integer value
(1 or 0). If the value is one, only visuals with
dynamic resizing capability will be considered;
otherwise, all visuals will be considered.
Default value is zero.
GLX_VIDEO_REFRESH_TIME_SUN
Must be followed by a nonnegative integer value,
which specifies the desired video refresh time
(in microseconds). If the value is zero, all
visuals will be considered; otherwise only visu‐
als with refresh time smaller or equal to the
value specified will be considered.
GLX_GAMMA_VALUE_SUN Must be followed by an nonnegative integer value,
which specifies the desired gamma correction in
percent value (e.g. a value of 180 indicates a
visual with gamma correction value of 1.80 is
desired). If the value is zero, all visuals will
be considered; otherwise only visuals with gamma
correction value greater or equal to the value
specified will be considered.
EXAMPLES
attribList =
{GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4, None};
Specifies a single-buffered RGB visual in the normal frame buffer, not
an overlay or underlay buffer. The returned visual supports at least
four bits each of red, green, and blue, and possibly no bits of alpha.
It does not support color index mode, double-buffering, or stereo dis‐
play. It may or may not have one or more auxiliary color buffers, a
depth buffer, a stencil buffer, or an accumulation buffer.
NOTES
XVisualInfo is defined in Xutil.h. 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. GLXPixmaps are supported for visuals whose GLX_BUFFER_SIZE is
one of the pixmap depths supported by the X server.
The attribList parameter list GLX_X_VISUAL_TYPE_EXT, GLX_TRANSPAR‐
ENT_INDEX_VALUE_EXT, GLX_TRANSPARENT_RED_VALUE_EXT, GLX_TRANSPAR‐
ENT_GREEN_VALUE_EXT, GLX_TRANSPARENT_BLUE_VALUE_EXT and GLX_TRANSPAR‐
ENT_ALPHA_VALUE_EXT are only valid if the extension GLX_EXT_visual_info
is supported by the connection.
ERRORS
NULL is returned if an undefined GLX attribute is encountered in attri‐
bList.
SEE ALSO
glXCreateContext, glXGetConfig, glXChooseFBConfig, glXQueryExtension‐
sString
21 May 01 GLXCHOOSEVISUAL(3gl)