update upstream sources
[clinton/guile-figl.git] / doc / low-level-glx.texi
1
2 @c %start of fragment
3
4 The functions from this section may be had by loading the module:
5
6 @example
7 (use-modules (figl glx low-level)
8 @end example
9
10 @copying
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.
15
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/}.
19
20 @end copying
21
22 @deftypefun GLXFBConfig-* glXChooseFBConfig dpy screen attrib_list nelements
23 Return a list of GLX frame buffer configurations that match the
24 specified attributes.
25
26 @table @asis
27 @item @var{dpy}
28 Specifies the connection to the X server.
29
30 @item @var{screen}
31 Specifies the screen number.
32
33 @item @var{attrib_list}
34 Specifies a list of attribute/value pairs. The last attribute must be
35 @code{None}.
36
37 @item @var{nelements}
38 Returns the number of elements in the list returned by
39 @code{glXChooseFBConfig}.
40
41 @end table
42
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}.
52
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
61 not be checked.
62
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.
70
71 The interpretations of the various GLX visual attributes are as follows:
72
73 @table @asis
74 @item @code{GLX_FBCONFIG_ID}
75
76
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}.
80
81 @item @code{GLX_BUFFER_SIZE}
82
83
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
88 default value is 0.
89
90 @item @code{GLX_LEVEL}
91
92
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
98 default value is 0.
99
100 @item @code{GLX_DOUBLEBUFFER}
101
102
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}.
108
109 @item @code{GLX_STEREO}
110
111
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}.
116
117 @item @code{GLX_AUX_BUFFERS}
118
119
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.
124
125 @item @code{GLX_RED_SIZE}, @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, @code{GLX_ALPHA_SIZE}
126
127
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.
136
137 @item @code{GLX_DEPTH_SIZE}
138
139
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.
144
145 @item @code{GLX_STENCIL_SIZE}
146
147
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
152 value is 0.
153
154 @item @code{GLX_ACCUM_RED_SIZE}
155
156
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
161 0.
162
163 @item @code{GLX_ACCUM_GREEN_SIZE}
164
165
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
170 default value is 0.
171
172 @item @code{GLX_ACCUM_BLUE_SIZE}
173
174
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
179 0.
180
181 @item @code{GLX_ACCUM_ALPHA_SIZE}
182
183
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
188 default value is 0.
189
190 @item @code{GLX_RENDER_TYPE}
191
192
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
199 @code{GLX_RGBA_BIT}.
200
201 @item @code{GLX_DRAWABLE_TYPE}
202
203
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}.
211
212 @item @code{GLX_X_RENDERABLE}
213
214
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}.
219
220 @item @code{GLX_X_VISUAL_TYPE}
221
222
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}.
239
240 @item @code{GLX_CONFIG_CAVEAT}
241
242
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}.
250
251 @item @code{GLX_TRANSPARENT_TYPE}
252
253
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}.
262
263 @item @code{GLX_TRANSPARENT_INDEX_VALUE}
264
265
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}.
273
274 @item @code{GLX_TRANSPARENT_RED_VALUE}
275
276
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}.
284
285 @item @code{GLX_TRANSPARENT_GREEN_VALUE}
286
287
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}.
295
296 @item @code{GLX_TRANSPARENT_BLUE_VALUE}
297
298
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}.
306
307 @item @code{GLX_TRANSPARENT_ALPHA_VALUE}
308
309
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}.
315
316 @end table
317
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):
323
324 @table @asis
325 @item 1.
326 By @code{GLX_CONFIG_CAVEAT} where the precedence is @code{GLX_NONE},
327 @code{GLX_SLOW_CONFIG}, and @code{GLX_NON_CONFORMANT_CONFIG}.
328
329 @item 2.
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.
335
336 @item 3.
337 Smaller @code{GLX_BUFFER_SIZE}.
338
339 @item 4.
340 Single buffered configuration (@code{GLX_DOUBLEBUFFER} being
341 @code{False} precedes a double buffered one.
342
343 @item 5.
344 Smaller @code{GLX_AUX_BUFFERS}.
345
346 @item 6.
347 Larger @code{GLX_DEPTH_SIZE}.
348
349 @item 7.
350 Smaller @code{GLX_STENCIL_SIZE}.
351
352 @item 8.
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.
359
360 @item 9.
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}.
364
365 @end table
366
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.
370
371 @end deftypefun
372
373 @deftypefun XVisualInfo* glXChooseVisual dpy screen attribList
374 Return a visual that matches specified attributes.
375
376 @table @asis
377 @item @var{dpy}
378 Specifies the connection to the X server.
379
380 @item @var{screen}
381 Specifies the screen number.
382
383 @item @var{attribList}
384 Specifies a list of boolean attributes and integer attribute/value
385 pairs. The last attribute must be @code{None}.
386
387 @end table
388
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,
397 use @code{XFree}.
398
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
406 with @code{None}.
407
408 The interpretations of the various GLX visual attributes are as follows:
409
410 @table @asis
411 @item @code{GLX_USE_GL}
412 Ignored. Only visuals that can be rendered with GLX are considered.
413
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.
418
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.
425
426 @item @code{GLX_RGBA}
427 If present, only TrueColor and DirectColor visuals are considered.
428 Otherwise, only PseudoColor and StaticColor visuals are considered.
429
430 @item @code{GLX_DOUBLEBUFFER}
431 If present, only double-buffered visuals are considered. Otherwise,
432 only single-buffered visuals are considered.
433
434 @item @code{GLX_STEREO}
435 If present, only stereo visuals are considered. Otherwise, only
436 monoscopic visuals are considered.
437
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
442 preferred.
443
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
448 is preferred.
449
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
454 size is preferred.
455
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
460 size is preferred.
461
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
466 size is preferred.
467
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
472 preferred.
473
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.
479
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.
485
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.
491
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.
497
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.
503
504 @end table
505
506 @code{NULL} is returned if an undefined GLX attribute is encountered in
507 @var{attribList}.
508
509 @end deftypefun
510
511 @deftypefun void glXCopyContext dpy src dst mask
512 Copy state from one rendering context to another.
513
514 @table @asis
515 @item @var{dpy}
516 Specifies the connection to the X server.
517
518 @item @var{src}
519 Specifies the source context.
520
521 @item @var{dst}
522 Specifies the destination context.
523
524 @item @var{mask}
525 Specifies which portions of @var{src} state are to be copied to
526 @var{dst}.
527
528 @end table
529
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.
537
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
544 space.
545
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}.
550
551 An implicit @code{glFlush} is done by @code{glXCopyContext} if @var{src}
552 is the current context for the calling thread.
553
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
556 to the same screen.
557
558 @code{BadAccess} is generated if @var{dst} is current to any thread
559 (including the calling thread) at the time @code{glXCopyContext} is
560 called.
561
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.
564
565 @code{GLXBadContext} is generated if either @var{src} or @var{dst} is
566 not a valid GLX context.
567
568 @end deftypefun
569
570 @deftypefun GLXContext glXCreateContext dpy vis shareList direct
571 Create a new GLX rendering context.
572
573 @table @asis
574 @item @var{dpy}
575 Specifies the connection to the X server.
576
577 @item @var{vis}
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}.
581
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.
585
586 @item @var{direct}
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
589 (@code{False}).
590
591 @end table
592
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.
597
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
607 pixmaps.
608
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.
619
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.
622
623 @code{NULL} is returned if execution fails on the client side.
624
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
627 @var{shareList}.
628
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).
631
632 @code{GLXBadContext} is generated if @var{shareList} is not a GLX
633 context and is not @code{NULL}.
634
635 @code{BadAlloc} is generated if the server does not have enough
636 resources to allocate the new context.
637
638 @end deftypefun
639
640 @deftypefun GLXPixmap glXCreateGLXPixmap dpy vis pixmap
641 Create an off-screen GLX rendering area.
642
643 @table @asis
644 @item @var{dpy}
645 Specifies the connection to the X server.
646
647 @item @var{vis}
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}.
651
652 @item @var{pixmap}
653 Specifies the X pixmap that will be used as the front left color buffer
654 of the off-screen rendering area.
655
656 @end table
657
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
662 rendering context.
663
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.
670
671 Some implementations may not support GLX pixmaps with direct rendering
672 contexts.
673
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}.
677
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).
681
682 @code{BadPixmap} is generated if @var{pixmap} is not a valid pixmap.
683
684 @code{BadAlloc} is generated if the server cannot allocate the GLX
685 pixmap.
686
687 @end deftypefun
688
689 @deftypefun GLXContext glXCreateNewContext dpy config render_type share_list direct
690 Create a new GLX rendering context.
691
692 @table @asis
693 @item @var{dpy}
694 Specifies the connection to the X server.
695
696 @item @var{config}
697 Specifies the GLXFBConfig structure with the desired attributes for the
698 context.
699
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}.
703
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.
707
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
711 (@code{False}).
712
713 @end table
714
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.
719
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.
724
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.
735
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
745 pixmaps.
746
747 @code{NULL} is returned if execution fails on the client side.
748
749 @code{GLXBadContext} is generated if @var{render_type} is not a GLX
750 context and is not @code{NULL}.
751
752 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
753 GLXFBConfig.
754
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
757 @var{render_type}.
758
759 @code{BadAlloc} is generated if the server does not have enough
760 resources to allocate the new context.
761
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).
764
765 @end deftypefun
766
767 @deftypefun GLXPbuffer glXCreatePbuffer dpy config attrib_list
768 Create an off-screen rendering area.
769
770 @table @asis
771 @item @var{dpy}
772 Specifies the connection to the X server.
773
774 @item @var{config}
775 Specifies a GLXFBConfig structure with the desired attributes for the
776 window.
777
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}.
783
784 @end table
785
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
790 rendering context.
791
792 The accepted attributes for a GLXPbuffer are:
793
794 @table @asis
795 @item @code{GLX_PBUFFER_WIDTH}
796 Specify the pixel width of the requested GLXPbuffer. The default value
797 is 0.
798
799 @item @code{GLX_PBUFFER_HEIGHT}
800 Specify the pixel height of the requested GLXPbuffer. The default value
801 is 0.
802
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}.
810
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
820 damaged.
821
822 @end table
823
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}.
827
828 @code{BadAlloc} is generated if there are insufficient resources to
829 allocate the requested GLXPbuffer.
830
831 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
832 GLXFBConfig.
833
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}).
837
838 @end deftypefun
839
840 @deftypefun GLXPixmap glXCreatePixmap dpy config pixmap attrib_list
841 Create an off-screen rendering area.
842
843 @table @asis
844 @item @var{dpy}
845 Specifies the connection to the X server.
846
847 @item @var{config}
848 Specifies a GLXFBConfig structure with the desired attributes for the
849 window.
850
851 @item @var{pixmap}
852 Specifies the X pixmap to be used as the rendering area.
853
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}).
857
858 @end table
859
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
864 rendering context.
865
866 @code{BadMatch} is generated if @var{pixmap} was not created with a
867 visual that corresponds to @var{config}.
868
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}).
872
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}.
876
877 @code{BadAlloc} is generated if the X server cannot allocate a new GLX
878 window.
879
880 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
881 GLXFBConfig.
882
883
884
885 @end deftypefun
886
887 @deftypefun GLXWindow glXCreateWindow dpy config win attrib_list
888 Create an on-screen rendering area.
889
890 @table @asis
891 @item @var{dpy}
892 Specifies the connection to the X server.
893
894 @item @var{config}
895 Specifies a GLXFBConfig structure with the desired attributes for the
896 window.
897
898 @item @var{win}
899 Specifies the X window to be used as the rendering area.
900
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}).
904
905 @end table
906
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.
913
914 @code{BadMatch} is generated if @var{win} was not created with a visual
915 that corresponds to @var{config}.
916
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}).
920
921 @code{BadWindow} is generated if @var{win} is not a valid pixmap XID.
922
923 @code{BadAlloc} is generated if there is already a GLXFBConfig
924 associated with @var{win}.
925
926 @code{BadAlloc} is generated if the X server cannot allocate a new GLX
927 window.
928
929 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
930 GLXFBConfig.
931
932
933
934 @end deftypefun
935
936 @deftypefun void glXDestroyContext dpy ctx
937 Destroy a GLX context.
938
939 @table @asis
940 @item @var{dpy}
941 Specifies the connection to the X server.
942
943 @item @var{ctx}
944 Specifies the GLX context to be destroyed.
945
946 @end table
947
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.
952
953 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
954 context.
955
956 @end deftypefun
957
958 @deftypefun void glXDestroyGLXPixmap dpy pix
959 Destroy a GLX pixmap.
960
961 @table @asis
962 @item @var{dpy}
963 Specifies the connection to the X server.
964
965 @item @var{pix}
966 Specifies the GLX pixmap to be destroyed.
967
968 @end table
969
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.
974
975 @code{GLXBadPixmap} is generated if @var{pix} is not a valid GLX pixmap.
976
977 @end deftypefun
978
979 @deftypefun void glXDestroyPbuffer dpy pbuf
980 Destroy an off-screen rendering area.
981
982 @table @asis
983 @item @var{dpy}
984 Specifies the connection to the X server.
985
986 @item @var{pbuf}
987 Specifies the GLXPbuffer to be destroyed.
988
989 @end table
990
991 @code{glXDestroyPbuffer} destroys a GLXPbuffer created by
992 @code{glXCreatePbuffer}.
993
994 @code{GLXBadPbuffer} is generated if @var{pbuf} is not a valid
995 GLXPbuffer.
996
997 @end deftypefun
998
999 @deftypefun void glXDestroyPixmap dpy pixmap
1000 Destroy an off-screen rendering area.
1001
1002 @table @asis
1003 @item @var{dpy}
1004 Specifies the connection to the X server.
1005
1006 @item @var{pixmap}
1007 Specifies the GLXPixmap to be destroyed.
1008
1009 @end table
1010
1011 @code{glXDestroyPixmap} destroys a GLXPixmap created by
1012 @code{glXCreatePixmap}.
1013
1014 @code{GLXBadPixmap} is generated if @var{pixmap} is not a valid
1015 GLXPixmap.
1016
1017 @end deftypefun
1018
1019 @deftypefun void glXDestroyWindow dpy win
1020 Destroy an on-screen rendering area.
1021
1022 @table @asis
1023 @item @var{dpy}
1024 Specifies the connection to the X server.
1025
1026 @item @var{win}
1027 Specifies the GLXWindow to be destroyed.
1028
1029 @end table
1030
1031 @code{glXDestroyWindow} destroys a GLXWindow created by
1032 @code{glXCreateWindow}.
1033
1034 @code{GLXBadWindow} is generated if @var{win} is not a valid GLXPixmap.
1035
1036 @end deftypefun
1037
1038 @deftypefun void glXFreeContextEXT dpy ctx
1039 Free client-side memory for imported context.
1040
1041 @table @asis
1042 @item @var{dpy}
1043 Specifies the connection to the X server.
1044
1045 @item @var{ctx}
1046 Specifies a GLX rendering context.
1047
1048 @end table
1049
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.
1054
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.
1060
1061 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1062 context.
1063
1064 @end deftypefun
1065
1066 @deftypefun const-char-* glXGetClientString dpy name
1067 Return a string describing the client.
1068
1069 @table @asis
1070 @item @var{dpy}
1071 Specifies the connection to the X server.
1072
1073 @item @var{name}
1074 Specifies which string is returned. The symbolic constants
1075 @code{GLX_VENDOR}, @code{GLX_VERSION}, and @code{GLX_EXTENSIONS} are
1076 accepted.
1077
1078 @end table
1079
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.
1086
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.
1090
1091 The version string is laid out as follows:
1092
1093 <major_version.minor_version><space><vendor-specific info>
1094
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.
1098
1099 @end deftypefun
1100
1101 @deftypefun int glXGetConfig dpy vis attrib value
1102 Return information about GLX visuals.
1103
1104 @table @asis
1105 @item @var{dpy}
1106 Specifies the connection to the X server.
1107
1108 @item @var{vis}
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
1111 @code{Visual}.
1112
1113 @item @var{attrib}
1114 Specifies the visual attribute to be returned.
1115
1116 @item @var{value}
1117 Returns the requested value.
1118
1119 @end table
1120
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.
1125
1126 @var{attrib} is one of the following:
1127
1128
1129
1130 @table @asis
1131 @item @code{GLX_USE_GL}
1132 @code{True} if OpenGL rendering is supported by this visual,
1133 @code{False} otherwise.
1134
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
1140 indexes.
1141
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.
1147
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.
1151
1152 @item @code{GLX_DOUBLEBUFFER}
1153 @code{True} if color buffers exist in front/back pairs that can be
1154 swapped, @code{False} otherwise.
1155
1156 @item @code{GLX_STEREO}
1157 @code{True} if color buffers exist in left/right pairs, @code{False}
1158 otherwise.
1159
1160 @item @code{GLX_AUX_BUFFERS}
1161 Number of auxiliary color buffers that are available. Zero indicates
1162 that no auxiliary color buffers exist.
1163
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}.
1167
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}.
1171
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}.
1175
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}.
1179
1180 @item @code{GLX_DEPTH_SIZE}
1181 Number of bits in the depth buffer.
1182
1183 @item @code{GLX_STENCIL_SIZE}
1184 Number of bits in the stencil buffer.
1185
1186 @item @code{GLX_ACCUM_RED_SIZE}
1187 Number of bits of red stored in the accumulation buffer.
1188
1189 @item @code{GLX_ACCUM_GREEN_SIZE}
1190 Number of bits of green stored in the accumulation buffer.
1191
1192 @item @code{GLX_ACCUM_BLUE_SIZE}
1193 Number of bits of blue stored in the accumulation buffer.
1194
1195 @item @code{GLX_ACCUM_ALPHA_SIZE}
1196 Number of bits of alpha stored in the accumulation buffer.
1197
1198 @end table
1199
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}.
1204
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
1213 zero.
1214
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.
1221
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.
1226
1227 @code{GLX_NO_EXTENSION} is returned if @var{dpy} does not support the
1228 GLX extension.
1229
1230 @code{GLX_BAD_SCREEN} is returned if the screen of @var{vis} does not
1231 correspond to a screen.
1232
1233 @code{GLX_BAD_ATTRIBUTE} is returned if @var{attrib} is not a valid GLX
1234 attribute.
1235
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.
1238
1239 @end deftypefun
1240
1241 @deftypefun GLXContextID glXGetContextIDEXT ctx
1242 Get the XID for a context..
1243
1244 @table @asis
1245 @item @var{ctx}
1246 Specifies a GLX rendering context.
1247
1248 @end table
1249
1250 @code{glXGetContextIDEXT} returns the XID associated with a GLXContext.
1251
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.
1254
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.
1260
1261 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1262 context.
1263
1264 @end deftypefun
1265
1266 @deftypefun GLXContext glXGetCurrentContext
1267 Return the current context.
1268
1269 @code{glXGetCurrentContext} returns the current context, as specified by
1270 @code{glXMakeCurrent}. If there is no current context, @code{NULL} is
1271 returned.
1272
1273 @code{glXGetCurrentContext} returns client-side information. It does
1274 not make a round trip to the server.
1275
1276
1277
1278 @end deftypefun
1279
1280 @deftypefun Display-* glXGetCurrentDisplay
1281 Get display for current context.
1282
1283 @code{glXGetCurrentDisplay} returns the display for the current context.
1284 If no context is current, @code{NULL} is returned.
1285
1286 @code{glXGetCurrentDisplay} returns client-side information. It does
1287 not make a round-trip to the server, and therefore does not flush any
1288 pending events.
1289
1290 @end deftypefun
1291
1292 @deftypefun GLXDrawable glXGetCurrentDrawable
1293 Return the current drawable.
1294
1295 @code{glXGetCurrentDrawable} returns the current drawable, as specified
1296 by @code{glXMakeCurrent}. If there is no current drawable, @code{None}
1297 is returned.
1298
1299 @code{glXGetCurrentDrawable} returns client-side information. It does
1300 not make a round trip to the server.
1301
1302 @end deftypefun
1303
1304 @deftypefun GLXDrawable glXGetCurrentReadDrawable
1305 Return the current drawable.
1306
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.
1310
1311 @code{glXGetCurrentReadDrawable} returns client-side information. It
1312 does not make a round-trip to the server.
1313
1314 @end deftypefun
1315
1316 @deftypefun int glXGetFBConfigAttrib dpy config attribute value
1317 Return information about a GLX frame buffer configuration.
1318
1319 @table @asis
1320 @item @var{dpy}
1321 Specifies the connection to the X server.
1322
1323 @item @var{config}
1324 Specifies the GLX frame buffer configuration to be queried.
1325
1326 @item @var{attribute}
1327 Specifies the attribute to be returned.
1328
1329 @item @var{value}
1330 Returns the requested value.
1331
1332 @end table
1333
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.
1338
1339 @var{attribute} is one of the following:
1340
1341
1342
1343 @table @asis
1344 @item @code{GLX_FBCONFIG_ID}
1345 XID of the given GLXFBConfig.
1346
1347 @item @code{GLX_BUFFER_SIZE}
1348
1349
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
1355 indexes.
1356
1357 @item @code{GLX_LEVEL}
1358
1359
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.
1364
1365 @item @code{GLX_DOUBLEBUFFER}
1366
1367
1368 @code{True} if color buffers exist in front/back pairs that can be
1369 swapped, @code{False} otherwise.
1370
1371 @item @code{GLX_STEREO}
1372
1373
1374 @code{True} if color buffers exist in left/right pairs, @code{False}
1375 otherwise.
1376
1377 @item @code{GLX_AUX_BUFFERS}
1378
1379
1380 Number of auxiliary color buffers that are available. Zero indicates
1381 that no auxiliary color buffers exist.
1382
1383 @item @code{GLX_RED_SIZE}
1384
1385
1386 Number of bits of red stored in each color buffer. Undefined if RGBA
1387 contexts are not supported by the frame buffer configuration.
1388
1389 @item @code{GLX_GREEN_SIZE}
1390
1391
1392 Number of bits of green stored in each color buffer. Undefined if RGBA
1393 contexts are not supported by the frame buffer configuration.
1394
1395 @item @code{GLX_BLUE_SIZE}
1396
1397
1398 Number of bits of blue stored in each color buffer. Undefined if RGBA
1399 contexts are not supported by the frame buffer configuration.
1400
1401 @item @code{GLX_ALPHA_SIZE}
1402
1403
1404 Number of bits of alpha stored in each color buffer. Undefined if RGBA
1405 contexts are not supported by the frame buffer configuration.
1406
1407 @item @code{GLX_DEPTH_SIZE}
1408
1409
1410 Number of bits in the depth buffer.
1411
1412 @item @code{GLX_STENCIL_SIZE}
1413
1414
1415 Number of bits in the stencil buffer.
1416
1417 @item @code{GLX_ACCUM_RED_SIZE}
1418
1419
1420 Number of bits of red stored in the accumulation buffer.
1421
1422 @item @code{GLX_ACCUM_GREEN_SIZE}
1423
1424
1425 Number of bits of green stored in the accumulation buffer.
1426
1427 @item @code{GLX_ACCUM_BLUE_SIZE}
1428
1429
1430 Number of bits of blue stored in the accumulation buffer.
1431
1432 @item @code{GLX_ACCUM_ALPHA_SIZE}
1433
1434
1435 Number of bits of alpha stored in the accumulation buffer.
1436
1437 @item @code{GLX_RENDER_TYPE}
1438
1439
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}.
1443
1444 @item @code{GLX_DRAWABLE_TYPE}
1445
1446
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}.
1450
1451 @item @code{GLX_X_RENDERABLE}
1452
1453
1454 @code{True} if drawables created with the frame buffer configuration can
1455 be rendered to by X.
1456
1457 @item @code{GLX_VISUAL_ID}
1458
1459
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
1463 set).
1464
1465 @item @code{GLX_X_VISUAL_TYPE}
1466
1467
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).
1474
1475 @item @code{GLX_CONFIG_CAVEAT}
1476
1477
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,
1483 respectively.
1484
1485 @item @code{GLX_TRANSPARENT_TYPE}
1486
1487
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,
1492 respectively.
1493
1494 @item @code{GLX_TRANSPARENT_INDEX_VALUE}
1495
1496
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}.
1501
1502 @item @code{GLX_TRANSPARENT_RED_VALUE}
1503
1504
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}.
1509
1510 @item @code{GLX_TRANSPARENT_GREEN_VALUE}
1511
1512
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}.
1517
1518 @item @code{GLX_TRANSPARENT_BLUE_VALUE}
1519
1520
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}.
1525
1526 @item @code{GLX_TRANSPARENT_ALPHA_VALUE}
1527
1528
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}.
1533
1534 @item @code{GLX_MAX_PBUFFER_WIDTH}
1535
1536
1537 The maximum width that can be specified to @code{glXCreatePbuffer}.
1538
1539 @item @code{GLX_MAX_PBUFFER_HEIGHT}
1540
1541
1542 The maximum height that can be specified to @code{glXCreatePbuffer}.
1543
1544 @item @code{GLX_MAX_PBUFFER_PIXELS}
1545
1546
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}.
1553
1554 @end table
1555
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.
1560
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.
1564
1565 @end deftypefun
1566
1567 @deftypefun GLXFBConfig-* glXGetFBConfigs dpy screen nelements
1568 List all GLX frame buffer configurations for a given screen.
1569
1570 @table @asis
1571 @item @var{dpy}
1572 Specifies the connection to the X server.
1573
1574 @item @var{screen}
1575 Specifies the screen number.
1576
1577 @item @var{nelements}
1578 Returns the number of GLXFBConfigs returned.
1579
1580 @end table
1581
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.
1585
1586 @end deftypefun
1587
1588 @deftypefun void(*)() glXGetProcAddress procName
1589 Obtain a pointer to an OpenGL or GLX function.
1590
1591 @table @asis
1592 @item @var{procName}
1593 Specifies the name of the OpenGL or GLX function whose address is to be
1594 returned.
1595
1596 @end table
1597
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
1601 library.
1602
1603 @end deftypefun
1604
1605 @deftypefun void glXGetSelectedEvent dpy draw event_mask
1606 Returns GLX events that are selected for a window or a GLX pixel buffer.
1607
1608 @table @asis
1609 @item @var{dpy}
1610 Specifies the connection to the X server.
1611
1612 @item @var{draw}
1613 Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
1614
1615 @item @var{event_mask}
1616 Returns the events that are selected for @var{draw}.
1617
1618 @end table
1619
1620 @code{glXGetSelectedEvent} returns in @var{event_mask} the events
1621 selected for @var{draw}.
1622
1623 @code{GLXBadDrawable} is generated if @var{draw} is not a valid window
1624 or a valid GLX pixel buffer.
1625
1626 @end deftypefun
1627
1628 @deftypefun XVisualInfo-* glXGetVisualFromFBConfig dpy config
1629 Return visual that is associated with the frame buffer configuration.
1630
1631 @table @asis
1632 @item @var{dpy}
1633 Specifies the connection to the X server.
1634
1635 @item @var{config}
1636 Specifies the GLX frame buffer configuration.
1637
1638 @end table
1639
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
1643 the data returned.
1644
1645 Returns @code{NULL} if @var{config} is not a valid GLXFBConfig.
1646
1647 @end deftypefun
1648
1649 @deftypefun GLXContext glXImportContextEXT dpy contextID
1650 Import another process's indirect rendering context..
1651
1652 @table @asis
1653 @item @var{dpy}
1654 Specifies the connection to the X server.
1655
1656 @item @var{contextID}
1657 Specifies a GLX rendering context.
1658
1659 @end table
1660
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
1664 context.
1665
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}.
1671
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
1677 to any thread.
1678
1679 If @var{contextID} refers to a direct rendering context then no error is
1680 generated but @code{glXImportContextEXT} returns NULL.
1681
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.
1687
1688 @code{GLXBadContext} is generated if @var{contextID} does not refer to a
1689 valid context.
1690
1691 @end deftypefun
1692
1693 @deftypefun Bool glXIsDirect dpy ctx
1694 Indicate whether direct rendering is enabled.
1695
1696 @table @asis
1697 @item @var{dpy}
1698 Specifies the connection to the X server.
1699
1700 @item @var{ctx}
1701 Specifies the GLX context that is being queried.
1702
1703 @end table
1704
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.
1710
1711 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1712 context.
1713
1714 @end deftypefun
1715
1716 @deftypefun Bool glXMakeContextCurrent display draw read ctx
1717 Attach a GLX context to a GLX drawable.
1718
1719 @table @asis
1720 @item @var{display}
1721 Specifies the connection to the X server.
1722
1723 @item @var{draw}
1724 Specifies a GLX drawable to render into. Must be an XID representing a
1725 GLXWindow, GLXPixmap, or GLXPbuffer.
1726
1727 @item @var{read}
1728 Specifies a GLX drawable to read from. Must be an XID representing a
1729 GLXWindow, GLXPixmap, or GLXPbuffer.
1730
1731 @item @var{ctx}
1732 Specifies the GLX context to be bound to @var{read} and @var{ctx}.
1733
1734 @end table
1735
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.
1739
1740 @var{draw} is used for all OpenGL operations except:
1741
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}.
1746
1747 Any depth values that are retrieved by @code{glReadPixels} or
1748 @code{glCopyPixels}.
1749
1750 Any stencil values that are retrieved by @code{glReadPixels} or
1751 @code{glCopyPixels}.
1752
1753 Frame buffer values are taken from @var{draw}.
1754
1755 If the current rendering thread has a current rendering context, that
1756 context is flushed and replaced by @var{ctx}.
1757
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
1761 current.
1762
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}.
1766
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.
1770
1771 @code{BadMatch} is generated if @var{draw} and @var{read} are not
1772 compatible.
1773
1774 @code{BadAccess} is generated if @var{ctx} is current to some other
1775 thread.
1776
1777 @code{GLXContextState} is generated if there is a current rendering
1778 context and its render mode is either @code{GLX_FEEDBACK} or
1779 @code{GLX_SELECT}.
1780
1781 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1782 rendering context.
1783
1784 @code{GLXBadDrawable} is generated if @var{draw} or @var{read} is not a
1785 valid GLX drawable.
1786
1787 @code{GLXBadWindow} is generated if the underlying X window for either
1788 @var{draw} or @var{read} is no longer valid.
1789
1790 @code{GLXBadCurrentDrawable} is generated if the previous context of the
1791 calling thread has unflushed commands and the previous drawable is no
1792 longer valid.
1793
1794 @code{BadAlloc} is generated if the X server does not have enough
1795 resources to allocate the buffers.
1796
1797 @code{BadMatch} is generated if:
1798
1799 @var{draw} and @var{read} cannot fit into frame buffer memory
1800 simultaneously.
1801
1802 @var{draw} or @var{read} is a GLXPixmap and @var{ctx} is a
1803 direct-rendering context.
1804
1805 @var{draw} or @var{read} is a GLXPixmap and @var{ctx} was previously
1806 bound to a GLXWindow or GLXPbuffer.
1807
1808 @var{draw} or @var{read} is a GLXWindow or GLXPbuffer and @var{ctx} was
1809 previously bound to a GLXPixmap.
1810
1811 @end deftypefun
1812
1813 @deftypefun Bool glXMakeCurrent dpy drawable ctx
1814 Attach a GLX context to a window or a GLX pixmap.
1815
1816 @table @asis
1817 @item @var{dpy}
1818 Specifies the connection to the X server.
1819
1820 @item @var{drawable}
1821 Specifies a GLX drawable. Must be either an X window ID or a GLX pixmap
1822 ID.
1823
1824 @item @var{ctx}
1825 Specifies a GLX rendering context that is to be attached to
1826 @var{drawable}.
1827
1828 @end table
1829
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.
1838
1839 Pending commands to the previous context, if any, are flushed before it
1840 is released.
1841
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.
1845
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}.
1849
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.
1853
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}.
1857
1858 @code{BadAccess} is generated if @var{ctx} was current to another thread
1859 at the time @code{glXMakeCurrent} was called.
1860
1861 @code{GLXBadDrawable} is generated if @var{drawable} is not a valid GLX
1862 drawable.
1863
1864 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1865 context.
1866
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}.
1870
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}.
1874
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
1877 longer valid.
1878
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.
1882
1883 @end deftypefun
1884
1885 @deftypefun int glXQueryContextInfoEXT dpy ctx attribute value
1886 Query context information.
1887
1888 @table @asis
1889 @item @var{dpy}
1890 Specifies the connection to the X server.
1891
1892 @item @var{ctx}
1893 Specifies a GLX rendering context.
1894
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}.
1899
1900 @item @var{value}
1901 Contains the return value for @var{attribute}.
1902
1903 @end table
1904
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.
1909
1910 @var{attribute} may be one of the following:
1911
1912 @table @asis
1913 @item @code{GLX_SHARED_CONTEXT_EXT}
1914 Returns the XID of the share list context associated with @var{ctx} at
1915 its creation.
1916
1917 @item @code{GLX_VISUAL_ID_EXT}
1918 Returns the XID of the GLX Visual associated with @var{ctx}.
1919
1920 @item @code{GLX_SCREEN_EXT}
1921 Returns the screen number associated with @var{ctx}.
1922
1923 @end table
1924
1925 This call may cause a round-trip to the server.
1926
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.
1932
1933 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1934 context.
1935
1936 @code{GLX_BAD_ATTRIBUTE} is returned if @var{attribute} is not a valid
1937 GLX context attribute.
1938
1939 fred @code{GLX_BAD_CONTEXT} is returned if @var{attribute} is not a
1940 valid context.
1941
1942 @end deftypefun
1943
1944 @deftypefun int glXQueryContext dpy ctx attribute value
1945 Query context information.
1946
1947 @table @asis
1948 @item @var{dpy}
1949 Specifies the connection to the X server.
1950
1951 @item @var{ctx}
1952 Specifies a GLX rendering context.
1953
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}.
1957
1958 @item @var{value}
1959 Contains the return value for @var{attribute}.
1960
1961 @end table
1962
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:
1965
1966 @table @asis
1967 @item @code{GLX_FBCONFIG_ID}
1968 Returns the XID of the GLXFBConfig associated with @var{ctx}.
1969
1970 @item @code{GLX_RENDER_TYPE}
1971 Returns the rendering type supported by @var{ctx}.
1972
1973 @item @code{GLX_SCREEN}
1974 Returns the screen number associated with @var{ctx}.
1975
1976 @end table
1977
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.
1980
1981 This call may cause a round-trip to the server.
1982
1983 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1984 context.
1985
1986 @end deftypefun
1987
1988 @deftypefun int glXQueryDrawable dpy draw attribute value
1989 Returns an attribute assoicated with a GLX drawable.
1990
1991 @table @asis
1992 @item @var{dpy}
1993 Specifies the connection to the X server.
1994
1995 @item @var{draw}
1996 Specifies the GLX drawable to be queried.
1997
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}.
2002
2003 @item @var{value}
2004 Contains the return value for @var{attribute}.
2005
2006 @end table
2007
2008 @code{glXQueryDrawable} sets @var{value} to the value of @var{attribute}
2009 with respect to the GLXDrawable @var{draw}.
2010
2011 @var{attribute} may be one of the following:
2012
2013 @table @asis
2014 @item @code{GLX_WIDTH}
2015 Returns the width of @var{ctx}.
2016
2017 @item @code{GLX_HEIGHT}
2018 Returns the height of @var{ctx}.
2019
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.
2023
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.
2031
2032 @item @code{GLX_FBCONFIG_ID}
2033 Returns the XID for @var{draw}.
2034
2035 @end table
2036
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.
2041
2042 A @code{GLXBadDrawable} is generated if @var{draw} is not a valid
2043 GLXDrawable.
2044
2045 @end deftypefun
2046
2047 @deftypefun const-char-* glXQueryExtensionsString dpy screen
2048 Return list of supported extensions.
2049
2050 @table @asis
2051 @item @var{dpy}
2052 Specifies the connection to the X server.
2053
2054 @item @var{screen}
2055 Specifies the screen number.
2056
2057 @end table
2058
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.
2064
2065 @end deftypefun
2066
2067 @deftypefun Bool glXQueryExtension dpy errorBase eventBase
2068 Indicate whether the GLX extension is supported.
2069
2070 @table @asis
2071 @item @var{dpy}
2072 Specifies the connection to the X server.
2073
2074 @item @var{errorBase}
2075 Returns the base error code of the GLX server extension.
2076
2077 @item @var{eventBase}
2078 Returns the base event code of the GLX server extension.
2079
2080 @end table
2081
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.
2089
2090 @var{errorBase} and @var{eventBase} do not return values if they are
2091 specified as @code{NULL}.
2092
2093 @end deftypefun
2094
2095 @deftypefun const-char-* glXQueryServerString dpy screen name
2096 Return string describing the server.
2097
2098 @table @asis
2099 @item @var{dpy}
2100 Specifies the connection to the X server.
2101
2102 @item @var{screen}
2103 Specifies the screen number.
2104
2105 @item @var{name}
2106 Specifies which string is returned: one of @code{GLX_VENDOR},
2107 @code{GLX_VERSION}, or @code{GLX_EXTENSIONS}.
2108
2109 @end table
2110
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.
2116
2117 @end deftypefun
2118
2119 @deftypefun Bool glXQueryVersion dpy major minor
2120 Return the version numbers of the GLX extension.
2121
2122 @table @asis
2123 @item @var{dpy}
2124 Specifies the connection to the X server.
2125
2126 @item @var{major}
2127 Returns the major version number of the GLX server extension.
2128
2129 @item @var{minor}
2130 Returns the minor version number of the GLX server extension.
2131
2132 @end table
2133
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.
2139
2140 @var{major} and @var{minor} do not return values if they are specified
2141 as @code{NULL}.
2142
2143 @code{glXQueryVersion} returns @code{False} if it fails, @code{True}
2144 otherwise.
2145
2146 @var{major} and @var{minor} are not updated when @code{False} is
2147 returned.
2148
2149 @end deftypefun
2150
2151 @deftypefun void glXSelectEvent dpy draw event_mask
2152 Select GLX events for a window or a GLX pixel buffer.
2153
2154 @table @asis
2155 @item @var{dpy}
2156 Specifies the connection to the X server.
2157
2158 @item @var{draw}
2159 Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
2160
2161 @item @var{event_mask}
2162 Specifies the events to be returned for @var{draw}.
2163
2164 @end table
2165
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
2171 event mask for it.
2172
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:
2176
2177 typedef struct @{
2178
2179 @table @asis
2180 @item
2181 int @var{event_type};
2182 /* GLX_DAMAGED or GLX_SAVED */
2183
2184 @item
2185 int @var{draw_type};
2186 /* GLX_WINDOW or GLX_PBUFFER */
2187
2188 @item
2189 unsigned long @var{serial};
2190 /* # of last request processed by server */
2191
2192 @item
2193 Bool @var{send_event};
2194 /* true if this came for SendEvent request */
2195
2196 @item
2197 Display @var{*display};
2198 /* display the event was read from */
2199
2200 @item
2201 GLXDrawable @var{drawable};
2202 /* i.d. of Drawable */
2203
2204 @item
2205 unsigned int @var{buffer_mask};
2206 /* mask indicating affected buffers */
2207
2208 @item
2209 int @var{x, y};
2210
2211
2212 @item
2213 int @var{width, height};
2214
2215
2216 @item
2217 int @var{count};
2218 /* if nonzero, at least this many more */
2219
2220 @end table
2221
2222 @} GLXPbufferClobberEvent; The valid bit masks used in @var{buffer_mask}
2223 are:
2224
2225
2226
2227 @table @asis
2228 @item @strong{Bitmask}
2229 @strong{Corresponding Buffer}
2230
2231 @item @code{GLX_FRONT_LEFT_BUFFER_BIT}
2232 Front left color buffer
2233
2234 @item @code{GLX_FRONT_RIGHT_BUFFER_BIT}
2235 Front right color buffer
2236
2237 @item @code{GLX_BACK_LEFT_BUFFER_BIT}
2238 Back left color buffer
2239
2240 @item @code{GLX_BACK_RIGHT_BUFFER_BIT}
2241 Back right color buffer
2242
2243 @item @code{GLX_AUX_BUFFERS_BIT}
2244 Auxiliary buffer
2245
2246 @item @code{GLX_DEPTH_BUFFER_BIT}
2247 Depth buffer
2248
2249 @item @code{GLX_STENCIL_BUFFER_BIT}
2250 Stencil buffer
2251
2252 @item @code{GLX_ACCUM_BUFFER_BIT}
2253 Accumulation buffer
2254
2255 @end table
2256
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.
2266
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
2275 color buffers.
2276
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.
2284
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.
2289
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.
2295
2296 @code{GLXBadDrawable} is generated if @var{draw} is not a valid window
2297 or a valid GLX pixel buffer.
2298
2299 @end deftypefun
2300
2301 @deftypefun void glXSwapBuffers dpy drawable
2302 Exchange front and back buffers.
2303
2304 @table @asis
2305 @item @var{dpy}
2306 Specifies the connection to the X server.
2307
2308 @item @var{drawable}
2309 Specifies the drawable whose buffers are to be swapped.
2310
2311 @end table
2312
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.
2318
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.
2323
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.
2326
2327 @code{GLXBadDrawable} is generated if @var{drawable} is not a valid GLX
2328 drawable.
2329
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.
2334
2335 @end deftypefun
2336
2337 @deftypefun void glXUseXFont font first count listBase
2338 Create bitmap display lists from an X font.
2339
2340 @table @asis
2341 @item @var{font}
2342 Specifies the font from which character glyphs are to be taken.
2343
2344 @item @var{first}
2345 Specifies the index of the first glyph to be taken.
2346
2347 @item @var{count}
2348 Specifies the number of glyphs to be taken.
2349
2350 @item @var{listBase}
2351 Specifies the index of the first display list to be generated.
2352
2353 @end table
2354
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}.
2366
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.
2372
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.
2376
2377 @code{BadFont} is generated if @var{font} is not a valid font.
2378
2379 @code{GLXBadContextState} is generated if the current GLX context is in
2380 display-list construction mode.
2381
2382 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2383 the current context of the calling thread is a window, and that window
2384 is no longer valid.
2385
2386 @end deftypefun
2387
2388 @deftypefun void glXWaitGL
2389 Complete GL execution prior to subsequent X calls.
2390
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.
2396
2397 @code{glXWaitGL} is ignored if there is no current GLX context.
2398
2399 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2400 the current context of the calling thread is a window, and that window
2401 is no longer valid.
2402
2403 @end deftypefun
2404
2405 @deftypefun void glXWaitX
2406 Complete X execution prior to subsequent GL calls.
2407
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.
2413
2414 @code{glXWaitX} is ignored if there is no current GLX context.
2415
2416 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2417 the current context of the calling thread is a window, and that window
2418 is no longer valid.
2419
2420 @end deftypefun
2421
2422
2423 @c %end of fragment