Previous: GLX Enumerations, Up: GLX [Index]
The functions from this section may be had by loading the module:
(use-modules (glx low-level)
This section of the manual was derived from the upstream OpenGL documentation. Each function’s documentation has its own copyright statement; for full details, see the upstream documentation. The copyright notices and licenses present in this section are as follows.
Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
Return a list of GLX frame buffer configurations that match the specified attributes.
Specifies the connection to the X server.
Specifies the screen number.
Specifies a list of attribute/value pairs. The last attribute must be
None
.
Returns the number of elements in the list returned by
glXChooseFBConfig
.
glXChooseFBConfig
returns GLX frame buffer configurations that
match the attributes specified in attrib_list, or NULL
if
no matches are found. If attrib_list is NULL
, then
glXChooseFBConfig
returns an array of GLX frame buffer
configurations that are available on the specified screen. If an error
occurs, no frame buffer configurations exist on the specified screen, or
if no frame buffer configurations match the specified attributes, then
NULL
is returned. Use XFree
to free the memory returned
by glXChooseFBConfig
.
All attributes in attrib_list, including boolean attributes, are
immediately followed by the corresponding desired value. The list is
terminated with None
. If an attribute is not specified in
attrib_list, then the default value (see below) is used (and the
attribute is said to be specified implicitly). For example, if
GLX_STEREO
is not specified, then it is assumed to be
False
. For some attributes, the default is GLX_DONT_CARE
,
meaning that any value is OK for this attribute, so the attribute will
not be checked.
Attributes are matched in an attribute-specific manner. Some of the
attributes, such as GLX_LEVEL
, must match the specified value
exactly; others, such as, GLX_RED_SIZE
must meet or exceed the
specified minimum values. If more than one GLX frame buffer
configuration is found, then a list of configurations, sorted according
to the “best” match criteria, is returned. The match criteria for
each attribute and the exact sorting order is defined below.
The interpretations of the various GLX visual attributes are as follows:
GLX_FBCONFIG_ID
Must be followed by a valid XID that indicates the desired GLX frame
buffer configuration. When a GLX_FBCONFIG_ID
is specified, all
attributes are ignored. The default value is GLX_DONT_CARE
.
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
specified size is preferred. This attribute is ignored if
GLX_COLOR_INDEX_BIT
is not set in GLX_RENDER_TYPE
. The
default value is 0.
GLX_LEVEL
Must be followed by an integer buffer-level specification. This specification is honored exactly. Buffer level 0 corresponds to the default frame buffer of the display. Buffer level 1 is the first overlay frame buffer, level two the second overlay frame buffer, and so on. Negative buffer levels correspond to underlay frame buffers. The default value is 0.
GLX_DOUBLEBUFFER
Must be followed by True
or False
. If True
is
specified, then only double-buffered frame buffer configurations are
considered; if False
is specified, then only single-buffered
frame buffer configurations are considered. The default value is
GLX_DONT_CARE
.
GLX_STEREO
Must be followed by True
or False
. If True
is
specified, then only stereo frame buffer configurations are considered;
if False
is specified, then only monoscopic frame buffer
configurations are considered. The default value is False
.
GLX_AUX_BUFFERS
Must be followed by a nonnegative integer that indicates the desired number of auxiliary buffers. Configurations with the smallest number of auxiliary buffers that meet or exceed the specified number are preferred. The default value is 0.
GLX_RED_SIZE
, GLX_GREEN_SIZE
, GLX_BLUE_SIZE
, GLX_ALPHA_SIZE
Each attribute, if present, must be followed by a nonnegative minimum
size specification or GLX_DONT_CARE
. The largest available total
RGBA color buffer size (sum of GLX_RED_SIZE
,
GLX_GREEN_SIZE
, GLX_BLUE_SIZE
, and GLX_ALPHA_SIZE
)
of at least the minimum size specified for each color component is
preferred. If the requested number of bits for a color component is 0
or GLX_DONT_CARE
, it is not considered. The default value for
each color component is 0.
GLX_DEPTH_SIZE
Must be followed by a nonnegative minimum size specification. If this value is zero, frame buffer configurations with no depth buffer are preferred. Otherwise, the largest available depth buffer of at least the minimum size is preferred. The default value is 0.
GLX_STENCIL_SIZE
Must be followed by a nonnegative integer 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, frame buffer configurations with no stencil buffer are preferred. The default value is 0.
GLX_ACCUM_RED_SIZE
Must be followed by a nonnegative minimum size specification. If this value is zero, frame buffer configurations with no red accumulation buffer are preferred. Otherwise, the largest possible red accumulation buffer of at least the minimum size is preferred. The default value is 0.
GLX_ACCUM_GREEN_SIZE
Must be followed by a nonnegative minimum size specification. If this value is zero, frame buffer configurations with no green accumulation buffer are preferred. Otherwise, the largest possible green accumulation buffer of at least the minimum size is preferred. The default value is 0.
GLX_ACCUM_BLUE_SIZE
Must be followed by a nonnegative minimum size specification. If this value is zero, frame buffer configurations with no blue accumulation buffer are preferred. Otherwise, the largest possible blue accumulation buffer of at least the minimum size is preferred. The default value is 0.
GLX_ACCUM_ALPHA_SIZE
Must be followed by a nonnegative minimum size specification. If this value is zero, frame buffer configurations with no alpha accumulation buffer are preferred. Otherwise, the largest possible alpha accumulation buffer of at least the minimum size is preferred. The default value is 0.
GLX_RENDER_TYPE
Must be followed by a mask indicating which OpenGL rendering modes the
frame buffer configuration must support. Valid bits are
GLX_RGBA_BIT
and GLX_COLOR_INDEX_BIT
. If the mask is set
to GLX_RGBA_BIT
| GLX_COLOR_INDEX_BIT
, then only frame
buffer configurations that can be bound to both RGBA contexts and color
index contexts will be considered. The default value is
GLX_RGBA_BIT
.
GLX_DRAWABLE_TYPE
Must be followed by a mask indicating which GLX drawable types the frame
buffer configuration must support. Valid bits are
GLX_WINDOW_BIT
, GLX_PIXMAP_BIT
, and
GLX_PBUFFER_BIT
. For example, if mask is set to
GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
, only frame buffer
configurations that support both windows and GLX pixmaps will be
considered. The default value is GLX_WINDOW_BIT
.
GLX_X_RENDERABLE
Must be followed by True
or False
. If True
is
specified, then only frame buffer configurations that have associated X
visuals (and can be used to render to Windows and/or GLX pixmaps) will
be considered. The default value is GLX_DONT_CARE
.
GLX_X_VISUAL_TYPE
Must be followed by one of GLX_TRUE_COLOR
,
GLX_DIRECT_COLOR
, GLX_PSEUDO_COLOR
,
GLX_STATIC_COLOR
, GLX_GRAY_SCALE
, or
GLX_STATIC_GRAY
, indicating the desired X visual type. Not all
frame buffer configurations have an associated X visual. If
GLX_DRAWABLE_TYPE
is specified in attrib_list and the mask
that follows does not have GLX_WINDOW_BIT
set, then this value is
ignored. It is also ignored if GLX_X_RENDERABLE
is specified as
False
. RGBA rendering may be supported for visuals of type
GLX_TRUE_COLOR
, GLX_DIRECT_COLOR
, GLX_PSEUDO_COLOR
,
or GLX_STATIC_COLOR
, but color index rendering is only supported
for visuals of type GLX_PSEUDO_COLOR
or GLX_STATIC_COLOR
(i.e., single-channel visuals). The tokens GLX_GRAY_SCALE
and
GLX_STATIC_GRAY
will not match current OpenGL enabled visuals,
but are included for future use. The default value for
GLX_X_VISUAL_TYPE
is GLX_DONT_CARE
.
GLX_CONFIG_CAVEAT
Must be followed by one of GLX_NONE
, GLX_SLOW_CONFIG
,
GLX_NON_CONFORMANT_CONFIG
. If GLX_NONE
is specified, then
only frame buffer configurations with no caveats will be considered; if
GLX_SLOW_CONFIG
is specified, then only slow frame buffer
configurations will be considered; if GLX_NON_CONFORMANT_CONFIG
is specified, then only nonconformant frame buffer configurations will
be considered. The default value is GLX_DONT_CARE
.
GLX_TRANSPARENT_TYPE
Must be followed by one of GLX_NONE
, GLX_TRANSPARENT_RGB
,
GLX_TRANSPARENT_INDEX
. If GLX_NONE
is specified, then
only opaque frame buffer configurations will be considered; if
GLX_TRANSPARENT_RGB
is specified, then only transparent frame
buffer configurations that support RGBA rendering will be considered; if
GLX_TRANSPARENT_INDEX
is specified, then only transparent frame
buffer configurations that support color index rendering will be
considered. The default value is GLX_NONE
.
GLX_TRANSPARENT_INDEX_VALUE
Must be followed by an integer value indicating the transparent index
value; the value must be between 0 and the maximum frame buffer value
for indices. Only frame buffer configurations that use the specified
transparent index value will be considered. The default value is
GLX_DONT_CARE
. This attribute is ignored unless
GLX_TRANSPARENT_TYPE
is included in attrib_list and
specified as GLX_TRANSPARENT_INDEX
.
GLX_TRANSPARENT_RED_VALUE
Must be followed by an integer value indicating the transparent red
value; the value must be between 0 and the maximum frame buffer value
for red. Only frame buffer configurations that use the specified
transparent red value will be considered. The default value is
GLX_DONT_CARE
. This attribute is ignored unless
GLX_TRANSPARENT_TYPE
is included in attrib_list and
specified as GLX_TRANSPARENT_RGB
.
GLX_TRANSPARENT_GREEN_VALUE
Must be followed by an integer value indicating the transparent green
value; the value must be between 0 and the maximum frame buffer value
for green. Only frame buffer configurations that use the specified
transparent green value will be considered. The default value is
GLX_DONT_CARE
. This attribute is ignored unless
GLX_TRANSPARENT_TYPE
is included in attrib_list and
specified as GLX_TRANSPARENT_RGB
.
GLX_TRANSPARENT_BLUE_VALUE
Must be followed by an integer value indicating the transparent blue
value; the value must be between 0 and the maximum frame buffer value
for blue. Only frame buffer configurations that use the specified
transparent blue value will be considered. The default value is
GLX_DONT_CARE
. This attribute is ignored unless
GLX_TRANSPARENT_TYPE
is included in attrib_list and
specified as GLX_TRANSPARENT_RGB
.
GLX_TRANSPARENT_ALPHA_VALUE
Must be followed by an integer value indicating the transparent alpha
value; the value must be between 0 and the maximum frame buffer value
for alpha. Only frame buffer configurations that use the specified
transparent alpha value will be considered. The default value is
GLX_DONT_CARE
.
When more than one GLX frame buffer configuration matches the specified attributes, a list of matching configurations is returned. The list is sorted according to the following precedence rules, which are applied in ascending order (i.e., configurations that are considered equal by a lower numbered rule are sorted by the higher numbered rule):
By GLX_CONFIG_CAVEAT
where the precedence is GLX_NONE
,
GLX_SLOW_CONFIG
, and GLX_NON_CONFORMANT_CONFIG
.
Larger total number of RGBA color components (GLX_RED_SIZE
,
GLX_GREEN_SIZE
, GLX_BLUE_SIZE
, plus GLX_ALPHA_SIZE
)
that have higher number of bits. If the requested number of bits in
attrib_list is zero or GLX_DONT_CARE
for a particular color
component, then the number of bits for that component is not considered.
Smaller GLX_BUFFER_SIZE
.
Single buffered configuration (GLX_DOUBLEBUFFER
being
False
precedes a double buffered one.
Smaller GLX_AUX_BUFFERS
.
Larger GLX_DEPTH_SIZE
.
Smaller GLX_STENCIL_SIZE
.
Larger total number of accumulation buffer color components
(GLX_ACCUM_RED_SIZE
, GLX_ACCUM_GREEN_SIZE
,
GLX_ACCUM_BLUE_SIZE
, plus GLX_ACCUM_ALPHA_SIZE
) that have
higher number of bits. If the requested number of bits in
attrib_list is zero or GLX_DONT_CARE
for a particular color
component, then the number of bits for that component is not considered.
By GLX_X_VISUAL_TYPE
where the precedence order is
GLX_TRUE_COLOR
, GLX_DIRECT_COLOR
, GLX_PSEUDO_COLOR
,
GLX_STATIC_COLOR
, GLX_GRAY_SCALE
, GLX_STATIC_GRAY
.
NULL
is returned if an undefined GLX attribute is encountered in
attrib_list, if screen is invalid, or if dpy does not
support the GLX extension.
Return a visual that matches specified attributes.
Specifies the connection to the X server.
Specifies the screen number.
Specifies a list of boolean attributes and integer attribute/value
pairs. The last attribute must be None
.
glXChooseVisual
returns a pointer to an XVisualInfo structure
describing 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
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 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 immediately by the
corresponding desired or minimum value. The list must be terminated
with None
.
The interpretations of the various GLX visual attributes are as follows:
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
specified size is preferred. Ignored if GLX_RGBA
is asserted.
GLX_LEVEL
Must be followed by an integer buffer-level specification. 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. Negative buffer levels correspond to underlay frame buffers.
GLX_RGBA
If present, only TrueColor and DirectColor visuals are considered. Otherwise, only PseudoColor and StaticColor visuals are considered.
GLX_DOUBLEBUFFER
If present, only double-buffered visuals are considered. Otherwise, only single-buffered visuals are considered.
GLX_STEREO
If present, only stereo visuals are considered. Otherwise, only monoscopic visuals are considered.
GLX_AUX_BUFFERS
Must be followed by a nonnegative integer that indicates the desired number of auxiliary buffers. Visuals with the smallest number of auxiliary buffers that meets or exceeds the specified number are preferred.
GLX_RED_SIZE
Must be followed by a nonnegative minimum 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.
GLX_GREEN_SIZE
Must be followed by a nonnegative minimum 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.
GLX_BLUE_SIZE
Must be followed by a nonnegative minimum 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.
GLX_ALPHA_SIZE
Must be followed by a nonnegative minimum 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.
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 bitplanes. 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 accumulation buffer of at least the minimum size is preferred.
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 accumulation buffer of at least the minimum size is preferred.
NULL
is returned if an undefined GLX attribute is encountered in
attribList.
Copy state from one rendering context to another.
Specifies the connection to the X server.
Specifies the source context.
Specifies the destination context.
Specifies which portions of src state are to be copied to dst.
glXCopyContext
copies selected groups of state variables from
src to dst. mask indicates which groups of state
variables are to be copied. mask contains the bitwise OR of the
same symbolic names that are passed to the GL command
glPushAttrib
. The single symbolic constant
GLX_ALL_ATTRIB_BITS
can be used to copy the maximum possible
portion of rendering state.
The copy can be done only if the renderers named by src and dst share an address space. Two rendering contexts share an address space if both are nondirect using the same server, or if both are direct and owned by a single process. Note that in the nondirect case it is not necessary for the calling threads to share an address space, only for their related rendering contexts to share an address space.
Not all values for GL state can be copied. For example, pixel pack and
unpack state, render mode state, and select and feedback state are not
copied. The state that can be copied is exactly the state that is
manipulated by the GL command glPushAttrib
.
An implicit glFlush
is done by glXCopyContext
if src
is the current context for the calling thread.
BadMatch
is generated if rendering contexts src and
dst do not share an address space or were not created with respect
to the same screen.
BadAccess
is generated if dst is current to any thread
(including the calling thread) at the time glXCopyContext
is
called.
GLXBadCurrentWindow
is generated if src is the current
context and the current drawable is a window that is no longer valid.
GLXBadContext
is generated if either src or dst is
not a valid GLX context.
Create a new GLX rendering context.
Specifies the connection to the X server.
Specifies the visual that defines the frame buffer resources available
to the rendering context. It is a pointer to an XVisualInfo
structure, not a visual ID or a pointer to a Visual
.
Specifies the context with which to share display lists. NULL
indicates that no sharing is to take place.
Specifies whether rendering is to be done with a direct connection to
the graphics system if possible (True
) or through the X server
(False
).
glXCreateContext
creates a GLX rendering context and returns its
handle. This context can be used to render into both windows and GLX
pixmaps. If glXCreateContext
fails to create a rendering
context, NULL
is returned.
If direct is True
, then a direct rendering context is
created if the implementation supports direct rendering, if the
connection is to an X server that is local, and if a direct rendering
context is available. (An implementation may return an indirect context
when direct is True
.) If direct is False
, then
a rendering context that renders through the X server is always created.
Direct rendering provides a performance advantage in some
implementations. However, direct rendering contexts cannot be shared
outside a single process, and they may be unable to render to GLX
pixmaps.
If shareList is not NULL
, then all display-list indexes and
definitions are shared by context shareList and by the newly
created context. An arbitrary number of contexts can share a single
display-list space. However, all rendering contexts that share a single
display-list space must themselves exist in the same address space. Two
rendering contexts share an address space if both are nondirect using
the same server, or if both are direct and owned by a single process.
Note that in the nondirect case, it is not necessary for the calling
threads to share an address space, only for their related rendering
contexts to share an address space.
If the GL version is 1.1 or greater, then all texture objects except object 0 are shared by any contexts that share display lists.
NULL
is returned if execution fails on the client side.
BadMatch
is generated if the context to be created would not
share the address space or the screen of the context specified by
shareList.
BadValue
is generated if vis is not a valid visual (for
example, if a particular GLX implementation does not support it).
GLXBadContext
is generated if shareList is not a GLX
context and is not NULL
.
BadAlloc
is generated if the server does not have enough
resources to allocate the new context.
Create an off-screen GLX rendering area.
Specifies the connection to the X server.
Specifies the visual that defines the structure of the rendering area.
It is a pointer to an XVisualInfo
structure, not a visual ID or a
pointer to a Visual
.
Specifies the X pixmap that will be used as the front left color buffer of the off-screen rendering area.
glXCreateGLXPixmap
creates an off-screen rendering area and
returns its XID. Any GLX rendering context that was created with
respect to vis can be used to render into this off-screen area.
Use glXMakeCurrent
to associate the rendering area with a GLX
rendering context.
The X pixmap identified by pixmap is used as the front left buffer
of the resulting off-screen rendering area. All other buffers specified
by vis, including color buffers other than the front left buffer,
are created without externally visible names. GLX pixmaps with
double-buffering are supported. However, glXSwapBuffers
is
ignored by these pixmaps.
Some implementations may not support GLX pixmaps with direct rendering contexts.
BadMatch
is generated if the depth of pixmap does not match
the depth value reported by core X11 for vis, or if pixmap
was not created with respect to the same screen as vis.
BadValue
is generated if vis is not a valid XVisualInfo
pointer (for example, if a particular GLX implementation does not
support this visual).
BadPixmap
is generated if pixmap is not a valid pixmap.
BadAlloc
is generated if the server cannot allocate the GLX
pixmap.
Create a new GLX rendering context.
Specifies the connection to the X server.
Specifies the GLXFBConfig structure with the desired attributes for the context.
Specifies the type of the context to be created. Must be one of
GLX_RGBA_TYPE
or GLX_COLOR_INDEX_TYPE
.
Specifies the context with which to share display lists. NULL
indicates that no sharing is to take place.
Specifies whether rendering is to be done with a direct connection to
the graphics system if possible (True
) or through the X server
(False
).
glXCreateNewContext
creates a GLX rendering context and returns
its handle. This context can be used to render into GLX windows,
pixmaps, or pixel buffers. If glXCreateNewContext
fails to
create a rendering context, NULL
is returned.
If render_type is GLX_RGBA_TYPE
, then a context that
supports RGBA rendering is created. If config is
GLX_COLOR_INDEX_TYPE
, then context supporting color-index
rendering is created.
If render_type is not NULL
, then all display-list indexes
and definitions are shared by context render_type and by the newly
created context. An arbitrary number of contexts can share a single
display-list space. However, all rendering contexts that share a single
display-list space must themselves exist in the same address space. Two
rendering contexts share an address space if both are nondirect using
the same server, or if both are direct and owned by a single process.
Note that in the nondirect case, it is not necessary for the calling
threads to share an address space, only for their related rendering
contexts to share an address space.
If share_list is True
, then a direct-rendering context is
created if the implementation supports direct rendering, if the
connection is to an X server that is local, and if a direct-rendering
context is available. (An implementation may return an indirect context
when share_list is True
.) If share_list is
False
, then a rendering context that renders through the X server
is always created. Direct rendering provides a performance advantage in
some implementations. However, direct-rendering contexts cannot be
shared outside a single process, and they may be unable to render to GLX
pixmaps.
NULL
is returned if execution fails on the client side.
GLXBadContext
is generated if render_type is not a GLX
context and is not NULL
.
GLXBadFBConfig
is generated if config is not a valid
GLXFBConfig.
BadMatch
is generated if the context to be created would not
share the address space or the screen of the context specified by
render_type.
BadAlloc
is generated if the server does not have enough
resources to allocate the new context.
BadValue
is generated if config is not a valid visual (for
example, if a particular GLX implementation does not support it).
Create an off-screen rendering area.
Specifies the connection to the X server.
Specifies a GLXFBConfig structure with the desired attributes for the window.
Specifies a list of attribute value pairs, which must be terminated with
None
or NULL
. Accepted attributes are
GLX_PBUFFER_WIDTH
, GLX_PBUFFER_HEIGHT
,
GLX_PRESERVED_CONTENTS
, and GLX_LARGEST_PBUFFER
.
glXCreatePbuffer
creates an off-screen rendering area and returns
its XID. Any GLX rendering context that was created with respect to
config can be used to render into this window. Use
glXMakeContextCurrent
to associate the rendering area with a GLX
rendering context.
The accepted attributes for a GLXPbuffer are:
GLX_PBUFFER_WIDTH
Specify the pixel width of the requested GLXPbuffer. The default value is 0.
GLX_PBUFFER_HEIGHT
Specify the pixel height of the requested GLXPbuffer. The default value is 0.
GLX_LARGEST_PBUFFER
Specify to obtain the largest available pixel buffer, if the requested
allocation would have failed. The width and height of the allocated
pixel buffer will never exceed the specified GLX_PBUFFER_WIDTH
or
GLX_PBUFFER_HEIGHT
, respectively. Use glXQueryDrawable
to
retrieve the dimensions of the allocated pixel buffer. The default
value is False
.
GLX_PRESERVED_CONTENTS
Specify if the contents of the pixel buffer should be preserved when a
resource conflict occurs. If set to False
, the contents of the
pixel buffer may be lost at any time. If set to True
, or not
specified in attrib_list, then the contents of the pixel buffer
will be preserved (most likely by copying the contents into main system
memory from the frame buffer). In either case, the client can register
(using glXSelectEvent
, to receive pixel buffer clobber events
that are generated when the pbuffer contents have been preserved or
damaged.
GLXPbuffers contain the color and ancillary buffers specified by
config. It is possible to create a pixel buffer with back buffers
and to swap those buffers using glXSwapBuffers
.
BadAlloc
is generated if there are insufficient resources to
allocate the requested GLXPbuffer.
GLXBadFBConfig
is generated if config is not a valid
GLXFBConfig.
BadMatch
is generated if config does not support rendering
to pixel buffers (e.g., GLX_DRAWABLE_TYPE
does not contain
GLX_PBUFFER_BIT
).
Create an off-screen rendering area.
Specifies the connection to the X server.
Specifies a GLXFBConfig structure with the desired attributes for the window.
Specifies the X pixmap to be used as the rendering area.
Currently unused. This must be set to NULL
or be an empty list
(i.e., one in which the first element is None
).
glXCreatePixmap
creates an off-screen rendering area and returns
its XID. Any GLX rendering context that was created with respect to
config can be used to render into this window. Use
glXMakeCurrent
to associate the rendering area with a GLX
rendering context.
BadMatch
is generated if pixmap was not created with a
visual that corresponds to config.
BadMatch
is generated if config does not support rendering
to windows (e.g., GLX_DRAWABLE_TYPE
does not contain
GLX_WINDOW_BIT
).
BadWindow
is generated if pixmap is not a valid window XID.
BadAlloc
is generated if there is already a GLXFBConfig
associated with pixmap.
BadAlloc
is generated if the X server cannot allocate a new GLX
window.
GLXBadFBConfig
is generated if config is not a valid
GLXFBConfig.
Create an on-screen rendering area.
Specifies the connection to the X server.
Specifies a GLXFBConfig structure with the desired attributes for the window.
Specifies the X window to be used as the rendering area.
Currently unused. This must be set to NULL
or be an empty list
(i.e., one in which the first element is None
).
glXCreateWindow
creates an on-screen rendering area from an
existing X window that was created with a visual matching config.
The XID of the GLXWindow is returned. Any GLX rendering context that
was created with respect to config can be used to render into this
window. Use glXMakeContextCurrent
to associate the rendering
area with a GLX rendering context.
BadMatch
is generated if win was not created with a visual
that corresponds to config.
BadMatch
is generated if config does not support rendering
to windows (i.e., GLX_DRAWABLE_TYPE
does not contain
GLX_WINDOW_BIT
).
BadWindow
is generated if win is not a valid pixmap XID.
BadAlloc
is generated if there is already a GLXFBConfig
associated with win.
BadAlloc
is generated if the X server cannot allocate a new GLX
window.
GLXBadFBConfig
is generated if config is not a valid
GLXFBConfig.
Destroy a GLX context.
Specifies the connection to the X server.
Specifies the GLX context to be destroyed.
If the GLX rendering context ctx is not current to any thread,
glXDestroyContext
destroys it immediately. Otherwise, ctx
is destroyed when it becomes not current to any thread. In either case,
the resource ID referenced by ctx is freed immediately.
GLXBadContext
is generated if ctx is not a valid GLX
context.
Destroy a GLX pixmap.
Specifies the connection to the X server.
Specifies the GLX pixmap to be destroyed.
If the GLX pixmap pix is not current to any client,
glXDestroyGLXPixmap
destroys it immediately. Otherwise,
pix is destroyed when it becomes not current to any client. In
either case, the resource ID is freed immediately.
GLXBadPixmap
is generated if pix is not a valid GLX pixmap.
Destroy an off-screen rendering area.
Specifies the connection to the X server.
Specifies the GLXPbuffer to be destroyed.
glXDestroyPbuffer
destroys a GLXPbuffer created by
glXCreatePbuffer
.
GLXBadPbuffer
is generated if pbuf is not a valid
GLXPbuffer.
Destroy an off-screen rendering area.
Specifies the connection to the X server.
Specifies the GLXPixmap to be destroyed.
glXDestroyPixmap
destroys a GLXPixmap created by
glXCreatePixmap
.
GLXBadPixmap
is generated if pixmap is not a valid
GLXPixmap.
Destroy an on-screen rendering area.
Specifies the connection to the X server.
Specifies the GLXWindow to be destroyed.
glXDestroyWindow
destroys a GLXWindow created by
glXCreateWindow
.
GLXBadWindow
is generated if win is not a valid GLXPixmap.
Free client-side memory for imported context.
Specifies the connection to the X server.
Specifies a GLX rendering context.
glXFreeContextEXT
frees the client-side part of a GLXContext that
was created with glXImportContextEXT
. glXFreeContextEXT
does not free the server-side context information or the XID associated
with the server-side context.
glXFreeContextEXT
is part of the EXT_import_context
extension, not part of the core GLX command set. If
_glxextstring(EXT_import_context) is included in the string returned by
glXQueryExtensionsString
, when called with argument
GLX_EXTENSIONS
, extension EXT_vertex_array
is supported.
GLXBadContext
is generated if ctx does not refer to a valid
context.
Return a string describing the client.
Specifies the connection to the X server.
Specifies which string is returned. The symbolic constants
GLX_VENDOR
, GLX_VERSION
, and GLX_EXTENSIONS
are
accepted.
glXGetClientString
returns a string describing some aspect of the
client library. The possible values for name are
GLX_VENDOR
, GLX_VERSION
, and GLX_EXTENSIONS
. If
name is not set to one of these values, glXGetClientString
returns NULL
. The format and contents of the vendor string is
implementation dependent.
The extensions string is null-terminated and contains a space-separated list of extension names. (The extension names never contain spaces.) If there are no extensions to GLX, then the empty string is returned.
The version string is laid out as follows:
<major_version.minor_version><space><vendor-specific info>
Both the major and minor portions of the version number are of arbitrary length. The vendor-specific information is optional. However, if it is present, the format and contents are implementation specific.
Return information about GLX visuals.
Specifies the connection to the X server.
Specifies the visual to be queried. It is a pointer to an
XVisualInfo
structure, not a visual ID or a pointer to a
Visual
.
Specifies the visual attribute to be returned.
Returns the requested value.
glXGetConfig
sets value to the attrib value of
windows or GLX pixmaps created with respect to vis.
glXGetConfig
returns an error code if it fails for any reason.
Otherwise, zero is returned.
attrib is one of the following:
GLX_USE_GL
True
if OpenGL rendering is supported by this visual,
False
otherwise.
GLX_BUFFER_SIZE
Number of bits per color buffer. For RGBA visuals,
GLX_BUFFER_SIZE
is the sum of GLX_RED_SIZE
,
GLX_GREEN_SIZE
, GLX_BLUE_SIZE
, and GLX_ALPHA_SIZE
.
For color index visuals, GLX_BUFFER_SIZE
is the size of the color
indexes.
GLX_LEVEL
Frame buffer level of the visual. Level zero is the default frame buffer. Positive levels correspond to frame buffers that overlay the default buffer, and negative levels correspond to frame buffers that underlay the default buffer.
GLX_RGBA
True
if color buffers store red, green, blue, and alpha values.
False
if they store color indexes.
GLX_DOUBLEBUFFER
True
if color buffers exist in front/back pairs that can be
swapped, False
otherwise.
GLX_STEREO
True
if color buffers exist in left/right pairs, False
otherwise.
GLX_AUX_BUFFERS
Number of auxiliary color buffers that are available. Zero indicates that no auxiliary color buffers exist.
GLX_RED_SIZE
Number of bits of red stored in each color buffer. Undefined if
GLX_RGBA
is False
.
GLX_GREEN_SIZE
Number of bits of green stored in each color buffer. Undefined if
GLX_RGBA
is False
.
GLX_BLUE_SIZE
Number of bits of blue stored in each color buffer. Undefined if
GLX_RGBA
is False
.
GLX_ALPHA_SIZE
Number of bits of alpha stored in each color buffer. Undefined if
GLX_RGBA
is False
.
GLX_DEPTH_SIZE
Number of bits in the depth buffer.
GLX_STENCIL_SIZE
Number of bits in the stencil buffer.
GLX_ACCUM_RED_SIZE
Number of bits of red stored in the accumulation buffer.
GLX_ACCUM_GREEN_SIZE
Number of bits of green stored in the accumulation buffer.
GLX_ACCUM_BLUE_SIZE
Number of bits of blue stored in the accumulation buffer.
GLX_ACCUM_ALPHA_SIZE
Number of bits of alpha stored in the accumulation buffer.
The X protocol allows a single visual ID to be instantiated with
different numbers of bits per pixel. Windows or GLX pixmaps that will
be rendered with OpenGL, however, must be instantiated with a color
buffer depth of GLX_BUFFER_SIZE
.
Although a GLX implementation can export many visuals that support GL
rendering, it must support at least one RGBA visual. This visual must
have at least one color buffer, a stencil buffer of at least 1 bit, a
depth buffer of at least 12 bits, and an accumulation buffer. Alpha
bitplanes are optional in this visual. However, its color buffer size
must be as great as that of the deepest TrueColor
,
DirectColor
, PseudoColor
, or StaticColor
visual
supported on level zero, and it must itself be made available on level
zero.
In addition, if the X server exports a PseudoColor
or
StaticColor
visual on framebuffer level 0, a color index visual
is also required on that level. It must have at least one color buffer,
a stencil buffer of at least 1 bit, and a depth buffer of at least 12
bits. This visual must have as many color bitplanes as the deepest
PseudoColor
or StaticColor
visual supported on level 0.
Applications are best written to select the visual that most closely meets their requirements. Creating windows or GLX pixmaps with unnecessary buffers can result in reduced rendering performance as well as poor resource allocation.
GLX_NO_EXTENSION
is returned if dpy does not support the
GLX extension.
GLX_BAD_SCREEN
is returned if the screen of vis does not
correspond to a screen.
GLX_BAD_ATTRIBUTE
is returned if attrib is not a valid GLX
attribute.
GLX_BAD_VISUAL
is returned if vis doesn’t support GLX and
an attribute other than GLX_USE_GL
is requested.
Get the XID for a context..
Specifies a GLX rendering context.
glXGetContextIDEXT
returns the XID associated with a GLXContext.
No round trip is forced to the server; unlike most X calls that return a
value, glXGetContextIDEXT
does not flush any pending events.
glXGetContextIDEXT
is part of the EXT_import_context
extension, not part of the core GLX command set. If
_glxextstring(EXT_import_context) is included in the string returned by
glXQueryExtensionsString
, when called with argument
GLX_EXTENSIONS
, extension EXT_import_context
is supported.
GLXBadContext
is generated if ctx does not refer to a valid
context.
Return the current context.
glXGetCurrentContext
returns the current context, as specified by
glXMakeCurrent
. If there is no current context, NULL
is
returned.
glXGetCurrentContext
returns client-side information. It does
not make a round trip to the server.
Get display for current context.
glXGetCurrentDisplay
returns the display for the current context.
If no context is current, NULL
is returned.
glXGetCurrentDisplay
returns client-side information. It does
not make a round-trip to the server, and therefore does not flush any
pending events.
Return the current drawable.
glXGetCurrentDrawable
returns the current drawable, as specified
by glXMakeCurrent
. If there is no current drawable, None
is returned.
glXGetCurrentDrawable
returns client-side information. It does
not make a round trip to the server.
Return the current drawable.
glXGetCurrentReadDrawable
returns the current read drawable, as
specified by read
parameter of glXMakeContextCurrent
. If
there is no current drawable, None
is returned.
glXGetCurrentReadDrawable
returns client-side information. It
does not make a round-trip to the server.
Return information about a GLX frame buffer configuration.
Specifies the connection to the X server.
Specifies the GLX frame buffer configuration to be queried.
Specifies the attribute to be returned.
Returns the requested value.
glXGetFBConfigAttrib
sets value to the attribute
value of GLX drawables created with respect to config.
glXGetFBConfigAttrib
returns an error code if it fails for any
reason. Otherwise, Success
is returned.
attribute is one of the following:
GLX_FBCONFIG_ID
XID of the given GLXFBConfig.
GLX_BUFFER_SIZE
Number of bits per color buffer. If the frame buffer configuration
supports RGBA contexts, then GLX_BUFFER_SIZE
is the sum of
GLX_RED_SIZE
, GLX_GREEN_SIZE
, GLX_BLUE_SIZE
, and
GLX_ALPHA_SIZE
. If the frame buffer configuration supports only
color index contexts, GLX_BUFFER_SIZE
is the size of the color
indexes.
GLX_LEVEL
Frame buffer level of the configuration. Level zero is the default frame buffer. Positive levels correspond to frame buffers that overlay the default buffer, and negative levels correspond to frame buffers that underlie the default buffer.
GLX_DOUBLEBUFFER
True
if color buffers exist in front/back pairs that can be
swapped, False
otherwise.
GLX_STEREO
True
if color buffers exist in left/right pairs, False
otherwise.
GLX_AUX_BUFFERS
Number of auxiliary color buffers that are available. Zero indicates that no auxiliary color buffers exist.
GLX_RED_SIZE
Number of bits of red stored in each color buffer. Undefined if RGBA contexts are not supported by the frame buffer configuration.
GLX_GREEN_SIZE
Number of bits of green stored in each color buffer. Undefined if RGBA contexts are not supported by the frame buffer configuration.
GLX_BLUE_SIZE
Number of bits of blue stored in each color buffer. Undefined if RGBA contexts are not supported by the frame buffer configuration.
GLX_ALPHA_SIZE
Number of bits of alpha stored in each color buffer. Undefined if RGBA contexts are not supported by the frame buffer configuration.
GLX_DEPTH_SIZE
Number of bits in the depth buffer.
GLX_STENCIL_SIZE
Number of bits in the stencil buffer.
GLX_ACCUM_RED_SIZE
Number of bits of red stored in the accumulation buffer.
GLX_ACCUM_GREEN_SIZE
Number of bits of green stored in the accumulation buffer.
GLX_ACCUM_BLUE_SIZE
Number of bits of blue stored in the accumulation buffer.
GLX_ACCUM_ALPHA_SIZE
Number of bits of alpha stored in the accumulation buffer.
GLX_RENDER_TYPE
Mask indicating what type of GLX contexts can be made current to the
frame buffer configuration. Valid bits are GLX_RGBA_BIT
and
GLX_COLOR_INDEX_BIT
.
GLX_DRAWABLE_TYPE
Mask indicating what drawable types the frame buffer configuration
supports. Valid bits are GLX_WINDOW_BIT
, GLX_PIXMAP_BIT
,
and GLX_PBUFFER_BIT
.
GLX_X_RENDERABLE
True
if drawables created with the frame buffer configuration can
be rendered to by X.
GLX_VISUAL_ID
XID of the corresponding visual, or zero if there is no associated
visual (i.e., if GLX_X_RENDERABLE
is False
or
GLX_DRAWABLE_TYPE
does not have the GLX_WINDOW_BIT
bit
set).
GLX_X_VISUAL_TYPE
Visual type of associated visual. The returned value will be one of:
GLX_TRUE_COLOR
, GLX_DIRECT_COLOR
, GLX_PSEUDO_COLOR
,
GLX_STATIC_COLOR
, GLX_GRAY_SCALE
, GLX_STATIC_GRAY
,
or GLX_NONE
, if there is no associated visual (i.e., if
GLX_X_RENDERABLE
is False
or GLX_DRAWABLE_TYPE
does
not have the GLX_WINDOW_BIT
bit set).
GLX_CONFIG_CAVEAT
One of GLX_NONE
, GLX_SLOW_CONFIG
, or
GLX_NON_CONFORMANT_CONFIG
, indicating that the frame buffer
configuration has no caveats, some aspect of the frame buffer
configuration runs slower than other frame buffer configurations, or
some aspect of the frame buffer configuration is nonconformant,
respectively.
GLX_TRANSPARENT_TYPE
One of GLX_NONE
, GLX_TRANSPARENT_RGB
,
GLX_TRANSPARENT_INDEX
, indicating that the frame buffer
configuration is opaque, is transparent for particular values of red,
green, and blue, or is transparent for particular index values,
respectively.
GLX_TRANSPARENT_INDEX_VALUE
Integer value between 0 and the maximum frame buffer value for indices,
indicating the transparent index value for the frame buffer
configuration. Undefined if GLX_TRANSPARENT_TYPE
is not
GLX_TRANSPARENT_INDEX
.
GLX_TRANSPARENT_RED_VALUE
Integer value between 0 and the maximum frame buffer value for red,
indicating the transparent red value for the frame buffer configuration.
Undefined if GLX_TRANSPARENT_TYPE
is not
GLX_TRANSPARENT_RGB
.
GLX_TRANSPARENT_GREEN_VALUE
Integer value between 0 and the maximum frame buffer value for green,
indicating the transparent green value for the frame buffer
configuration. Undefined if GLX_TRANSPARENT_TYPE
is not
GLX_TRANSPARENT_RGB
.
GLX_TRANSPARENT_BLUE_VALUE
Integer value between 0 and the maximum frame buffer value for blue,
indicating the transparent blue value for the frame buffer
configuration. Undefined if GLX_TRANSPARENT_TYPE
is not
GLX_TRANSPARENT_RGB
.
GLX_TRANSPARENT_ALPHA_VALUE
Integer value between 0 and the maximum frame buffer value for alpha,
indicating the transparent blue value for the frame buffer
configuration. Undefined if GLX_TRANSPARENT_TYPE
is not
GLX_TRANSPARENT_RGB
.
GLX_MAX_PBUFFER_WIDTH
The maximum width that can be specified to glXCreatePbuffer
.
GLX_MAX_PBUFFER_HEIGHT
The maximum height that can be specified to glXCreatePbuffer
.
GLX_MAX_PBUFFER_PIXELS
The maximum number of pixels (width times height) for a pixel buffer.
Note that this value may be less than GLX_MAX_PBUFFER_WIDTH
times
GLX_MAX_PBUFFER_HEIGHT
. Also, this value is static and assumes
that no other pixel buffers or X resources are contending for the frame
buffer memory. As a result, it may not be possible to allocate a pixel
buffer of the size given by GLX_MAX_PBUFFER_PIXELS
.
Applications should choose the frame buffer configuration that most closely meets their requirements. Creating windows, GLX pixmaps, or GLX pixel buffers with unnecessary buffers can result in reduced rendering performance as well as poor resource allocation.
GLX_NO_EXTENSION
is returned if dpy does not support the
GLX extension. GLX_BAD_ATTRIBUTE
is returned if attribute
is not a valid GLX attribute.
List all GLX frame buffer configurations for a given screen.
Specifies the connection to the X server.
Specifies the screen number.
Returns the number of GLXFBConfigs returned.
glXGetFBConfigs
returns a list of all GLXFBConfigs available on
the screen specified by screen. Use glXGetFBConfigAttrib
to obtain attribute values from a specific GLXFBConfig.
Obtain a pointer to an OpenGL or GLX function.
Specifies the name of the OpenGL or GLX function whose address is to be returned.
glXGetProcAddress
returns the address of the function specified
in procName. This is necessary in environments where the OpenGL
link library exports a different set of functions than the runtime
library.
Returns GLX events that are selected for a window or a GLX pixel buffer.
Specifies the connection to the X server.
Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
Returns the events that are selected for draw.
glXGetSelectedEvent
returns in event_mask the events
selected for draw.
GLXBadDrawable
is generated if draw is not a valid window
or a valid GLX pixel buffer.
Return visual that is associated with the frame buffer configuration.
Specifies the connection to the X server.
Specifies the GLX frame buffer configuration.
If config is a valid GLX frame buffer configuration and it has an
associated X Visual, then information describing that visual is
returned; otherwise NULL
is returned. Use XFree
to free
the data returned.
Returns NULL
if config is not a valid GLXFBConfig.
Import another process’s indirect rendering context..
Specifies the connection to the X server.
Specifies a GLX rendering context.
glXImportContextEXT
creates a GLXContext given the XID of an
existing GLXContext. It may be used in place of
glXCreateContext
, to share another process’s indirect rendering
context.
Only the server-side context information can be shared between X
clients; client-side state, such as pixel storage modes, cannot be
shared. Thus, glXImportContextEXT
must allocate memory to store
client-side information. This memory is freed by calling
glXFreeContextEXT
.
This call does not create a new XID. It merely makes an existing object available to the importing client (Display *). Like any XID, it goes away when the creating client drops its connection or the ID is explicitly deleted. Note that this is when the XID goes away. The object goes away when the XID goes away AND the context is not current to any thread.
If contextID refers to a direct rendering context then no error is
generated but glXImportContextEXT
returns NULL.
glXImportContextEXT
is part of the EXT_import_context
extension, not part of the core GLX command set. If
_glxextstring(EXT_import_context) is included in the string returned by
glXQueryExtensionsString
, when called with argument
GLX_EXTENSIONS
, extension EXT_import_context
is supported.
GLXBadContext
is generated if contextID does not refer to a
valid context.
Indicate whether direct rendering is enabled.
Specifies the connection to the X server.
Specifies the GLX context that is being queried.
glXIsDirect
returns True
if ctx is a direct
rendering context, False
otherwise. Direct rendering contexts
pass rendering commands directly from the calling process’s address
space to the rendering system, bypassing the X server. Nondirect
rendering contexts pass all rendering commands to the X server.
GLXBadContext
is generated if ctx is not a valid GLX
context.
Attach a GLX context to a GLX drawable.
Specifies the connection to the X server.
Specifies a GLX drawable to render into. Must be an XID representing a GLXWindow, GLXPixmap, or GLXPbuffer.
Specifies a GLX drawable to read from. Must be an XID representing a GLXWindow, GLXPixmap, or GLXPbuffer.
Specifies the GLX context to be bound to read and ctx.
glXMakeContextCurrent
binds ctx to the current rendering
thread and to the draw and read GLX drawables. draw
and read may be the same.
draw is used for all OpenGL operations except:
Any pixel data that are read based on the value of
GLX_READ_BUFFER
. Note that accumulation operations use the value
of GLX_READ_BUFFER
, but are not allowed unless draw is
identical to read.
Any depth values that are retrieved by glReadPixels
or
glCopyPixels
.
Any stencil values that are retrieved by glReadPixels
or
glCopyPixels
.
Frame buffer values are taken from draw.
If the current rendering thread has a current rendering context, that context is flushed and replaced by ctx.
The first time that ctx is made current, the viewport and scissor dimensions are set to the size of the draw drawable. The viewport and scissor are not modified when ctx is subsequently made current.
To release the current context without assigning a new one, call
glXMakeContextCurrent
with draw and read set to
None
and ctx set to NULL
.
glXMakeContextCurrent
returns True
if it is successful,
False
otherwise. If False
is returned, the previously
current rendering context and drawable (if any) remain unchanged.
BadMatch
is generated if draw and read are not
compatible.
BadAccess
is generated if ctx is current to some other
thread.
GLXContextState
is generated if there is a current rendering
context and its render mode is either GLX_FEEDBACK
or
GLX_SELECT
.
GLXBadContext
is generated if ctx is not a valid GLX
rendering context.
GLXBadDrawable
is generated if draw or read is not a
valid GLX drawable.
GLXBadWindow
is generated if the underlying X window for either
draw or read is no longer valid.
GLXBadCurrentDrawable
is generated if the previous context of the
calling thread has unflushed commands and the previous drawable is no
longer valid.
BadAlloc
is generated if the X server does not have enough
resources to allocate the buffers.
BadMatch
is generated if:
draw and read cannot fit into frame buffer memory simultaneously.
draw or read is a GLXPixmap and ctx is a direct-rendering context.
draw or read is a GLXPixmap and ctx was previously bound to a GLXWindow or GLXPbuffer.
draw or read is a GLXWindow or GLXPbuffer and ctx was previously bound to a GLXPixmap.
Attach a GLX context to a window or a GLX pixmap.
Specifies the connection to the X server.
Specifies a GLX drawable. Must be either an X window ID or a GLX pixmap ID.
Specifies a GLX rendering context that is to be attached to drawable.
glXMakeCurrent
does two things: It makes ctx the current
GLX rendering context of the calling thread, replacing the previously
current context if there was one, and it attaches ctx to a GLX
drawable, either a window or a GLX pixmap. As a result of these two
actions, subsequent GL rendering calls use rendering context ctx
to modify GLX drawable drawable (for reading and writing). Because
glXMakeCurrent
always replaces the current rendering context with
ctx, there can be only one current context per thread.
Pending commands to the previous context, if any, are flushed before it is released.
The first time ctx is made current to any thread, its viewport is
set to the full size of drawable. Subsequent calls by any thread
to glXMakeCurrent
with ctx have no effect on its viewport.
To release the current context without assigning a new one, call
glXMakeCurrent
with drawable set to None
and
ctx set to NULL
.
glXMakeCurrent
returns True
if it is successful,
False
otherwise. If False
is returned, the previously
current rendering context and drawable (if any) remain unchanged.
BadMatch
is generated if drawable was not created with the
same X screen and visual as ctx. It is also generated if
drawable is None
and ctx is not NULL
.
BadAccess
is generated if ctx was current to another thread
at the time glXMakeCurrent
was called.
GLXBadDrawable
is generated if drawable is not a valid GLX
drawable.
GLXBadContext
is generated if ctx is not a valid GLX
context.
GLXBadContextState
is generated if glXMakeCurrent
is
executed between the execution of glBegin
and the corresponding
execution of glEnd
.
GLXBadContextState
is also generated if the rendering context
current to the calling thread has GL renderer state GLX_FEEDBACK
or GLX_SELECT
.
GLXBadCurrentWindow
is generated if there are pending GL commands
for the previous context and the current drawable is a window that is no
longer valid.
BadAlloc
may be generated if the server has delayed allocation of
ancillary buffers until glXMakeCurrent
is called, only to find
that it has insufficient resources to complete the allocation.
Query context information.
Specifies the connection to the X server.
Specifies a GLX rendering context.
Specifies that a context parameter should be retrieved. Must be one of
GLX_SHARED_CONTEXT_EXT
, GLX_VISUAL_ID_EXT
, or
GLX_SCREEN_EXT
.
Contains the return value for attribute.
glXQueryContextInfoEXT
sets value to the value of
attribute with respect to ctx. glXQueryContextInfoEXT
returns an error code if it fails for any reason. Otherwise,
Success
is returned.
attribute may be one of the following:
GLX_SHARED_CONTEXT_EXT
Returns the XID of the share list context associated with ctx at its creation.
GLX_VISUAL_ID_EXT
Returns the XID of the GLX Visual associated with ctx.
GLX_SCREEN_EXT
Returns the screen number associated with ctx.
This call may cause a round-trip to the server.
glXQueryContextInfoEXT
is part of the EXT_import_context
extension, not part of the core GLX command set. If
_glxextstring(EXT_import_context) is included in the string returned by
glXQueryExtensionsString
, when called with argument
GLX_EXTENSIONS
, extension EXT_import_context
is supported.
GLXBadContext
is generated if ctx does not refer to a valid
context.
GLX_BAD_ATTRIBUTE
is returned if attribute is not a valid
GLX context attribute.
fred GLX_BAD_CONTEXT
is returned if attribute is not a
valid context.
Query context information.
Specifies the connection to the X server.
Specifies a GLX rendering context.
Specifies that a context parameter should be retrieved. Must be one of
GLX_FBCONFIG_ID
, GLX_RENDER_TYPE
, or GLX_SCREEN
.
Contains the return value for attribute.
glXQueryContext
sets value to the value of attribute
with respect to ctx. attribute may be one of the following:
GLX_FBCONFIG_ID
Returns the XID of the GLXFBConfig associated with ctx.
GLX_RENDER_TYPE
Returns the rendering type supported by ctx.
GLX_SCREEN
Returns the screen number associated with ctx.
Success
is returned unless attribute is not a valid GLX
context attribute, in which case GLX_BAD_ATTRIBUTE
is returned.
This call may cause a round-trip to the server.
GLXBadContext
is generated if ctx does not refer to a valid
context.
Returns an attribute assoicated with a GLX drawable.
Specifies the connection to the X server.
Specifies the GLX drawable to be queried.
Specifies the attribute to be returned. Must be one of
GLX_WIDTH
, GLX_HEIGHT
, GLX_PRESERVED_CONTENTS
,
GLX_LARGEST_PBUFFER
, or GLX_FBCONFIG_ID
.
Contains the return value for attribute.
glXQueryDrawable
sets value to the value of attribute
with respect to the GLXDrawable draw.
attribute may be one of the following:
GLX_WIDTH
Returns the width of ctx.
GLX_HEIGHT
Returns the height of ctx.
GLX_PRESERVED_CONTENTS
Returns True
if the contents of a GLXPbuffer are preserved when a
resource conflict occurs; False
otherwise.
GLX_LARGEST_PBUFFER
Returns the value set when glXCreatePbuffer
was called to create
the GLXPbuffer. If False
is returned, then the call to
glXCreatePbuffer
will fail to create a GLXPbuffer if the
requested size is larger than the implementation maximum or available
resources. If True
is returned, a GLXPbuffer of the maximum
availble size (if less than the requested width and height) is created.
GLX_FBCONFIG_ID
Returns the XID for draw.
If draw is a GLXWindow or GLXPixmap and attribute is set to
GLX_PRESERVED_CONTENTS
or GLX_LARGETST_PBUFFER
, the
contents of value are undefined. If attribute is not one of
the attributes listed above, the contents of value are unedfined.
A GLXBadDrawable
is generated if draw is not a valid
GLXDrawable.
Return list of supported extensions.
Specifies the connection to the X server.
Specifies the screen number.
glXQueryExtensionsString
returns a pointer to a string describing
which GLX extensions are supported on the connection. The string is
null-terminated and contains a space-separated list of extension names.
(The extension names themselves never contain spaces.) If there are no
extensions to GLX, then the empty string is returned.
Indicate whether the GLX extension is supported.
Specifies the connection to the X server.
Returns the base error code of the GLX server extension.
Returns the base event code of the GLX server extension.
glXQueryExtension
returns True
if the X server of
connection dpy supports the GLX extension, False
otherwise.
If True
is returned, then errorBase and eventBase
return the error base and event base of the GLX extension. These values
should be added to the constant error and event values to determine the
actual event or error values. Otherwise, errorBase and
eventBase are unchanged.
errorBase and eventBase do not return values if they are
specified as NULL
.
Return string describing the server.
Specifies the connection to the X server.
Specifies the screen number.
Specifies which string is returned: one of GLX_VENDOR
,
GLX_VERSION
, or GLX_EXTENSIONS
.
glXQueryServerString
returns a pointer to a static,
null-terminated string describing some aspect of the server’s GLX
extension. The possible values for name and the format of the
strings is the same as for glXGetClientString
. If name is
not set to a recognized value, NULL
is returned.
Return the version numbers of the GLX extension.
Specifies the connection to the X server.
Returns the major version number of the GLX server extension.
Returns the minor version number of the GLX server extension.
glXQueryVersion
returns the major and minor version numbers of
the GLX extension implemented by the server associated with connection
dpy. Implementations with the same major version number are
upward compatible, meaning that the implementation with the higher minor
number is a superset of the version with the lower minor number.
major and minor do not return values if they are specified
as NULL
.
glXQueryVersion
returns False
if it fails, True
otherwise.
major and minor are not updated when False
is
returned.
Select GLX events for a window or a GLX pixel buffer.
Specifies the connection to the X server.
Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
Specifies the events to be returned for draw.
glXSelectEvent
sets the GLX event mask for a GLX pixel buffer or
a window. Calling glXSelectEvent
overrides any previous event
mask that was set by the client for draw. Note that it does not
affect the event masks that other clients may have specified for
draw since each client rendering to draw has a separate
event mask for it.
Currently, only one GLX event, GLX_PBUFFER_CLOBBER_MASK
, can be
selected. The following data is returned to the client when a
GLX_PBUFFER_CLOBBER_MASK
event occurs:
typedef struct {
/* GLX_DAMAGED or GLX_SAVED */
/* GLX_WINDOW or GLX_PBUFFER */
/* # of last request processed by server */
/* true if this came for SendEvent request */
/* display the event was read from */
/* i.d. of Drawable */
/* mask indicating affected buffers */
/* if nonzero, at least this many more */
} GLXPbufferClobberEvent; The valid bit masks used in buffer_mask are:
Corresponding Buffer
GLX_FRONT_LEFT_BUFFER_BIT
Front left color buffer
GLX_FRONT_RIGHT_BUFFER_BIT
Front right color buffer
GLX_BACK_LEFT_BUFFER_BIT
Back left color buffer
GLX_BACK_RIGHT_BUFFER_BIT
Back right color buffer
GLX_AUX_BUFFERS_BIT
Auxiliary buffer
GLX_DEPTH_BUFFER_BIT
Depth buffer
GLX_STENCIL_BUFFER_BIT
Stencil buffer
GLX_ACCUM_BUFFER_BIT
Accumulation buffer
A single X server operation can cause several buffer clobber events to be sent. (e.g., a single GLX pixel buffer may be damaged and cause multiple buffer clobber events to be generated). Each event specifies one region of the GLX drawable that was affected by the X Server operation. The buffer_mask field indicates which color buffers and ancillary buffers were affected. All the buffer clobber events generated by a single X server action are guaranteed to be contiguous in the event queue. The conditions under which this event is generated and the event_type varies, depending on the type of the GLX drawable.
When the GLX_AUX_BUFFERS_BIT
is set in buffer_mask, then
aux_buffer is set to indicate which buffer was affected. If more
than one aux buffer was affected, then additional events are generated
as part of the same contiguous event group. Each additional event will
have only the GLX_AUX_BUFFERS_BIT
set in buffer_mask, and
the aux_buffer field will be set appropriately. For nonstereo
drawables, GLX_FRONT_LEFT_BUFFER_BIT
and
GLX_BACK_LEFT_BUFFER_BIT
are used to specify the front and back
color buffers.
For preserved GLX pixel buffers, a buffer clobber event with type
GLX_SAVED
is generated whenever the contents of the GLX pixel
buffer is moved out of offscreen memory. The event(s) describes which
portions of the GLX pixel buffer were affected. Clients who receive
many buffer clobber events, referring to different save actions, should
consider freeing the GLX pixel buffer resource in order to prevent the
system from thrashing due to insufficient resources.
For an unpreserved GLXPbuffer, a buffer clobber event, with type
GLX_DAMAGED
, is generated whenever a portion of the GLX pixel
buffer becomes invalid. The client may wish to regenerate the invalid
portions of the GLX pixel buffer.
For Windows, buffer clobber events, with type GLX_SAVED
, occur
whenever an ancillary buffer, associated with the window, gets clobbered
or moved out of off-screen memory. The event contains information
indicating which color buffers and ancillary buffers\(emand which
portions of those buffers\(emwere affected.
GLXBadDrawable
is generated if draw is not a valid window
or a valid GLX pixel buffer.
Exchange front and back buffers.
Specifies the connection to the X server.
Specifies the drawable whose buffers are to be swapped.
glXSwapBuffers
promotes the contents of the back buffer of
drawable to become the contents of the front buffer of
drawable. The contents of the back buffer then become undefined.
The update typically takes place during the vertical retrace of the
monitor, rather than immediately after glXSwapBuffers
is called.
glXSwapBuffers
performs an implicit glFlush
before it
returns. Subsequent OpenGL commands may be issued immediately after
calling glXSwapBuffers
, but are not executed until the buffer
exchange is completed.
If drawable was not created with respect to a double-buffered
visual, glXSwapBuffers
has no effect, and no error is generated.
GLXBadDrawable
is generated if drawable is not a valid GLX
drawable.
GLXBadCurrentWindow
is generated if dpy and drawable
are respectively the display and drawable associated with the current
context of the calling thread, and drawable identifies a window
that is no longer valid.
Create bitmap display lists from an X font.
Specifies the font from which character glyphs are to be taken.
Specifies the index of the first glyph to be taken.
Specifies the number of glyphs to be taken.
Specifies the index of the first display list to be generated.
glXUseXFont
generates count display lists, named
listBase through listBase+count-1, each containing
a single glBitmap
command. The parameters of the glBitmap
command of display list listBase+i are derived from
glyph first+i. Bitmap parameters xorig,
yorig, width, and height are computed from
font metrics as descent-1, -lbearing,
rbearing-lbearing, and ascent+descent,
respectively. xmove is taken from the glyph’s width
metric, and ymove is set to zero. Finally, the glyph’s image
is converted to the appropriate format for glBitmap
.
Using glXUseXFont
may be more efficient than accessing the X font
and generating the display lists explicitly, both because the display
lists are created on the server without requiring a round trip of the
glyph data, and because the server may choose to delay the creation of
each bitmap until it is accessed.
Empty display lists are created for all glyphs that are requested and
are not defined in font. glXUseXFont
is ignored if there
is no current GLX context.
BadFont
is generated if font is not a valid font.
GLXBadContextState
is generated if the current GLX context is in
display-list construction mode.
GLXBadCurrentWindow
is generated if the drawable associated with
the current context of the calling thread is a window, and that window
is no longer valid.
Complete GL execution prior to subsequent X calls.
GL rendering calls made prior to glXWaitGL
are guaranteed to be
executed before X rendering calls made after glXWaitGL
. Although
this same result can be achieved using glFinish
, glXWaitGL
does not require a round trip to the server, and it is therefore more
efficient in cases where client and server are on separate machines.
glXWaitGL
is ignored if there is no current GLX context.
GLXBadCurrentWindow
is generated if the drawable associated with
the current context of the calling thread is a window, and that window
is no longer valid.
Complete X execution prior to subsequent GL calls.
X rendering calls made prior to glXWaitX
are guaranteed to be
executed before GL rendering calls made after glXWaitX
. Although
the same result can be achieved using XSync
, glXWaitX
does
not require a round trip to the server, and it is therefore more
efficient in cases where client and server are on separate machines.
glXWaitX
is ignored if there is no current GLX context.
GLXBadCurrentWindow
is generated if the drawable associated with
the current context of the calling thread is a window, and that window
is no longer valid.
Previous: GLX Enumerations, Up: GLX [Index]