4 The functions from this section may be had by loading the module:
7 (use-modules (figl glx low-level)
11 This section of the manual was derived from the upstream OpenGL
12 documentation. Each function's documentation has its own copyright
13 statement; for full details, see the upstream documentation. The
14 copyright notices and licenses present in this section are as follows.
16 Copyright @copyright{} 1991-2006 Silicon Graphics, Inc. This document
17 is licensed under the SGI Free Software B License. For details, see
18 @uref{http://oss.sgi.com/projects/FreeB/,http://oss.sgi.com/projects/FreeB/}.
22 @deftypefun GLXFBConfig-* glXChooseFBConfig dpy screen attrib_list nelements
23 Return a list of GLX frame buffer configurations that match the
28 Specifies the connection to the X server.
31 Specifies the screen number.
33 @item @var{attrib_list}
34 Specifies a list of attribute/value pairs. The last attribute must be
38 Returns the number of elements in the list returned by
39 @code{glXChooseFBConfig}.
43 @code{glXChooseFBConfig} returns GLX frame buffer configurations that
44 match the attributes specified in @var{attrib_list}, or @code{NULL} if
45 no matches are found. If @var{attrib_list} is @code{NULL}, then
46 @code{glXChooseFBConfig} returns an array of GLX frame buffer
47 configurations that are available on the specified screen. If an error
48 occurs, no frame buffer configurations exist on the specified screen, or
49 if no frame buffer configurations match the specified attributes, then
50 @code{NULL} is returned. Use @code{XFree} to free the memory returned
51 by @code{glXChooseFBConfig}.
53 All attributes in @var{attrib_list}, including boolean attributes, are
54 immediately followed by the corresponding desired value. The list is
55 terminated with @code{None}. If an attribute is not specified in
56 @var{attrib_list}, then the default value (see below) is used (and the
57 attribute is said to be specified implicitly). For example, if
58 @code{GLX_STEREO} is not specified, then it is assumed to be
59 @code{False}. For some attributes, the default is @code{GLX_DONT_CARE},
60 meaning that any value is OK for this attribute, so the attribute will
63 Attributes are matched in an attribute-specific manner. Some of the
64 attributes, such as @code{GLX_LEVEL}, must match the specified value
65 exactly; others, such as, @code{GLX_RED_SIZE} must meet or exceed the
66 specified minimum values. If more than one GLX frame buffer
67 configuration is found, then a list of configurations, sorted according
68 to the ``best'' match criteria, is returned. The match criteria for
69 each attribute and the exact sorting order is defined below.
71 The interpretations of the various GLX visual attributes are as follows:
74 @item @code{GLX_FBCONFIG_ID}
77 Must be followed by a valid XID that indicates the desired GLX frame
78 buffer configuration. When a @code{GLX_FBCONFIG_ID} is specified, all
79 attributes are ignored. The default value is @code{GLX_DONT_CARE}.
81 @item @code{GLX_BUFFER_SIZE}
84 Must be followed by a nonnegative integer that indicates the desired
85 color index buffer size. The smallest index buffer of at least the
86 specified size is preferred. This attribute is ignored if
87 @code{GLX_COLOR_INDEX_BIT} is not set in @code{GLX_RENDER_TYPE}. The
90 @item @code{GLX_LEVEL}
93 Must be followed by an integer buffer-level specification. This
94 specification is honored exactly. Buffer level 0 corresponds to the
95 default frame buffer of the display. Buffer level 1 is the first
96 overlay frame buffer, level two the second overlay frame buffer, and so
97 on. Negative buffer levels correspond to underlay frame buffers. The
100 @item @code{GLX_DOUBLEBUFFER}
103 Must be followed by @code{True} or @code{False}. If @code{True} is
104 specified, then only double-buffered frame buffer configurations are
105 considered; if @code{False} is specified, then only single-buffered
106 frame buffer configurations are considered. The default value is
107 @code{GLX_DONT_CARE}.
109 @item @code{GLX_STEREO}
112 Must be followed by @code{True} or @code{False}. If @code{True} is
113 specified, then only stereo frame buffer configurations are considered;
114 if @code{False} is specified, then only monoscopic frame buffer
115 configurations are considered. The default value is @code{False}.
117 @item @code{GLX_AUX_BUFFERS}
120 Must be followed by a nonnegative integer that indicates the desired
121 number of auxiliary buffers. Configurations with the smallest number of
122 auxiliary buffers that meet or exceed the specified number are
123 preferred. The default value is 0.
125 @item @code{GLX_RED_SIZE}, @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, @code{GLX_ALPHA_SIZE}
128 Each attribute, if present, must be followed by a nonnegative minimum
129 size specification or @code{GLX_DONT_CARE}. The largest available total
130 RGBA color buffer size (sum of @code{GLX_RED_SIZE},
131 @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, and @code{GLX_ALPHA_SIZE})
132 of at least the minimum size specified for each color component is
133 preferred. If the requested number of bits for a color component is 0
134 or @code{GLX_DONT_CARE}, it is not considered. The default value for
135 each color component is 0.
137 @item @code{GLX_DEPTH_SIZE}
140 Must be followed by a nonnegative minimum size specification. If this
141 value is zero, frame buffer configurations with no depth buffer are
142 preferred. Otherwise, the largest available depth buffer of at least
143 the minimum size is preferred. The default value is 0.
145 @item @code{GLX_STENCIL_SIZE}
148 Must be followed by a nonnegative integer that indicates the desired
149 number of stencil bitplanes. The smallest stencil buffer of at least
150 the specified size is preferred. If the desired value is zero, frame
151 buffer configurations with no stencil buffer are preferred. The default
154 @item @code{GLX_ACCUM_RED_SIZE}
157 Must be followed by a nonnegative minimum size specification. If this
158 value is zero, frame buffer configurations with no red accumulation
159 buffer are preferred. Otherwise, the largest possible red accumulation
160 buffer of at least the minimum size is preferred. The default value is
163 @item @code{GLX_ACCUM_GREEN_SIZE}
166 Must be followed by a nonnegative minimum size specification. If this
167 value is zero, frame buffer configurations with no green accumulation
168 buffer are preferred. Otherwise, the largest possible green
169 accumulation buffer of at least the minimum size is preferred. The
172 @item @code{GLX_ACCUM_BLUE_SIZE}
175 Must be followed by a nonnegative minimum size specification. If this
176 value is zero, frame buffer configurations with no blue accumulation
177 buffer are preferred. Otherwise, the largest possible blue accumulation
178 buffer of at least the minimum size is preferred. The default value is
181 @item @code{GLX_ACCUM_ALPHA_SIZE}
184 Must be followed by a nonnegative minimum size specification. If this
185 value is zero, frame buffer configurations with no alpha accumulation
186 buffer are preferred. Otherwise, the largest possible alpha
187 accumulation buffer of at least the minimum size is preferred. The
190 @item @code{GLX_RENDER_TYPE}
193 Must be followed by a mask indicating which OpenGL rendering modes the
194 frame buffer configuration must support. Valid bits are
195 @code{GLX_RGBA_BIT} and @code{GLX_COLOR_INDEX_BIT}. If the mask is set
196 to @code{GLX_RGBA_BIT} | @code{GLX_COLOR_INDEX_BIT}, then only frame
197 buffer configurations that can be bound to both RGBA contexts and color
198 index contexts will be considered. The default value is
201 @item @code{GLX_DRAWABLE_TYPE}
204 Must be followed by a mask indicating which GLX drawable types the frame
205 buffer configuration must support. Valid bits are
206 @code{GLX_WINDOW_BIT}, @code{GLX_PIXMAP_BIT}, and
207 @code{GLX_PBUFFER_BIT}. For example, if mask is set to
208 @code{GLX_WINDOW_BIT} | @code{GLX_PIXMAP_BIT}, only frame buffer
209 configurations that support both windows and GLX pixmaps will be
210 considered. The default value is @code{GLX_WINDOW_BIT}.
212 @item @code{GLX_X_RENDERABLE}
215 Must be followed by @code{True} or @code{False}. If @code{True} is
216 specified, then only frame buffer configurations that have associated X
217 visuals (and can be used to render to Windows and/or GLX pixmaps) will
218 be considered. The default value is @code{GLX_DONT_CARE}.
220 @item @code{GLX_X_VISUAL_TYPE}
223 Must be followed by one of @code{GLX_TRUE_COLOR},
224 @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
225 @code{GLX_STATIC_COLOR}, @code{GLX_GRAY_SCALE}, or
226 @code{GLX_STATIC_GRAY}, indicating the desired X visual type. Not all
227 frame buffer configurations have an associated X visual. If
228 @code{GLX_DRAWABLE_TYPE} is specified in @var{attrib_list} and the mask
229 that follows does not have @code{GLX_WINDOW_BIT} set, then this value is
230 ignored. It is also ignored if @code{GLX_X_RENDERABLE} is specified as
231 @code{False}. RGBA rendering may be supported for visuals of type
232 @code{GLX_TRUE_COLOR}, @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
233 or @code{GLX_STATIC_COLOR}, but color index rendering is only supported
234 for visuals of type @code{GLX_PSEUDO_COLOR} or @code{GLX_STATIC_COLOR}
235 (i.e., single-channel visuals). The tokens @code{GLX_GRAY_SCALE} and
236 @code{GLX_STATIC_GRAY} will not match current OpenGL enabled visuals,
237 but are included for future use. The default value for
238 @code{GLX_X_VISUAL_TYPE} is @code{GLX_DONT_CARE}.
240 @item @code{GLX_CONFIG_CAVEAT}
243 Must be followed by one of @code{GLX_NONE}, @code{GLX_SLOW_CONFIG},
244 @code{GLX_NON_CONFORMANT_CONFIG}. If @code{GLX_NONE} is specified, then
245 only frame buffer configurations with no caveats will be considered; if
246 @code{GLX_SLOW_CONFIG} is specified, then only slow frame buffer
247 configurations will be considered; if @code{GLX_NON_CONFORMANT_CONFIG}
248 is specified, then only nonconformant frame buffer configurations will
249 be considered. The default value is @code{GLX_DONT_CARE}.
251 @item @code{GLX_TRANSPARENT_TYPE}
254 Must be followed by one of @code{GLX_NONE}, @code{GLX_TRANSPARENT_RGB},
255 @code{GLX_TRANSPARENT_INDEX}. If @code{GLX_NONE} is specified, then
256 only opaque frame buffer configurations will be considered; if
257 @code{GLX_TRANSPARENT_RGB} is specified, then only transparent frame
258 buffer configurations that support RGBA rendering will be considered; if
259 @code{GLX_TRANSPARENT_INDEX} is specified, then only transparent frame
260 buffer configurations that support color index rendering will be
261 considered. The default value is @code{GLX_NONE}.
263 @item @code{GLX_TRANSPARENT_INDEX_VALUE}
266 Must be followed by an integer value indicating the transparent index
267 value; the value must be between 0 and the maximum frame buffer value
268 for indices. Only frame buffer configurations that use the specified
269 transparent index value will be considered. The default value is
270 @code{GLX_DONT_CARE}. This attribute is ignored unless
271 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
272 specified as @code{GLX_TRANSPARENT_INDEX}.
274 @item @code{GLX_TRANSPARENT_RED_VALUE}
277 Must be followed by an integer value indicating the transparent red
278 value; the value must be between 0 and the maximum frame buffer value
279 for red. Only frame buffer configurations that use the specified
280 transparent red value will be considered. The default value is
281 @code{GLX_DONT_CARE}. This attribute is ignored unless
282 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
283 specified as @code{GLX_TRANSPARENT_RGB}.
285 @item @code{GLX_TRANSPARENT_GREEN_VALUE}
288 Must be followed by an integer value indicating the transparent green
289 value; the value must be between 0 and the maximum frame buffer value
290 for green. Only frame buffer configurations that use the specified
291 transparent green value will be considered. The default value is
292 @code{GLX_DONT_CARE}. This attribute is ignored unless
293 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
294 specified as @code{GLX_TRANSPARENT_RGB}.
296 @item @code{GLX_TRANSPARENT_BLUE_VALUE}
299 Must be followed by an integer value indicating the transparent blue
300 value; the value must be between 0 and the maximum frame buffer value
301 for blue. Only frame buffer configurations that use the specified
302 transparent blue value will be considered. The default value is
303 @code{GLX_DONT_CARE}. This attribute is ignored unless
304 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
305 specified as @code{GLX_TRANSPARENT_RGB}.
307 @item @code{GLX_TRANSPARENT_ALPHA_VALUE}
310 Must be followed by an integer value indicating the transparent alpha
311 value; the value must be between 0 and the maximum frame buffer value
312 for alpha. Only frame buffer configurations that use the specified
313 transparent alpha value will be considered. The default value is
314 @code{GLX_DONT_CARE}.
318 When more than one GLX frame buffer configuration matches the specified
319 attributes, a list of matching configurations is returned. The list is
320 sorted according to the following precedence rules, which are applied in
321 ascending order (i.e., configurations that are considered equal by a
322 lower numbered rule are sorted by the higher numbered rule):
326 By @code{GLX_CONFIG_CAVEAT} where the precedence is @code{GLX_NONE},
327 @code{GLX_SLOW_CONFIG}, and @code{GLX_NON_CONFORMANT_CONFIG}.
330 Larger total number of RGBA color components (@code{GLX_RED_SIZE},
331 @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, plus @code{GLX_ALPHA_SIZE})
332 that have higher number of bits. If the requested number of bits in
333 @var{attrib_list} is zero or @code{GLX_DONT_CARE} for a particular color
334 component, then the number of bits for that component is not considered.
337 Smaller @code{GLX_BUFFER_SIZE}.
340 Single buffered configuration (@code{GLX_DOUBLEBUFFER} being
341 @code{False} precedes a double buffered one.
344 Smaller @code{GLX_AUX_BUFFERS}.
347 Larger @code{GLX_DEPTH_SIZE}.
350 Smaller @code{GLX_STENCIL_SIZE}.
353 Larger total number of accumulation buffer color components
354 (@code{GLX_ACCUM_RED_SIZE}, @code{GLX_ACCUM_GREEN_SIZE},
355 @code{GLX_ACCUM_BLUE_SIZE}, plus @code{GLX_ACCUM_ALPHA_SIZE}) that have
356 higher number of bits. If the requested number of bits in
357 @var{attrib_list} is zero or @code{GLX_DONT_CARE} for a particular color
358 component, then the number of bits for that component is not considered.
361 By @code{GLX_X_VISUAL_TYPE} where the precedence order is
362 @code{GLX_TRUE_COLOR}, @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
363 @code{GLX_STATIC_COLOR}, @code{GLX_GRAY_SCALE}, @code{GLX_STATIC_GRAY}.
367 @code{NULL} is returned if an undefined GLX attribute is encountered in
368 @var{attrib_list}, if @var{screen} is invalid, or if @var{dpy} does not
369 support the GLX extension.
373 @deftypefun XVisualInfo* glXChooseVisual dpy screen attribList
374 Return a visual that matches specified attributes.
378 Specifies the connection to the X server.
381 Specifies the screen number.
383 @item @var{attribList}
384 Specifies a list of boolean attributes and integer attribute/value
385 pairs. The last attribute must be @code{None}.
389 @code{glXChooseVisual} returns a pointer to an XVisualInfo structure
390 describing the visual that best meets a minimum specification. The
391 boolean GLX attributes of the visual that is returned will match the
392 specified values, and the integer GLX attributes will meet or exceed the
393 specified minimum values. If all other attributes are equivalent, then
394 TrueColor and PseudoColor visuals have priority over DirectColor and
395 StaticColor visuals, respectively. If no conforming visual exists,
396 @code{NULL} is returned. To free the data returned by this function,
399 All boolean GLX attributes default to @code{False} except
400 @code{GLX_USE_GL}, which defaults to @code{True}. All integer GLX
401 attributes default to zero. Default specifications are superseded by
402 attributes included in @var{attribList}. Boolean attributes included in
403 @var{attribList} are understood to be @code{True}. Integer attributes
404 and enumerated type attributes are followed immediately by the
405 corresponding desired or minimum value. The list must be terminated
408 The interpretations of the various GLX visual attributes are as follows:
411 @item @code{GLX_USE_GL}
412 Ignored. Only visuals that can be rendered with GLX are considered.
414 @item @code{GLX_BUFFER_SIZE}
415 Must be followed by a nonnegative integer that indicates the desired
416 color index buffer size. The smallest index buffer of at least the
417 specified size is preferred. Ignored if @code{GLX_RGBA} is asserted.
419 @item @code{GLX_LEVEL}
420 Must be followed by an integer buffer-level specification. This
421 specification is honored exactly. Buffer level zero corresponds to the
422 main frame buffer of the display. Buffer level one is the first overlay
423 frame buffer, level two the second overlay frame buffer, and so on.
424 Negative buffer levels correspond to underlay frame buffers.
426 @item @code{GLX_RGBA}
427 If present, only TrueColor and DirectColor visuals are considered.
428 Otherwise, only PseudoColor and StaticColor visuals are considered.
430 @item @code{GLX_DOUBLEBUFFER}
431 If present, only double-buffered visuals are considered. Otherwise,
432 only single-buffered visuals are considered.
434 @item @code{GLX_STEREO}
435 If present, only stereo visuals are considered. Otherwise, only
436 monoscopic visuals are considered.
438 @item @code{GLX_AUX_BUFFERS}
439 Must be followed by a nonnegative integer that indicates the desired
440 number of auxiliary buffers. Visuals with the smallest number of
441 auxiliary buffers that meets or exceeds the specified number are
444 @item @code{GLX_RED_SIZE}
445 Must be followed by a nonnegative minimum size specification. If this
446 value is zero, the smallest available red buffer is preferred.
447 Otherwise, the largest available red buffer of at least the minimum size
450 @item @code{GLX_GREEN_SIZE}
451 Must be followed by a nonnegative minimum size specification. If this
452 value is zero, the smallest available green buffer is preferred.
453 Otherwise, the largest available green buffer of at least the minimum
456 @item @code{GLX_BLUE_SIZE}
457 Must be followed by a nonnegative minimum size specification. If this
458 value is zero, the smallest available blue buffer is preferred.
459 Otherwise, the largest available blue buffer of at least the minimum
462 @item @code{GLX_ALPHA_SIZE}
463 Must be followed by a nonnegative minimum size specification. If this
464 value is zero, the smallest available alpha buffer is preferred.
465 Otherwise, the largest available alpha buffer of at least the minimum
468 @item @code{GLX_DEPTH_SIZE}
469 Must be followed by a nonnegative minimum size specification. If this
470 value is zero, visuals with no depth buffer are preferred. Otherwise,
471 the largest available depth buffer of at least the minimum size is
474 @item @code{GLX_STENCIL_SIZE}
475 Must be followed by a nonnegative integer that indicates the desired
476 number of stencil bitplanes. The smallest stencil buffer of at least
477 the specified size is preferred. If the desired value is zero, visuals
478 with no stencil buffer are preferred.
480 @item @code{GLX_ACCUM_RED_SIZE}
481 Must be followed by a nonnegative minimum size specification. If this
482 value is zero, visuals with no red accumulation buffer are preferred.
483 Otherwise, the largest possible red accumulation buffer of at least the
484 minimum size is preferred.
486 @item @code{GLX_ACCUM_GREEN_SIZE}
487 Must be followed by a nonnegative minimum size specification. If this
488 value is zero, visuals with no green accumulation buffer are preferred.
489 Otherwise, the largest possible green accumulation buffer of at least
490 the minimum size is preferred.
492 @item @code{GLX_ACCUM_BLUE_SIZE}
493 Must be followed by a nonnegative minimum size specification. If this
494 value is zero, visuals with no blue accumulation buffer are preferred.
495 Otherwise, the largest possible blue accumulation buffer of at least the
496 minimum size is preferred.
498 @item @code{GLX_ACCUM_ALPHA_SIZE}
499 Must be followed by a nonnegative minimum size specification. If this
500 value is zero, visuals with no alpha accumulation buffer are preferred.
501 Otherwise, the largest possible alpha accumulation buffer of at least
502 the minimum size is preferred.
506 @code{NULL} is returned if an undefined GLX attribute is encountered in
511 @deftypefun void glXCopyContext dpy src dst mask
512 Copy state from one rendering context to another.
516 Specifies the connection to the X server.
519 Specifies the source context.
522 Specifies the destination context.
525 Specifies which portions of @var{src} state are to be copied to
530 @code{glXCopyContext} copies selected groups of state variables from
531 @var{src} to @var{dst}. @var{mask} indicates which groups of state
532 variables are to be copied. @var{mask} contains the bitwise OR of the
533 same symbolic names that are passed to the GL command
534 @code{glPushAttrib}. The single symbolic constant
535 @code{GLX_ALL_ATTRIB_BITS} can be used to copy the maximum possible
536 portion of rendering state.
538 The copy can be done only if the renderers named by @var{src} and
539 @var{dst} share an address space. Two rendering contexts share an
540 address space if both are nondirect using the same server, or if both
541 are direct and owned by a single process. Note that in the nondirect
542 case it is not necessary for the calling threads to share an address
543 space, only for their related rendering contexts to share an address
546 Not all values for GL state can be copied. For example, pixel pack and
547 unpack state, render mode state, and select and feedback state are not
548 copied. The state that can be copied is exactly the state that is
549 manipulated by the GL command @code{glPushAttrib}.
551 An implicit @code{glFlush} is done by @code{glXCopyContext} if @var{src}
552 is the current context for the calling thread.
554 @code{BadMatch} is generated if rendering contexts @var{src} and
555 @var{dst} do not share an address space or were not created with respect
558 @code{BadAccess} is generated if @var{dst} is current to any thread
559 (including the calling thread) at the time @code{glXCopyContext} is
562 @code{GLXBadCurrentWindow} is generated if @var{src} is the current
563 context and the current drawable is a window that is no longer valid.
565 @code{GLXBadContext} is generated if either @var{src} or @var{dst} is
566 not a valid GLX context.
570 @deftypefun GLXContext glXCreateContext dpy vis shareList direct
571 Create a new GLX rendering context.
575 Specifies the connection to the X server.
578 Specifies the visual that defines the frame buffer resources available
579 to the rendering context. It is a pointer to an @code{XVisualInfo}
580 structure, not a visual ID or a pointer to a @code{Visual}.
582 @item @var{shareList}
583 Specifies the context with which to share display lists. @code{NULL}
584 indicates that no sharing is to take place.
587 Specifies whether rendering is to be done with a direct connection to
588 the graphics system if possible (@code{True}) or through the X server
593 @code{glXCreateContext} creates a GLX rendering context and returns its
594 handle. This context can be used to render into both windows and GLX
595 pixmaps. If @code{glXCreateContext} fails to create a rendering
596 context, @code{NULL} is returned.
598 If @var{direct} is @code{True}, then a direct rendering context is
599 created if the implementation supports direct rendering, if the
600 connection is to an X server that is local, and if a direct rendering
601 context is available. (An implementation may return an indirect context
602 when @var{direct} is @code{True}.) If @var{direct} is @code{False}, then
603 a rendering context that renders through the X server is always created.
604 Direct rendering provides a performance advantage in some
605 implementations. However, direct rendering contexts cannot be shared
606 outside a single process, and they may be unable to render to GLX
609 If @var{shareList} is not @code{NULL}, then all display-list indexes and
610 definitions are shared by context @var{shareList} and by the newly
611 created context. An arbitrary number of contexts can share a single
612 display-list space. However, all rendering contexts that share a single
613 display-list space must themselves exist in the same address space. Two
614 rendering contexts share an address space if both are nondirect using
615 the same server, or if both are direct and owned by a single process.
616 Note that in the nondirect case, it is not necessary for the calling
617 threads to share an address space, only for their related rendering
618 contexts to share an address space.
620 If the GL version is 1.1 or greater, then all texture objects except
621 object 0 are shared by any contexts that share display lists.
623 @code{NULL} is returned if execution fails on the client side.
625 @code{BadMatch} is generated if the context to be created would not
626 share the address space or the screen of the context specified by
629 @code{BadValue} is generated if @var{vis} is not a valid visual (for
630 example, if a particular GLX implementation does not support it).
632 @code{GLXBadContext} is generated if @var{shareList} is not a GLX
633 context and is not @code{NULL}.
635 @code{BadAlloc} is generated if the server does not have enough
636 resources to allocate the new context.
640 @deftypefun GLXPixmap glXCreateGLXPixmap dpy vis pixmap
641 Create an off-screen GLX rendering area.
645 Specifies the connection to the X server.
648 Specifies the visual that defines the structure of the rendering area.
649 It is a pointer to an @code{XVisualInfo} structure, not a visual ID or a
650 pointer to a @code{Visual}.
653 Specifies the X pixmap that will be used as the front left color buffer
654 of the off-screen rendering area.
658 @code{glXCreateGLXPixmap} creates an off-screen rendering area and
659 returns its XID. Any GLX rendering context that was created with
660 respect to @var{vis} can be used to render into this off-screen area.
661 Use @code{glXMakeCurrent} to associate the rendering area with a GLX
664 The X pixmap identified by @var{pixmap} is used as the front left buffer
665 of the resulting off-screen rendering area. All other buffers specified
666 by @var{vis}, including color buffers other than the front left buffer,
667 are created without externally visible names. GLX pixmaps with
668 double-buffering are supported. However, @code{glXSwapBuffers} is
669 ignored by these pixmaps.
671 Some implementations may not support GLX pixmaps with direct rendering
674 @code{BadMatch} is generated if the depth of @var{pixmap} does not match
675 the depth value reported by core X11 for @var{vis}, or if @var{pixmap}
676 was not created with respect to the same screen as @var{vis}.
678 @code{BadValue} is generated if @var{vis} is not a valid XVisualInfo
679 pointer (for example, if a particular GLX implementation does not
680 support this visual).
682 @code{BadPixmap} is generated if @var{pixmap} is not a valid pixmap.
684 @code{BadAlloc} is generated if the server cannot allocate the GLX
689 @deftypefun GLXContext glXCreateNewContext dpy config render_type share_list direct
690 Create a new GLX rendering context.
694 Specifies the connection to the X server.
697 Specifies the GLXFBConfig structure with the desired attributes for the
700 @item @var{render_type}
701 Specifies the type of the context to be created. Must be one of
702 @code{GLX_RGBA_TYPE} or @code{GLX_COLOR_INDEX_TYPE}.
704 @item @var{share_list}
705 Specifies the context with which to share display lists. @code{NULL}
706 indicates that no sharing is to take place.
708 @item @var{share_list}
709 Specifies whether rendering is to be done with a direct connection to
710 the graphics system if possible (@code{True}) or through the X server
715 @code{glXCreateNewContext} creates a GLX rendering context and returns
716 its handle. This context can be used to render into GLX windows,
717 pixmaps, or pixel buffers. If @code{glXCreateNewContext} fails to
718 create a rendering context, @code{NULL} is returned.
720 If @var{render_type} is @code{GLX_RGBA_TYPE}, then a context that
721 supports RGBA rendering is created. If @var{config} is
722 @code{GLX_COLOR_INDEX_TYPE}, then context supporting color-index
723 rendering is created.
725 If @var{render_type} is not @code{NULL}, then all display-list indexes
726 and definitions are shared by context @var{render_type} and by the newly
727 created context. An arbitrary number of contexts can share a single
728 display-list space. However, all rendering contexts that share a single
729 display-list space must themselves exist in the same address space. Two
730 rendering contexts share an address space if both are nondirect using
731 the same server, or if both are direct and owned by a single process.
732 Note that in the nondirect case, it is not necessary for the calling
733 threads to share an address space, only for their related rendering
734 contexts to share an address space.
736 If @var{share_list} is @code{True}, then a direct-rendering context is
737 created if the implementation supports direct rendering, if the
738 connection is to an X server that is local, and if a direct-rendering
739 context is available. (An implementation may return an indirect context
740 when @var{share_list} is @code{True}.) If @var{share_list} is
741 @code{False}, then a rendering context that renders through the X server
742 is always created. Direct rendering provides a performance advantage in
743 some implementations. However, direct-rendering contexts cannot be
744 shared outside a single process, and they may be unable to render to GLX
747 @code{NULL} is returned if execution fails on the client side.
749 @code{GLXBadContext} is generated if @var{render_type} is not a GLX
750 context and is not @code{NULL}.
752 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
755 @code{BadMatch} is generated if the context to be created would not
756 share the address space or the screen of the context specified by
759 @code{BadAlloc} is generated if the server does not have enough
760 resources to allocate the new context.
762 @code{BadValue} is generated if @var{config} is not a valid visual (for
763 example, if a particular GLX implementation does not support it).
767 @deftypefun GLXPbuffer glXCreatePbuffer dpy config attrib_list
768 Create an off-screen rendering area.
772 Specifies the connection to the X server.
775 Specifies a GLXFBConfig structure with the desired attributes for the
778 @item @var{attrib_list}
779 Specifies a list of attribute value pairs, which must be terminated with
780 @code{None} or @code{NULL}. Accepted attributes are
781 @code{GLX_PBUFFER_WIDTH}, @code{GLX_PBUFFER_HEIGHT},
782 @code{GLX_PRESERVED_CONTENTS}, and @code{GLX_LARGEST_PBUFFER}.
786 @code{glXCreatePbuffer} creates an off-screen rendering area and returns
787 its XID. Any GLX rendering context that was created with respect to
788 @var{config} can be used to render into this window. Use
789 @code{glXMakeContextCurrent} to associate the rendering area with a GLX
792 The accepted attributes for a GLXPbuffer are:
795 @item @code{GLX_PBUFFER_WIDTH}
796 Specify the pixel width of the requested GLXPbuffer. The default value
799 @item @code{GLX_PBUFFER_HEIGHT}
800 Specify the pixel height of the requested GLXPbuffer. The default value
803 @item @code{GLX_LARGEST_PBUFFER}
804 Specify to obtain the largest available pixel buffer, if the requested
805 allocation would have failed. The width and height of the allocated
806 pixel buffer will never exceed the specified @code{GLX_PBUFFER_WIDTH} or
807 @code{GLX_PBUFFER_HEIGHT}, respectively. Use @code{glXQueryDrawable} to
808 retrieve the dimensions of the allocated pixel buffer. The default
809 value is @code{False}.
811 @item @code{GLX_PRESERVED_CONTENTS}
812 Specify if the contents of the pixel buffer should be preserved when a
813 resource conflict occurs. If set to @code{False}, the contents of the
814 pixel buffer may be lost at any time. If set to @code{True}, or not
815 specified in @var{attrib_list}, then the contents of the pixel buffer
816 will be preserved (most likely by copying the contents into main system
817 memory from the frame buffer). In either case, the client can register
818 (using @code{glXSelectEvent}, to receive pixel buffer clobber events
819 that are generated when the pbuffer contents have been preserved or
824 GLXPbuffers contain the color and ancillary buffers specified by
825 @var{config}. It is possible to create a pixel buffer with back buffers
826 and to swap those buffers using @code{glXSwapBuffers}.
828 @code{BadAlloc} is generated if there are insufficient resources to
829 allocate the requested GLXPbuffer.
831 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
834 @code{BadMatch} is generated if @var{config} does not support rendering
835 to pixel buffers (e.g., @code{GLX_DRAWABLE_TYPE} does not contain
836 @code{GLX_PBUFFER_BIT}).
840 @deftypefun GLXPixmap glXCreatePixmap dpy config pixmap attrib_list
841 Create an off-screen rendering area.
845 Specifies the connection to the X server.
848 Specifies a GLXFBConfig structure with the desired attributes for the
852 Specifies the X pixmap to be used as the rendering area.
854 @item @var{attrib_list}
855 Currently unused. This must be set to @code{NULL} or be an empty list
856 (i.e., one in which the first element is @code{None}).
860 @code{glXCreatePixmap} creates an off-screen rendering area and returns
861 its XID. Any GLX rendering context that was created with respect to
862 @var{config} can be used to render into this window. Use
863 @code{glXMakeCurrent} to associate the rendering area with a GLX
866 @code{BadMatch} is generated if @var{pixmap} was not created with a
867 visual that corresponds to @var{config}.
869 @code{BadMatch} is generated if @var{config} does not support rendering
870 to windows (e.g., @code{GLX_DRAWABLE_TYPE} does not contain
871 @code{GLX_WINDOW_BIT}).
873 @code{BadWindow} is generated if @var{pixmap} is not a valid window XID.
874 @code{BadAlloc} is generated if there is already a GLXFBConfig
875 associated with @var{pixmap}.
877 @code{BadAlloc} is generated if the X server cannot allocate a new GLX
880 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
887 @deftypefun GLXWindow glXCreateWindow dpy config win attrib_list
888 Create an on-screen rendering area.
892 Specifies the connection to the X server.
895 Specifies a GLXFBConfig structure with the desired attributes for the
899 Specifies the X window to be used as the rendering area.
901 @item @var{attrib_list}
902 Currently unused. This must be set to @code{NULL} or be an empty list
903 (i.e., one in which the first element is @code{None}).
907 @code{glXCreateWindow} creates an on-screen rendering area from an
908 existing X window that was created with a visual matching @var{config}.
909 The XID of the GLXWindow is returned. Any GLX rendering context that
910 was created with respect to @var{config} can be used to render into this
911 window. Use @code{glXMakeContextCurrent} to associate the rendering
912 area with a GLX rendering context.
914 @code{BadMatch} is generated if @var{win} was not created with a visual
915 that corresponds to @var{config}.
917 @code{BadMatch} is generated if @var{config} does not support rendering
918 to windows (i.e., @code{GLX_DRAWABLE_TYPE} does not contain
919 @code{GLX_WINDOW_BIT}).
921 @code{BadWindow} is generated if @var{win} is not a valid pixmap XID.
923 @code{BadAlloc} is generated if there is already a GLXFBConfig
924 associated with @var{win}.
926 @code{BadAlloc} is generated if the X server cannot allocate a new GLX
929 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
936 @deftypefun void glXDestroyContext dpy ctx
937 Destroy a GLX context.
941 Specifies the connection to the X server.
944 Specifies the GLX context to be destroyed.
948 If the GLX rendering context @var{ctx} is not current to any thread,
949 @code{glXDestroyContext} destroys it immediately. Otherwise, @var{ctx}
950 is destroyed when it becomes not current to any thread. In either case,
951 the resource ID referenced by @var{ctx} is freed immediately.
953 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
958 @deftypefun void glXDestroyGLXPixmap dpy pix
959 Destroy a GLX pixmap.
963 Specifies the connection to the X server.
966 Specifies the GLX pixmap to be destroyed.
970 If the GLX pixmap @var{pix} is not current to any client,
971 @code{glXDestroyGLXPixmap} destroys it immediately. Otherwise,
972 @var{pix} is destroyed when it becomes not current to any client. In
973 either case, the resource ID is freed immediately.
975 @code{GLXBadPixmap} is generated if @var{pix} is not a valid GLX pixmap.
979 @deftypefun void glXDestroyPbuffer dpy pbuf
980 Destroy an off-screen rendering area.
984 Specifies the connection to the X server.
987 Specifies the GLXPbuffer to be destroyed.
991 @code{glXDestroyPbuffer} destroys a GLXPbuffer created by
992 @code{glXCreatePbuffer}.
994 @code{GLXBadPbuffer} is generated if @var{pbuf} is not a valid
999 @deftypefun void glXDestroyPixmap dpy pixmap
1000 Destroy an off-screen rendering area.
1004 Specifies the connection to the X server.
1007 Specifies the GLXPixmap to be destroyed.
1011 @code{glXDestroyPixmap} destroys a GLXPixmap created by
1012 @code{glXCreatePixmap}.
1014 @code{GLXBadPixmap} is generated if @var{pixmap} is not a valid
1019 @deftypefun void glXDestroyWindow dpy win
1020 Destroy an on-screen rendering area.
1024 Specifies the connection to the X server.
1027 Specifies the GLXWindow to be destroyed.
1031 @code{glXDestroyWindow} destroys a GLXWindow created by
1032 @code{glXCreateWindow}.
1034 @code{GLXBadWindow} is generated if @var{win} is not a valid GLXPixmap.
1038 @deftypefun void glXFreeContextEXT dpy ctx
1039 Free client-side memory for imported context.
1043 Specifies the connection to the X server.
1046 Specifies a GLX rendering context.
1050 @code{glXFreeContextEXT} frees the client-side part of a GLXContext that
1051 was created with @code{glXImportContextEXT}. @code{glXFreeContextEXT}
1052 does not free the server-side context information or the XID associated
1053 with the server-side context.
1055 @code{glXFreeContextEXT} is part of the @code{EXT_import_context}
1056 extension, not part of the core GLX command set. If
1057 _glxextstring(EXT_import_context) is included in the string returned by
1058 @code{glXQueryExtensionsString}, when called with argument
1059 @code{GLX_EXTENSIONS}, extension @code{EXT_vertex_array} is supported.
1061 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1066 @deftypefun const-char-* glXGetClientString dpy name
1067 Return a string describing the client.
1071 Specifies the connection to the X server.
1074 Specifies which string is returned. The symbolic constants
1075 @code{GLX_VENDOR}, @code{GLX_VERSION}, and @code{GLX_EXTENSIONS} are
1080 @code{glXGetClientString} returns a string describing some aspect of the
1081 client library. The possible values for @var{name} are
1082 @code{GLX_VENDOR}, @code{GLX_VERSION}, and @code{GLX_EXTENSIONS}. If
1083 @var{name} is not set to one of these values, @code{glXGetClientString}
1084 returns @code{NULL}. The format and contents of the vendor string is
1085 implementation dependent.
1087 The extensions string is null-terminated and contains a space-separated
1088 list of extension names. (The extension names never contain spaces.) If
1089 there are no extensions to GLX, then the empty string is returned.
1091 The version string is laid out as follows:
1093 <major_version.minor_version><space><vendor-specific info>
1095 Both the major and minor portions of the version number are of arbitrary
1096 length. The vendor-specific information is optional. However, if it is
1097 present, the format and contents are implementation specific.
1101 @deftypefun int glXGetConfig dpy vis attrib value
1102 Return information about GLX visuals.
1106 Specifies the connection to the X server.
1109 Specifies the visual to be queried. It is a pointer to an
1110 @code{XVisualInfo} structure, not a visual ID or a pointer to a
1114 Specifies the visual attribute to be returned.
1117 Returns the requested value.
1121 @code{glXGetConfig} sets @var{value} to the @var{attrib} value of
1122 windows or GLX pixmaps created with respect to @var{vis}.
1123 @code{glXGetConfig} returns an error code if it fails for any reason.
1124 Otherwise, zero is returned.
1126 @var{attrib} is one of the following:
1131 @item @code{GLX_USE_GL}
1132 @code{True} if OpenGL rendering is supported by this visual,
1133 @code{False} otherwise.
1135 @item @code{GLX_BUFFER_SIZE}
1136 Number of bits per color buffer. For RGBA visuals,
1137 @code{GLX_BUFFER_SIZE} is the sum of @code{GLX_RED_SIZE},
1138 @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, and @code{GLX_ALPHA_SIZE}.
1139 For color index visuals, @code{GLX_BUFFER_SIZE} is the size of the color
1142 @item @code{GLX_LEVEL}
1143 Frame buffer level of the visual. Level zero is the default frame
1144 buffer. Positive levels correspond to frame buffers that overlay the
1145 default buffer, and negative levels correspond to frame buffers that
1146 underlay the default buffer.
1148 @item @code{GLX_RGBA}
1149 @code{True} if color buffers store red, green, blue, and alpha values.
1150 @code{False} if they store color indexes.
1152 @item @code{GLX_DOUBLEBUFFER}
1153 @code{True} if color buffers exist in front/back pairs that can be
1154 swapped, @code{False} otherwise.
1156 @item @code{GLX_STEREO}
1157 @code{True} if color buffers exist in left/right pairs, @code{False}
1160 @item @code{GLX_AUX_BUFFERS}
1161 Number of auxiliary color buffers that are available. Zero indicates
1162 that no auxiliary color buffers exist.
1164 @item @code{GLX_RED_SIZE}
1165 Number of bits of red stored in each color buffer. Undefined if
1166 @code{GLX_RGBA} is @code{False}.
1168 @item @code{GLX_GREEN_SIZE}
1169 Number of bits of green stored in each color buffer. Undefined if
1170 @code{GLX_RGBA} is @code{False}.
1172 @item @code{GLX_BLUE_SIZE}
1173 Number of bits of blue stored in each color buffer. Undefined if
1174 @code{GLX_RGBA} is @code{False}.
1176 @item @code{GLX_ALPHA_SIZE}
1177 Number of bits of alpha stored in each color buffer. Undefined if
1178 @code{GLX_RGBA} is @code{False}.
1180 @item @code{GLX_DEPTH_SIZE}
1181 Number of bits in the depth buffer.
1183 @item @code{GLX_STENCIL_SIZE}
1184 Number of bits in the stencil buffer.
1186 @item @code{GLX_ACCUM_RED_SIZE}
1187 Number of bits of red stored in the accumulation buffer.
1189 @item @code{GLX_ACCUM_GREEN_SIZE}
1190 Number of bits of green stored in the accumulation buffer.
1192 @item @code{GLX_ACCUM_BLUE_SIZE}
1193 Number of bits of blue stored in the accumulation buffer.
1195 @item @code{GLX_ACCUM_ALPHA_SIZE}
1196 Number of bits of alpha stored in the accumulation buffer.
1200 The X protocol allows a single visual ID to be instantiated with
1201 different numbers of bits per pixel. Windows or GLX pixmaps that will
1202 be rendered with OpenGL, however, must be instantiated with a color
1203 buffer depth of @code{GLX_BUFFER_SIZE}.
1205 Although a GLX implementation can export many visuals that support GL
1206 rendering, it must support at least one RGBA visual. This visual must
1207 have at least one color buffer, a stencil buffer of at least 1 bit, a
1208 depth buffer of at least 12 bits, and an accumulation buffer. Alpha
1209 bitplanes are optional in this visual. However, its color buffer size
1210 must be as great as that of the deepest @code{TrueColor},
1211 @code{DirectColor}, @code{PseudoColor}, or @code{StaticColor} visual
1212 supported on level zero, and it must itself be made available on level
1215 In addition, if the X server exports a @code{PseudoColor} or
1216 @code{StaticColor} visual on framebuffer level 0, a color index visual
1217 is also required on that level. It must have at least one color buffer,
1218 a stencil buffer of at least 1 bit, and a depth buffer of at least 12
1219 bits. This visual must have as many color bitplanes as the deepest
1220 @code{PseudoColor} or @code{StaticColor} visual supported on level 0.
1222 Applications are best written to select the visual that most closely
1223 meets their requirements. Creating windows or GLX pixmaps with
1224 unnecessary buffers can result in reduced rendering performance as well
1225 as poor resource allocation.
1227 @code{GLX_NO_EXTENSION} is returned if @var{dpy} does not support the
1230 @code{GLX_BAD_SCREEN} is returned if the screen of @var{vis} does not
1231 correspond to a screen.
1233 @code{GLX_BAD_ATTRIBUTE} is returned if @var{attrib} is not a valid GLX
1236 @code{GLX_BAD_VISUAL} is returned if @var{vis} doesn't support GLX and
1237 an attribute other than @code{GLX_USE_GL} is requested.
1241 @deftypefun GLXContextID glXGetContextIDEXT ctx
1242 Get the XID for a context..
1246 Specifies a GLX rendering context.
1250 @code{glXGetContextIDEXT} returns the XID associated with a GLXContext.
1252 No round trip is forced to the server; unlike most X calls that return a
1253 value, @code{glXGetContextIDEXT} does not flush any pending events.
1255 @code{glXGetContextIDEXT} is part of the @code{EXT_import_context}
1256 extension, not part of the core GLX command set. If
1257 _glxextstring(EXT_import_context) is included in the string returned by
1258 @code{glXQueryExtensionsString}, when called with argument
1259 @code{GLX_EXTENSIONS}, extension @code{EXT_import_context} is supported.
1261 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1266 @deftypefun GLXContext glXGetCurrentContext
1267 Return the current context.
1269 @code{glXGetCurrentContext} returns the current context, as specified by
1270 @code{glXMakeCurrent}. If there is no current context, @code{NULL} is
1273 @code{glXGetCurrentContext} returns client-side information. It does
1274 not make a round trip to the server.
1280 @deftypefun Display-* glXGetCurrentDisplay
1281 Get display for current context.
1283 @code{glXGetCurrentDisplay} returns the display for the current context.
1284 If no context is current, @code{NULL} is returned.
1286 @code{glXGetCurrentDisplay} returns client-side information. It does
1287 not make a round-trip to the server, and therefore does not flush any
1292 @deftypefun GLXDrawable glXGetCurrentDrawable
1293 Return the current drawable.
1295 @code{glXGetCurrentDrawable} returns the current drawable, as specified
1296 by @code{glXMakeCurrent}. If there is no current drawable, @code{None}
1299 @code{glXGetCurrentDrawable} returns client-side information. It does
1300 not make a round trip to the server.
1304 @deftypefun GLXDrawable glXGetCurrentReadDrawable
1305 Return the current drawable.
1307 @code{glXGetCurrentReadDrawable} returns the current read drawable, as
1308 specified by @code{read} parameter of @code{glXMakeContextCurrent}. If
1309 there is no current drawable, @code{None} is returned.
1311 @code{glXGetCurrentReadDrawable} returns client-side information. It
1312 does not make a round-trip to the server.
1316 @deftypefun int glXGetFBConfigAttrib dpy config attribute value
1317 Return information about a GLX frame buffer configuration.
1321 Specifies the connection to the X server.
1324 Specifies the GLX frame buffer configuration to be queried.
1326 @item @var{attribute}
1327 Specifies the attribute to be returned.
1330 Returns the requested value.
1334 @code{glXGetFBConfigAttrib} sets @var{value} to the @var{attribute}
1335 value of GLX drawables created with respect to @var{config}.
1336 @code{glXGetFBConfigAttrib} returns an error code if it fails for any
1337 reason. Otherwise, @code{Success} is returned.
1339 @var{attribute} is one of the following:
1344 @item @code{GLX_FBCONFIG_ID}
1345 XID of the given GLXFBConfig.
1347 @item @code{GLX_BUFFER_SIZE}
1350 Number of bits per color buffer. If the frame buffer configuration
1351 supports RGBA contexts, then @code{GLX_BUFFER_SIZE} is the sum of
1352 @code{GLX_RED_SIZE}, @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, and
1353 @code{GLX_ALPHA_SIZE}. If the frame buffer configuration supports only
1354 color index contexts, @code{GLX_BUFFER_SIZE} is the size of the color
1357 @item @code{GLX_LEVEL}
1360 Frame buffer level of the configuration. Level zero is the default
1361 frame buffer. Positive levels correspond to frame buffers that overlay
1362 the default buffer, and negative levels correspond to frame buffers that
1363 underlie the default buffer.
1365 @item @code{GLX_DOUBLEBUFFER}
1368 @code{True} if color buffers exist in front/back pairs that can be
1369 swapped, @code{False} otherwise.
1371 @item @code{GLX_STEREO}
1374 @code{True} if color buffers exist in left/right pairs, @code{False}
1377 @item @code{GLX_AUX_BUFFERS}
1380 Number of auxiliary color buffers that are available. Zero indicates
1381 that no auxiliary color buffers exist.
1383 @item @code{GLX_RED_SIZE}
1386 Number of bits of red stored in each color buffer. Undefined if RGBA
1387 contexts are not supported by the frame buffer configuration.
1389 @item @code{GLX_GREEN_SIZE}
1392 Number of bits of green stored in each color buffer. Undefined if RGBA
1393 contexts are not supported by the frame buffer configuration.
1395 @item @code{GLX_BLUE_SIZE}
1398 Number of bits of blue stored in each color buffer. Undefined if RGBA
1399 contexts are not supported by the frame buffer configuration.
1401 @item @code{GLX_ALPHA_SIZE}
1404 Number of bits of alpha stored in each color buffer. Undefined if RGBA
1405 contexts are not supported by the frame buffer configuration.
1407 @item @code{GLX_DEPTH_SIZE}
1410 Number of bits in the depth buffer.
1412 @item @code{GLX_STENCIL_SIZE}
1415 Number of bits in the stencil buffer.
1417 @item @code{GLX_ACCUM_RED_SIZE}
1420 Number of bits of red stored in the accumulation buffer.
1422 @item @code{GLX_ACCUM_GREEN_SIZE}
1425 Number of bits of green stored in the accumulation buffer.
1427 @item @code{GLX_ACCUM_BLUE_SIZE}
1430 Number of bits of blue stored in the accumulation buffer.
1432 @item @code{GLX_ACCUM_ALPHA_SIZE}
1435 Number of bits of alpha stored in the accumulation buffer.
1437 @item @code{GLX_RENDER_TYPE}
1440 Mask indicating what type of GLX contexts can be made current to the
1441 frame buffer configuration. Valid bits are @code{GLX_RGBA_BIT} and
1442 @code{GLX_COLOR_INDEX_BIT}.
1444 @item @code{GLX_DRAWABLE_TYPE}
1447 Mask indicating what drawable types the frame buffer configuration
1448 supports. Valid bits are @code{GLX_WINDOW_BIT}, @code{GLX_PIXMAP_BIT},
1449 and @code{GLX_PBUFFER_BIT}.
1451 @item @code{GLX_X_RENDERABLE}
1454 @code{True} if drawables created with the frame buffer configuration can
1455 be rendered to by X.
1457 @item @code{GLX_VISUAL_ID}
1460 XID of the corresponding visual, or zero if there is no associated
1461 visual (i.e., if @code{GLX_X_RENDERABLE} is @code{False} or
1462 @code{GLX_DRAWABLE_TYPE} does not have the @code{GLX_WINDOW_BIT} bit
1465 @item @code{GLX_X_VISUAL_TYPE}
1468 Visual type of associated visual. The returned value will be one of:
1469 @code{GLX_TRUE_COLOR}, @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
1470 @code{GLX_STATIC_COLOR}, @code{GLX_GRAY_SCALE}, @code{GLX_STATIC_GRAY},
1471 or @code{GLX_NONE}, if there is no associated visual (i.e., if
1472 @code{GLX_X_RENDERABLE} is @code{False} or @code{GLX_DRAWABLE_TYPE} does
1473 not have the @code{GLX_WINDOW_BIT} bit set).
1475 @item @code{GLX_CONFIG_CAVEAT}
1478 One of @code{GLX_NONE}, @code{GLX_SLOW_CONFIG}, or
1479 @code{GLX_NON_CONFORMANT_CONFIG}, indicating that the frame buffer
1480 configuration has no caveats, some aspect of the frame buffer
1481 configuration runs slower than other frame buffer configurations, or
1482 some aspect of the frame buffer configuration is nonconformant,
1485 @item @code{GLX_TRANSPARENT_TYPE}
1488 One of @code{GLX_NONE}, @code{GLX_TRANSPARENT_RGB},
1489 @code{GLX_TRANSPARENT_INDEX}, indicating that the frame buffer
1490 configuration is opaque, is transparent for particular values of red,
1491 green, and blue, or is transparent for particular index values,
1494 @item @code{GLX_TRANSPARENT_INDEX_VALUE}
1497 Integer value between 0 and the maximum frame buffer value for indices,
1498 indicating the transparent index value for the frame buffer
1499 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1500 @code{GLX_TRANSPARENT_INDEX}.
1502 @item @code{GLX_TRANSPARENT_RED_VALUE}
1505 Integer value between 0 and the maximum frame buffer value for red,
1506 indicating the transparent red value for the frame buffer configuration.
1507 Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1508 @code{GLX_TRANSPARENT_RGB}.
1510 @item @code{GLX_TRANSPARENT_GREEN_VALUE}
1513 Integer value between 0 and the maximum frame buffer value for green,
1514 indicating the transparent green value for the frame buffer
1515 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1516 @code{GLX_TRANSPARENT_RGB}.
1518 @item @code{GLX_TRANSPARENT_BLUE_VALUE}
1521 Integer value between 0 and the maximum frame buffer value for blue,
1522 indicating the transparent blue value for the frame buffer
1523 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1524 @code{GLX_TRANSPARENT_RGB}.
1526 @item @code{GLX_TRANSPARENT_ALPHA_VALUE}
1529 Integer value between 0 and the maximum frame buffer value for alpha,
1530 indicating the transparent blue value for the frame buffer
1531 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1532 @code{GLX_TRANSPARENT_RGB}.
1534 @item @code{GLX_MAX_PBUFFER_WIDTH}
1537 The maximum width that can be specified to @code{glXCreatePbuffer}.
1539 @item @code{GLX_MAX_PBUFFER_HEIGHT}
1542 The maximum height that can be specified to @code{glXCreatePbuffer}.
1544 @item @code{GLX_MAX_PBUFFER_PIXELS}
1547 The maximum number of pixels (width times height) for a pixel buffer.
1548 Note that this value may be less than @code{GLX_MAX_PBUFFER_WIDTH} times
1549 @code{GLX_MAX_PBUFFER_HEIGHT}. Also, this value is static and assumes
1550 that no other pixel buffers or X resources are contending for the frame
1551 buffer memory. As a result, it may not be possible to allocate a pixel
1552 buffer of the size given by @code{GLX_MAX_PBUFFER_PIXELS}.
1556 Applications should choose the frame buffer configuration that most
1557 closely meets their requirements. Creating windows, GLX pixmaps, or GLX
1558 pixel buffers with unnecessary buffers can result in reduced rendering
1559 performance as well as poor resource allocation.
1561 @code{GLX_NO_EXTENSION} is returned if @var{dpy} does not support the
1562 GLX extension. @code{GLX_BAD_ATTRIBUTE} is returned if @var{attribute}
1563 is not a valid GLX attribute.
1567 @deftypefun GLXFBConfig-* glXGetFBConfigs dpy screen nelements
1568 List all GLX frame buffer configurations for a given screen.
1572 Specifies the connection to the X server.
1575 Specifies the screen number.
1577 @item @var{nelements}
1578 Returns the number of GLXFBConfigs returned.
1582 @code{glXGetFBConfigs} returns a list of all GLXFBConfigs available on
1583 the screen specified by @var{screen}. Use @code{glXGetFBConfigAttrib}
1584 to obtain attribute values from a specific GLXFBConfig.
1588 @deftypefun void(*)() glXGetProcAddress procName
1589 Obtain a pointer to an OpenGL or GLX function.
1592 @item @var{procName}
1593 Specifies the name of the OpenGL or GLX function whose address is to be
1598 @code{glXGetProcAddress} returns the address of the function specified
1599 in @var{procName}. This is necessary in environments where the OpenGL
1600 link library exports a different set of functions than the runtime
1605 @deftypefun void glXGetSelectedEvent dpy draw event_mask
1606 Returns GLX events that are selected for a window or a GLX pixel buffer.
1610 Specifies the connection to the X server.
1613 Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
1615 @item @var{event_mask}
1616 Returns the events that are selected for @var{draw}.
1620 @code{glXGetSelectedEvent} returns in @var{event_mask} the events
1621 selected for @var{draw}.
1623 @code{GLXBadDrawable} is generated if @var{draw} is not a valid window
1624 or a valid GLX pixel buffer.
1628 @deftypefun XVisualInfo-* glXGetVisualFromFBConfig dpy config
1629 Return visual that is associated with the frame buffer configuration.
1633 Specifies the connection to the X server.
1636 Specifies the GLX frame buffer configuration.
1640 If @var{config} is a valid GLX frame buffer configuration and it has an
1641 associated X Visual, then information describing that visual is
1642 returned; otherwise @code{NULL} is returned. Use @code{XFree} to free
1645 Returns @code{NULL} if @var{config} is not a valid GLXFBConfig.
1649 @deftypefun GLXContext glXImportContextEXT dpy contextID
1650 Import another process's indirect rendering context..
1654 Specifies the connection to the X server.
1656 @item @var{contextID}
1657 Specifies a GLX rendering context.
1661 @code{glXImportContextEXT} creates a GLXContext given the XID of an
1662 existing GLXContext. It may be used in place of
1663 @code{glXCreateContext}, to share another process's indirect rendering
1666 Only the server-side context information can be shared between X
1667 clients; client-side state, such as pixel storage modes, cannot be
1668 shared. Thus, @code{glXImportContextEXT} must allocate memory to store
1669 client-side information. This memory is freed by calling
1670 @code{glXFreeContextEXT}.
1672 This call does not create a new XID. It merely makes an existing object
1673 available to the importing client (Display *). Like any XID, it goes
1674 away when the creating client drops its connection or the ID is
1675 explicitly deleted. Note that this is when the XID goes away. The
1676 object goes away when the XID goes away AND the context is not current
1679 If @var{contextID} refers to a direct rendering context then no error is
1680 generated but @code{glXImportContextEXT} returns NULL.
1682 @code{glXImportContextEXT} is part of the @code{EXT_import_context}
1683 extension, not part of the core GLX command set. If
1684 _glxextstring(EXT_import_context) is included in the string returned by
1685 @code{glXQueryExtensionsString}, when called with argument
1686 @code{GLX_EXTENSIONS}, extension @code{EXT_import_context} is supported.
1688 @code{GLXBadContext} is generated if @var{contextID} does not refer to a
1693 @deftypefun Bool glXIsDirect dpy ctx
1694 Indicate whether direct rendering is enabled.
1698 Specifies the connection to the X server.
1701 Specifies the GLX context that is being queried.
1705 @code{glXIsDirect} returns @code{True} if @var{ctx} is a direct
1706 rendering context, @code{False} otherwise. Direct rendering contexts
1707 pass rendering commands directly from the calling process's address
1708 space to the rendering system, bypassing the X server. Nondirect
1709 rendering contexts pass all rendering commands to the X server.
1711 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1716 @deftypefun Bool glXMakeContextCurrent display draw read ctx
1717 Attach a GLX context to a GLX drawable.
1721 Specifies the connection to the X server.
1724 Specifies a GLX drawable to render into. Must be an XID representing a
1725 GLXWindow, GLXPixmap, or GLXPbuffer.
1728 Specifies a GLX drawable to read from. Must be an XID representing a
1729 GLXWindow, GLXPixmap, or GLXPbuffer.
1732 Specifies the GLX context to be bound to @var{read} and @var{ctx}.
1736 @code{glXMakeContextCurrent} binds @var{ctx} to the current rendering
1737 thread and to the @var{draw} and @var{read} GLX drawables. @var{draw}
1738 and @var{read} may be the same.
1740 @var{draw} is used for all OpenGL operations except:
1742 Any pixel data that are read based on the value of
1743 @code{GLX_READ_BUFFER}. Note that accumulation operations use the value
1744 of @code{GLX_READ_BUFFER}, but are not allowed unless @var{draw} is
1745 identical to @var{read}.
1747 Any depth values that are retrieved by @code{glReadPixels} or
1748 @code{glCopyPixels}.
1750 Any stencil values that are retrieved by @code{glReadPixels} or
1751 @code{glCopyPixels}.
1753 Frame buffer values are taken from @var{draw}.
1755 If the current rendering thread has a current rendering context, that
1756 context is flushed and replaced by @var{ctx}.
1758 The first time that @var{ctx} is made current, the viewport and scissor
1759 dimensions are set to the size of the @var{draw} drawable. The viewport
1760 and scissor are not modified when @var{ctx} is subsequently made
1763 To release the current context without assigning a new one, call
1764 @code{glXMakeContextCurrent} with @var{draw} and @var{read} set to
1765 @code{None} and @var{ctx} set to @code{NULL}.
1767 @code{glXMakeContextCurrent} returns @code{True} if it is successful,
1768 @code{False} otherwise. If @code{False} is returned, the previously
1769 current rendering context and drawable (if any) remain unchanged.
1771 @code{BadMatch} is generated if @var{draw} and @var{read} are not
1774 @code{BadAccess} is generated if @var{ctx} is current to some other
1777 @code{GLXContextState} is generated if there is a current rendering
1778 context and its render mode is either @code{GLX_FEEDBACK} or
1781 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1784 @code{GLXBadDrawable} is generated if @var{draw} or @var{read} is not a
1787 @code{GLXBadWindow} is generated if the underlying X window for either
1788 @var{draw} or @var{read} is no longer valid.
1790 @code{GLXBadCurrentDrawable} is generated if the previous context of the
1791 calling thread has unflushed commands and the previous drawable is no
1794 @code{BadAlloc} is generated if the X server does not have enough
1795 resources to allocate the buffers.
1797 @code{BadMatch} is generated if:
1799 @var{draw} and @var{read} cannot fit into frame buffer memory
1802 @var{draw} or @var{read} is a GLXPixmap and @var{ctx} is a
1803 direct-rendering context.
1805 @var{draw} or @var{read} is a GLXPixmap and @var{ctx} was previously
1806 bound to a GLXWindow or GLXPbuffer.
1808 @var{draw} or @var{read} is a GLXWindow or GLXPbuffer and @var{ctx} was
1809 previously bound to a GLXPixmap.
1813 @deftypefun Bool glXMakeCurrent dpy drawable ctx
1814 Attach a GLX context to a window or a GLX pixmap.
1818 Specifies the connection to the X server.
1820 @item @var{drawable}
1821 Specifies a GLX drawable. Must be either an X window ID or a GLX pixmap
1825 Specifies a GLX rendering context that is to be attached to
1830 @code{glXMakeCurrent} does two things: It makes @var{ctx} the current
1831 GLX rendering context of the calling thread, replacing the previously
1832 current context if there was one, and it attaches @var{ctx} to a GLX
1833 drawable, either a window or a GLX pixmap. As a result of these two
1834 actions, subsequent GL rendering calls use rendering context @var{ctx}
1835 to modify GLX drawable @var{drawable} (for reading and writing). Because
1836 @code{glXMakeCurrent} always replaces the current rendering context with
1837 @var{ctx}, there can be only one current context per thread.
1839 Pending commands to the previous context, if any, are flushed before it
1842 The first time @var{ctx} is made current to any thread, its viewport is
1843 set to the full size of @var{drawable}. Subsequent calls by any thread
1844 to @code{glXMakeCurrent} with @var{ctx} have no effect on its viewport.
1846 To release the current context without assigning a new one, call
1847 @code{glXMakeCurrent} with @var{drawable} set to @code{None} and
1848 @var{ctx} set to @code{NULL}.
1850 @code{glXMakeCurrent} returns @code{True} if it is successful,
1851 @code{False} otherwise. If @code{False} is returned, the previously
1852 current rendering context and drawable (if any) remain unchanged.
1854 @code{BadMatch} is generated if @var{drawable} was not created with the
1855 same X screen and visual as @var{ctx}. It is also generated if
1856 @var{drawable} is @code{None} and @var{ctx} is not @code{NULL}.
1858 @code{BadAccess} is generated if @var{ctx} was current to another thread
1859 at the time @code{glXMakeCurrent} was called.
1861 @code{GLXBadDrawable} is generated if @var{drawable} is not a valid GLX
1864 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1867 @code{GLXBadContextState} is generated if @code{glXMakeCurrent} is
1868 executed between the execution of @code{glBegin} and the corresponding
1869 execution of @code{glEnd}.
1871 @code{GLXBadContextState} is also generated if the rendering context
1872 current to the calling thread has GL renderer state @code{GLX_FEEDBACK}
1873 or @code{GLX_SELECT}.
1875 @code{GLXBadCurrentWindow} is generated if there are pending GL commands
1876 for the previous context and the current drawable is a window that is no
1879 @code{BadAlloc} may be generated if the server has delayed allocation of
1880 ancillary buffers until @code{glXMakeCurrent} is called, only to find
1881 that it has insufficient resources to complete the allocation.
1885 @deftypefun int glXQueryContextInfoEXT dpy ctx attribute value
1886 Query context information.
1890 Specifies the connection to the X server.
1893 Specifies a GLX rendering context.
1895 @item @var{attribute}
1896 Specifies that a context parameter should be retrieved. Must be one of
1897 @code{GLX_SHARED_CONTEXT_EXT}, @code{GLX_VISUAL_ID_EXT}, or
1898 @code{GLX_SCREEN_EXT}.
1901 Contains the return value for @var{attribute}.
1905 @code{glXQueryContextInfoEXT} sets @var{value} to the value of
1906 @var{attribute} with respect to @var{ctx}. @code{glXQueryContextInfoEXT}
1907 returns an error code if it fails for any reason. Otherwise,
1908 @code{Success} is returned.
1910 @var{attribute} may be one of the following:
1913 @item @code{GLX_SHARED_CONTEXT_EXT}
1914 Returns the XID of the share list context associated with @var{ctx} at
1917 @item @code{GLX_VISUAL_ID_EXT}
1918 Returns the XID of the GLX Visual associated with @var{ctx}.
1920 @item @code{GLX_SCREEN_EXT}
1921 Returns the screen number associated with @var{ctx}.
1925 This call may cause a round-trip to the server.
1927 @code{glXQueryContextInfoEXT} is part of the @code{EXT_import_context}
1928 extension, not part of the core GLX command set. If
1929 _glxextstring(EXT_import_context) is included in the string returned by
1930 @code{glXQueryExtensionsString}, when called with argument
1931 @code{GLX_EXTENSIONS}, extension @code{EXT_import_context} is supported.
1933 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1936 @code{GLX_BAD_ATTRIBUTE} is returned if @var{attribute} is not a valid
1937 GLX context attribute.
1939 fred @code{GLX_BAD_CONTEXT} is returned if @var{attribute} is not a
1944 @deftypefun int glXQueryContext dpy ctx attribute value
1945 Query context information.
1949 Specifies the connection to the X server.
1952 Specifies a GLX rendering context.
1954 @item @var{attribute}
1955 Specifies that a context parameter should be retrieved. Must be one of
1956 @code{GLX_FBCONFIG_ID}, @code{GLX_RENDER_TYPE}, or @code{GLX_SCREEN}.
1959 Contains the return value for @var{attribute}.
1963 @code{glXQueryContext} sets @var{value} to the value of @var{attribute}
1964 with respect to @var{ctx}. @var{attribute} may be one of the following:
1967 @item @code{GLX_FBCONFIG_ID}
1968 Returns the XID of the GLXFBConfig associated with @var{ctx}.
1970 @item @code{GLX_RENDER_TYPE}
1971 Returns the rendering type supported by @var{ctx}.
1973 @item @code{GLX_SCREEN}
1974 Returns the screen number associated with @var{ctx}.
1978 @code{Success} is returned unless @var{attribute} is not a valid GLX
1979 context attribute, in which case @code{GLX_BAD_ATTRIBUTE} is returned.
1981 This call may cause a round-trip to the server.
1983 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1988 @deftypefun int glXQueryDrawable dpy draw attribute value
1989 Returns an attribute assoicated with a GLX drawable.
1993 Specifies the connection to the X server.
1996 Specifies the GLX drawable to be queried.
1998 @item @var{attribute}
1999 Specifies the attribute to be returned. Must be one of
2000 @code{GLX_WIDTH}, @code{GLX_HEIGHT}, @code{GLX_PRESERVED_CONTENTS},
2001 @code{GLX_LARGEST_PBUFFER}, or @code{GLX_FBCONFIG_ID}.
2004 Contains the return value for @var{attribute}.
2008 @code{glXQueryDrawable} sets @var{value} to the value of @var{attribute}
2009 with respect to the GLXDrawable @var{draw}.
2011 @var{attribute} may be one of the following:
2014 @item @code{GLX_WIDTH}
2015 Returns the width of @var{ctx}.
2017 @item @code{GLX_HEIGHT}
2018 Returns the height of @var{ctx}.
2020 @item @code{GLX_PRESERVED_CONTENTS}
2021 Returns @code{True} if the contents of a GLXPbuffer are preserved when a
2022 resource conflict occurs; @code{False} otherwise.
2024 @item @code{GLX_LARGEST_PBUFFER}
2025 Returns the value set when @code{glXCreatePbuffer} was called to create
2026 the GLXPbuffer. If @code{False} is returned, then the call to
2027 @code{glXCreatePbuffer} will fail to create a GLXPbuffer if the
2028 requested size is larger than the implementation maximum or available
2029 resources. If @code{True} is returned, a GLXPbuffer of the maximum
2030 availble size (if less than the requested width and height) is created.
2032 @item @code{GLX_FBCONFIG_ID}
2033 Returns the XID for @var{draw}.
2037 If @var{draw} is a GLXWindow or GLXPixmap and @var{attribute} is set to
2038 @code{GLX_PRESERVED_CONTENTS} or @code{GLX_LARGETST_PBUFFER}, the
2039 contents of @var{value} are undefined. If @var{attribute} is not one of
2040 the attributes listed above, the contents of @var{value} are unedfined.
2042 A @code{GLXBadDrawable} is generated if @var{draw} is not a valid
2047 @deftypefun const-char-* glXQueryExtensionsString dpy screen
2048 Return list of supported extensions.
2052 Specifies the connection to the X server.
2055 Specifies the screen number.
2059 @code{glXQueryExtensionsString} returns a pointer to a string describing
2060 which GLX extensions are supported on the connection. The string is
2061 null-terminated and contains a space-separated list of extension names.
2062 (The extension names themselves never contain spaces.) If there are no
2063 extensions to GLX, then the empty string is returned.
2067 @deftypefun Bool glXQueryExtension dpy errorBase eventBase
2068 Indicate whether the GLX extension is supported.
2072 Specifies the connection to the X server.
2074 @item @var{errorBase}
2075 Returns the base error code of the GLX server extension.
2077 @item @var{eventBase}
2078 Returns the base event code of the GLX server extension.
2082 @code{glXQueryExtension} returns @code{True} if the X server of
2083 connection @var{dpy} supports the GLX extension, @code{False} otherwise.
2084 If @code{True} is returned, then @var{errorBase} and @var{eventBase}
2085 return the error base and event base of the GLX extension. These values
2086 should be added to the constant error and event values to determine the
2087 actual event or error values. Otherwise, @var{errorBase} and
2088 @var{eventBase} are unchanged.
2090 @var{errorBase} and @var{eventBase} do not return values if they are
2091 specified as @code{NULL}.
2095 @deftypefun const-char-* glXQueryServerString dpy screen name
2096 Return string describing the server.
2100 Specifies the connection to the X server.
2103 Specifies the screen number.
2106 Specifies which string is returned: one of @code{GLX_VENDOR},
2107 @code{GLX_VERSION}, or @code{GLX_EXTENSIONS}.
2111 @code{glXQueryServerString} returns a pointer to a static,
2112 null-terminated string describing some aspect of the server's GLX
2113 extension. The possible values for @var{name} and the format of the
2114 strings is the same as for @code{glXGetClientString}. If @var{name} is
2115 not set to a recognized value, @code{NULL} is returned.
2119 @deftypefun Bool glXQueryVersion dpy major minor
2120 Return the version numbers of the GLX extension.
2124 Specifies the connection to the X server.
2127 Returns the major version number of the GLX server extension.
2130 Returns the minor version number of the GLX server extension.
2134 @code{glXQueryVersion} returns the major and minor version numbers of
2135 the GLX extension implemented by the server associated with connection
2136 @var{dpy}. Implementations with the same major version number are
2137 upward compatible, meaning that the implementation with the higher minor
2138 number is a superset of the version with the lower minor number.
2140 @var{major} and @var{minor} do not return values if they are specified
2143 @code{glXQueryVersion} returns @code{False} if it fails, @code{True}
2146 @var{major} and @var{minor} are not updated when @code{False} is
2151 @deftypefun void glXSelectEvent dpy draw event_mask
2152 Select GLX events for a window or a GLX pixel buffer.
2156 Specifies the connection to the X server.
2159 Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
2161 @item @var{event_mask}
2162 Specifies the events to be returned for @var{draw}.
2166 @code{glXSelectEvent} sets the GLX event mask for a GLX pixel buffer or
2167 a window. Calling @code{glXSelectEvent} overrides any previous event
2168 mask that was set by the client for @var{draw}. Note that it does not
2169 affect the event masks that other clients may have specified for
2170 @var{draw} since each client rendering to @var{draw} has a separate
2173 Currently, only one GLX event, @code{GLX_PBUFFER_CLOBBER_MASK}, can be
2174 selected. The following data is returned to the client when a
2175 @code{GLX_PBUFFER_CLOBBER_MASK} event occurs:
2181 int @var{event_type};
2182 /* GLX_DAMAGED or GLX_SAVED */
2185 int @var{draw_type};
2186 /* GLX_WINDOW or GLX_PBUFFER */
2189 unsigned long @var{serial};
2190 /* # of last request processed by server */
2193 Bool @var{send_event};
2194 /* true if this came for SendEvent request */
2197 Display @var{*display};
2198 /* display the event was read from */
2201 GLXDrawable @var{drawable};
2202 /* i.d. of Drawable */
2205 unsigned int @var{buffer_mask};
2206 /* mask indicating affected buffers */
2213 int @var{width, height};
2218 /* if nonzero, at least this many more */
2222 @} GLXPbufferClobberEvent; The valid bit masks used in @var{buffer_mask}
2228 @item @strong{Bitmask}
2229 @strong{Corresponding Buffer}
2231 @item @code{GLX_FRONT_LEFT_BUFFER_BIT}
2232 Front left color buffer
2234 @item @code{GLX_FRONT_RIGHT_BUFFER_BIT}
2235 Front right color buffer
2237 @item @code{GLX_BACK_LEFT_BUFFER_BIT}
2238 Back left color buffer
2240 @item @code{GLX_BACK_RIGHT_BUFFER_BIT}
2241 Back right color buffer
2243 @item @code{GLX_AUX_BUFFERS_BIT}
2246 @item @code{GLX_DEPTH_BUFFER_BIT}
2249 @item @code{GLX_STENCIL_BUFFER_BIT}
2252 @item @code{GLX_ACCUM_BUFFER_BIT}
2257 A single X server operation can cause several buffer clobber events to
2258 be sent. (e.g., a single GLX pixel buffer may be damaged and cause
2259 multiple buffer clobber events to be generated). Each event specifies
2260 one region of the GLX drawable that was affected by the X Server
2261 operation. The @var{buffer_mask} field indicates which color buffers
2262 and ancillary buffers were affected. All the buffer clobber events
2263 generated by a single X server action are guaranteed to be contiguous in
2264 the event queue. The conditions under which this event is generated and
2265 the @var{event_type} varies, depending on the type of the GLX drawable.
2267 When the @code{GLX_AUX_BUFFERS_BIT} is set in @var{buffer_mask}, then
2268 @var{aux_buffer} is set to indicate which buffer was affected. If more
2269 than one aux buffer was affected, then additional events are generated
2270 as part of the same contiguous event group. Each additional event will
2271 have only the @code{GLX_AUX_BUFFERS_BIT} set in @var{buffer_mask}, and
2272 the @var{aux_buffer} field will be set appropriately. For nonstereo
2273 drawables, @code{GLX_FRONT_LEFT_BUFFER_BIT} and
2274 @code{GLX_BACK_LEFT_BUFFER_BIT} are used to specify the front and back
2277 For preserved GLX pixel buffers, a buffer clobber event with type
2278 @code{GLX_SAVED} is generated whenever the contents of the GLX pixel
2279 buffer is moved out of offscreen memory. The event(s) describes which
2280 portions of the GLX pixel buffer were affected. Clients who receive
2281 many buffer clobber events, referring to different save actions, should
2282 consider freeing the GLX pixel buffer resource in order to prevent the
2283 system from thrashing due to insufficient resources.
2285 For an unpreserved GLXPbuffer, a buffer clobber event, with type
2286 @code{GLX_DAMAGED}, is generated whenever a portion of the GLX pixel
2287 buffer becomes invalid. The client may wish to regenerate the invalid
2288 portions of the GLX pixel buffer.
2290 For Windows, buffer clobber events, with type @code{GLX_SAVED}, occur
2291 whenever an ancillary buffer, associated with the window, gets clobbered
2292 or moved out of off-screen memory. The event contains information
2293 indicating which color buffers and ancillary buffers\(emand which
2294 portions of those buffers\(emwere affected.
2296 @code{GLXBadDrawable} is generated if @var{draw} is not a valid window
2297 or a valid GLX pixel buffer.
2301 @deftypefun void glXSwapBuffers dpy drawable
2302 Exchange front and back buffers.
2306 Specifies the connection to the X server.
2308 @item @var{drawable}
2309 Specifies the drawable whose buffers are to be swapped.
2313 @code{glXSwapBuffers} promotes the contents of the back buffer of
2314 @var{drawable} to become the contents of the front buffer of
2315 @var{drawable}. The contents of the back buffer then become undefined.
2316 The update typically takes place during the vertical retrace of the
2317 monitor, rather than immediately after @code{glXSwapBuffers} is called.
2319 @code{glXSwapBuffers} performs an implicit @code{glFlush} before it
2320 returns. Subsequent OpenGL commands may be issued immediately after
2321 calling @code{glXSwapBuffers}, but are not executed until the buffer
2322 exchange is completed.
2324 If @var{drawable} was not created with respect to a double-buffered
2325 visual, @code{glXSwapBuffers} has no effect, and no error is generated.
2327 @code{GLXBadDrawable} is generated if @var{drawable} is not a valid GLX
2330 @code{GLXBadCurrentWindow} is generated if @var{dpy} and @var{drawable}
2331 are respectively the display and drawable associated with the current
2332 context of the calling thread, and @var{drawable} identifies a window
2333 that is no longer valid.
2337 @deftypefun void glXUseXFont font first count listBase
2338 Create bitmap display lists from an X font.
2342 Specifies the font from which character glyphs are to be taken.
2345 Specifies the index of the first glyph to be taken.
2348 Specifies the number of glyphs to be taken.
2350 @item @var{listBase}
2351 Specifies the index of the first display list to be generated.
2355 @code{glXUseXFont} generates @var{count} display lists, named
2356 @var{listBase} through @r{@var{listBase}+@var{count}-1}, each containing
2357 a single @code{glBitmap} command. The parameters of the @code{glBitmap}
2358 command of display list @r{@var{listBase}+@var{i}} are derived from
2359 glyph @r{@var{first}+@var{i}}. Bitmap parameters @r{@var{xorig}},
2360 @r{@var{yorig}}, @r{@var{width}}, and @r{@var{height}} are computed from
2361 font metrics as @r{@var{descent}-1}, @r{-@var{lbearing}},
2362 @r{@var{rbearing}-@var{lbearing}}, and @r{@var{ascent}+@var{descent}},
2363 respectively. @r{@var{xmove}} is taken from the glyph's @r{@var{width}}
2364 metric, and @r{@var{ymove}} is set to zero. Finally, the glyph's image
2365 is converted to the appropriate format for @code{glBitmap}.
2367 Using @code{glXUseXFont} may be more efficient than accessing the X font
2368 and generating the display lists explicitly, both because the display
2369 lists are created on the server without requiring a round trip of the
2370 glyph data, and because the server may choose to delay the creation of
2371 each bitmap until it is accessed.
2373 Empty display lists are created for all glyphs that are requested and
2374 are not defined in @var{font}. @code{glXUseXFont} is ignored if there
2375 is no current GLX context.
2377 @code{BadFont} is generated if @var{font} is not a valid font.
2379 @code{GLXBadContextState} is generated if the current GLX context is in
2380 display-list construction mode.
2382 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2383 the current context of the calling thread is a window, and that window
2388 @deftypefun void glXWaitGL
2389 Complete GL execution prior to subsequent X calls.
2391 GL rendering calls made prior to @code{glXWaitGL} are guaranteed to be
2392 executed before X rendering calls made after @code{glXWaitGL}. Although
2393 this same result can be achieved using @code{glFinish}, @code{glXWaitGL}
2394 does not require a round trip to the server, and it is therefore more
2395 efficient in cases where client and server are on separate machines.
2397 @code{glXWaitGL} is ignored if there is no current GLX context.
2399 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2400 the current context of the calling thread is a window, and that window
2405 @deftypefun void glXWaitX
2406 Complete X execution prior to subsequent GL calls.
2408 X rendering calls made prior to @code{glXWaitX} are guaranteed to be
2409 executed before GL rendering calls made after @code{glXWaitX}. Although
2410 the same result can be achieved using @code{XSync}, @code{glXWaitX} does
2411 not require a round trip to the server, and it is therefore more
2412 efficient in cases where client and server are on separate machines.
2414 @code{glXWaitX} is ignored if there is no current GLX context.
2416 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2417 the current context of the calling thread is a window, and that window