Revert "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 is
17 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 by
51 @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 each
69 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 overlay
96 frame buffer, level two the second overlay frame buffer, and so on.
97 Negative buffer levels correspond to underlay frame buffers. The default
98 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 or
134 @code{GLX_DONT_CARE}, it is not considered. The default value for each
135 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 the
143 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 the
150 specified size is preferred. If the desired value is zero, frame buffer
151 configurations with no stencil buffer are preferred. The default value
152 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 accumulation
169 buffer of at least the minimum size is preferred. The default value is
170 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 accumulation
187 buffer of at least the minimum size is preferred. The default value is
188 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 @code{GLX_WINDOW_BIT},
206 @code{GLX_PIXMAP_BIT}, and @code{GLX_PBUFFER_BIT}. For example, if mask
207 is set to @code{GLX_WINDOW_BIT} | @code{GLX_PIXMAP_BIT}, only frame
208 buffer configurations that support both windows and GLX pixmaps will be
209 considered. The default value is @code{GLX_WINDOW_BIT}.
210
211 @item @code{GLX_X_RENDERABLE}
212
213
214 Must be followed by @code{True} or @code{False}. If @code{True} is
215 specified, then only frame buffer configurations that have associated X
216 visuals (and can be used to render to Windows and/or GLX pixmaps) will
217 be considered. The default value is @code{GLX_DONT_CARE}.
218
219 @item @code{GLX_X_VISUAL_TYPE}
220
221
222 Must be followed by one of @code{GLX_TRUE_COLOR},
223 @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
224 @code{GLX_STATIC_COLOR}, @code{GLX_GRAY_SCALE}, or
225 @code{GLX_STATIC_GRAY}, indicating the desired X visual type. Not all
226 frame buffer configurations have an associated X visual. If
227 @code{GLX_DRAWABLE_TYPE} is specified in @var{attrib_list} and the mask
228 that follows does not have @code{GLX_WINDOW_BIT} set, then this value is
229 ignored. It is also ignored if @code{GLX_X_RENDERABLE} is specified as
230 @code{False}. RGBA rendering may be supported for visuals of type
231 @code{GLX_TRUE_COLOR}, @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
232 or @code{GLX_STATIC_COLOR}, but color index rendering is only supported
233 for visuals of type @code{GLX_PSEUDO_COLOR} or @code{GLX_STATIC_COLOR}
234 (i.e., single-channel visuals). The tokens @code{GLX_GRAY_SCALE} and
235 @code{GLX_STATIC_GRAY} will not match current OpenGL enabled visuals,
236 but are included for future use. The default value for
237 @code{GLX_X_VISUAL_TYPE} is @code{GLX_DONT_CARE}.
238
239 @item @code{GLX_CONFIG_CAVEAT}
240
241
242 Must be followed by one of @code{GLX_NONE}, @code{GLX_SLOW_CONFIG},
243 @code{GLX_NON_CONFORMANT_CONFIG}. If @code{GLX_NONE} is specified, then
244 only frame buffer configurations with no caveats will be considered; if
245 @code{GLX_SLOW_CONFIG} is specified, then only slow frame buffer
246 configurations will be considered; if @code{GLX_NON_CONFORMANT_CONFIG}
247 is specified, then only nonconformant frame buffer configurations will
248 be considered. The default value is @code{GLX_DONT_CARE}.
249
250 @item @code{GLX_TRANSPARENT_TYPE}
251
252
253 Must be followed by one of @code{GLX_NONE}, @code{GLX_TRANSPARENT_RGB},
254 @code{GLX_TRANSPARENT_INDEX}. If @code{GLX_NONE} is specified, then only
255 opaque frame buffer configurations will be considered; if
256 @code{GLX_TRANSPARENT_RGB} is specified, then only transparent frame
257 buffer configurations that support RGBA rendering will be considered; if
258 @code{GLX_TRANSPARENT_INDEX} is specified, then only transparent frame
259 buffer configurations that support color index rendering will be
260 considered. The default value is @code{GLX_NONE}.
261
262 @item @code{GLX_TRANSPARENT_INDEX_VALUE}
263
264
265 Must be followed by an integer value indicating the transparent index
266 value; the value must be between 0 and the maximum frame buffer value
267 for indices. Only frame buffer configurations that use the specified
268 transparent index value will be considered. The default value is
269 @code{GLX_DONT_CARE}. This attribute is ignored unless
270 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
271 specified as @code{GLX_TRANSPARENT_INDEX}.
272
273 @item @code{GLX_TRANSPARENT_RED_VALUE}
274
275
276 Must be followed by an integer value indicating the transparent red
277 value; the value must be between 0 and the maximum frame buffer value
278 for red. Only frame buffer configurations that use the specified
279 transparent red value will be considered. The default value is
280 @code{GLX_DONT_CARE}. This attribute is ignored unless
281 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
282 specified as @code{GLX_TRANSPARENT_RGB}.
283
284 @item @code{GLX_TRANSPARENT_GREEN_VALUE}
285
286
287 Must be followed by an integer value indicating the transparent green
288 value; the value must be between 0 and the maximum frame buffer value
289 for green. Only frame buffer configurations that use the specified
290 transparent green value will be considered. The default value is
291 @code{GLX_DONT_CARE}. This attribute is ignored unless
292 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
293 specified as @code{GLX_TRANSPARENT_RGB}.
294
295 @item @code{GLX_TRANSPARENT_BLUE_VALUE}
296
297
298 Must be followed by an integer value indicating the transparent blue
299 value; the value must be between 0 and the maximum frame buffer value
300 for blue. Only frame buffer configurations that use the specified
301 transparent blue value will be considered. The default value is
302 @code{GLX_DONT_CARE}. This attribute is ignored unless
303 @code{GLX_TRANSPARENT_TYPE} is included in @var{attrib_list} and
304 specified as @code{GLX_TRANSPARENT_RGB}.
305
306 @item @code{GLX_TRANSPARENT_ALPHA_VALUE}
307
308
309 Must be followed by an integer value indicating the transparent alpha
310 value; the value must be between 0 and the maximum frame buffer value
311 for alpha. Only frame buffer configurations that use the specified
312 transparent alpha value will be considered. The default value is
313 @code{GLX_DONT_CARE}.
314
315 @end table
316
317 When more than one GLX frame buffer configuration matches the specified
318 attributes, a list of matching configurations is returned. The list is
319 sorted according to the following precedence rules, which are applied in
320 ascending order (i.e., configurations that are considered equal by a
321 lower numbered rule are sorted by the higher numbered rule):
322
323 @table @asis
324 @item 1.
325 By @code{GLX_CONFIG_CAVEAT} where the precedence is @code{GLX_NONE},
326 @code{GLX_SLOW_CONFIG}, and @code{GLX_NON_CONFORMANT_CONFIG}.
327
328 @item 2.
329 Larger total number of RGBA color components (@code{GLX_RED_SIZE},
330 @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, plus @code{GLX_ALPHA_SIZE})
331 that have higher number of bits. If the requested number of bits in
332 @var{attrib_list} is zero or @code{GLX_DONT_CARE} for a particular color
333 component, then the number of bits for that component is not considered.
334
335 @item 3.
336 Smaller @code{GLX_BUFFER_SIZE}.
337
338 @item 4.
339 Single buffered configuration (@code{GLX_DOUBLEBUFFER} being
340 @code{False} precedes a double buffered one.
341
342 @item 5.
343 Smaller @code{GLX_AUX_BUFFERS}.
344
345 @item 6.
346 Larger @code{GLX_DEPTH_SIZE}.
347
348 @item 7.
349 Smaller @code{GLX_STENCIL_SIZE}.
350
351 @item 8.
352 Larger total number of accumulation buffer color components
353 (@code{GLX_ACCUM_RED_SIZE}, @code{GLX_ACCUM_GREEN_SIZE},
354 @code{GLX_ACCUM_BLUE_SIZE}, plus @code{GLX_ACCUM_ALPHA_SIZE}) that have
355 higher number of bits. If the requested number of bits in
356 @var{attrib_list} is zero or @code{GLX_DONT_CARE} for a particular color
357 component, then the number of bits for that component is not considered.
358
359 @item 9.
360 By @code{GLX_X_VISUAL_TYPE} where the precedence order is
361 @code{GLX_TRUE_COLOR}, @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
362 @code{GLX_STATIC_COLOR}, @code{GLX_GRAY_SCALE}, @code{GLX_STATIC_GRAY}.
363
364 @end table
365
366 @code{NULL} is returned if an undefined GLX attribute is encountered in
367 @var{attrib_list}, if @var{screen} is invalid, or if @var{dpy} does not
368 support the GLX extension.
369
370 @end deftypefun
371
372 @deftypefun XVisualInfo* glXChooseVisual dpy screen attribList
373 Return a visual that matches specified attributes.
374
375 @table @asis
376 @item @var{dpy}
377 Specifies the connection to the X server.
378
379 @item @var{screen}
380 Specifies the screen number.
381
382 @item @var{attribList}
383 Specifies a list of boolean attributes and integer attribute/value
384 pairs. The last attribute must be @code{None}.
385
386 @end table
387
388 @code{glXChooseVisual} returns a pointer to an XVisualInfo structure
389 describing the visual that best meets a minimum specification. The
390 boolean GLX attributes of the visual that is returned will match the
391 specified values, and the integer GLX attributes will meet or exceed the
392 specified minimum values. If all other attributes are equivalent, then
393 TrueColor and PseudoColor visuals have priority over DirectColor and
394 StaticColor visuals, respectively. If no conforming visual exists,
395 @code{NULL} is returned. To free the data returned by this function, use
396 @code{XFree}.
397
398 All boolean GLX attributes default to @code{False} except
399 @code{GLX_USE_GL}, which defaults to @code{True}. All integer GLX
400 attributes default to zero. Default specifications are superseded by
401 attributes included in @var{attribList}. Boolean attributes included in
402 @var{attribList} are understood to be @code{True}. Integer attributes
403 and enumerated type attributes are followed immediately by the
404 corresponding desired or minimum value. The list must be terminated with
405 @code{None}.
406
407 The interpretations of the various GLX visual attributes are as follows:
408
409 @table @asis
410 @item @code{GLX_USE_GL}
411 Ignored. Only visuals that can be rendered with GLX are considered.
412
413 @item @code{GLX_BUFFER_SIZE}
414 Must be followed by a nonnegative integer that indicates the desired
415 color index buffer size. The smallest index buffer of at least the
416 specified size is preferred. Ignored if @code{GLX_RGBA} is asserted.
417
418 @item @code{GLX_LEVEL}
419 Must be followed by an integer buffer-level specification. This
420 specification is honored exactly. Buffer level zero corresponds to the
421 main frame buffer of the display. Buffer level one is the first overlay
422 frame buffer, level two the second overlay frame buffer, and so on.
423 Negative buffer levels correspond to underlay frame buffers.
424
425 @item @code{GLX_RGBA}
426 If present, only TrueColor and DirectColor visuals are considered.
427 Otherwise, only PseudoColor and StaticColor visuals are considered.
428
429 @item @code{GLX_DOUBLEBUFFER}
430 If present, only double-buffered visuals are considered. Otherwise, only
431 single-buffered visuals are considered.
432
433 @item @code{GLX_STEREO}
434 If present, only stereo visuals are considered. Otherwise, only
435 monoscopic visuals are considered.
436
437 @item @code{GLX_AUX_BUFFERS}
438 Must be followed by a nonnegative integer that indicates the desired
439 number of auxiliary buffers. Visuals with the smallest number of
440 auxiliary buffers that meets or exceeds the specified number are
441 preferred.
442
443 @item @code{GLX_RED_SIZE}
444 Must be followed by a nonnegative minimum size specification. If this
445 value is zero, the smallest available red buffer is preferred.
446 Otherwise, the largest available red buffer of at least the minimum size
447 is preferred.
448
449 @item @code{GLX_GREEN_SIZE}
450 Must be followed by a nonnegative minimum size specification. If this
451 value is zero, the smallest available green buffer is preferred.
452 Otherwise, the largest available green buffer of at least the minimum
453 size is preferred.
454
455 @item @code{GLX_BLUE_SIZE}
456 Must be followed by a nonnegative minimum size specification. If this
457 value is zero, the smallest available blue buffer is preferred.
458 Otherwise, the largest available blue buffer of at least the minimum
459 size is preferred.
460
461 @item @code{GLX_ALPHA_SIZE}
462 Must be followed by a nonnegative minimum size specification. If this
463 value is zero, the smallest available alpha buffer is preferred.
464 Otherwise, the largest available alpha buffer of at least the minimum
465 size is preferred.
466
467 @item @code{GLX_DEPTH_SIZE}
468 Must be followed by a nonnegative minimum size specification. If this
469 value is zero, visuals with no depth buffer are preferred. Otherwise,
470 the largest available depth buffer of at least the minimum size is
471 preferred.
472
473 @item @code{GLX_STENCIL_SIZE}
474 Must be followed by a nonnegative integer that indicates the desired
475 number of stencil bitplanes. The smallest stencil buffer of at least the
476 specified size is preferred. If the desired value is zero, visuals with
477 no stencil buffer are preferred.
478
479 @item @code{GLX_ACCUM_RED_SIZE}
480 Must be followed by a nonnegative minimum size specification. If this
481 value is zero, visuals with no red accumulation buffer are preferred.
482 Otherwise, the largest possible red accumulation buffer of at least the
483 minimum size is preferred.
484
485 @item @code{GLX_ACCUM_GREEN_SIZE}
486 Must be followed by a nonnegative minimum size specification. If this
487 value is zero, visuals with no green accumulation buffer are preferred.
488 Otherwise, the largest possible green accumulation buffer of at least
489 the minimum size is preferred.
490
491 @item @code{GLX_ACCUM_BLUE_SIZE}
492 Must be followed by a nonnegative minimum size specification. If this
493 value is zero, visuals with no blue accumulation buffer are preferred.
494 Otherwise, the largest possible blue accumulation buffer of at least the
495 minimum size is preferred.
496
497 @item @code{GLX_ACCUM_ALPHA_SIZE}
498 Must be followed by a nonnegative minimum size specification. If this
499 value is zero, visuals with no alpha accumulation buffer are preferred.
500 Otherwise, the largest possible alpha accumulation buffer of at least
501 the minimum size is preferred.
502
503 @end table
504
505 @code{NULL} is returned if an undefined GLX attribute is encountered in
506 @var{attribList}.
507
508 @end deftypefun
509
510 @deftypefun void glXCopyContext dpy src dst mask
511 Copy state from one rendering context to another.
512
513 @table @asis
514 @item @var{dpy}
515 Specifies the connection to the X server.
516
517 @item @var{src}
518 Specifies the source context.
519
520 @item @var{dst}
521 Specifies the destination context.
522
523 @item @var{mask}
524 Specifies which portions of @var{src} state are to be copied to
525 @var{dst}.
526
527 @end table
528
529 @code{glXCopyContext} copies selected groups of state variables from
530 @var{src} to @var{dst}. @var{mask} indicates which groups of state
531 variables are to be copied. @var{mask} contains the bitwise OR of the
532 same symbolic names that are passed to the GL command
533 @code{glPushAttrib}. The single symbolic constant
534 @code{GLX_ALL_ATTRIB_BITS} can be used to copy the maximum possible
535 portion of rendering state.
536
537 The copy can be done only if the renderers named by @var{src} and
538 @var{dst} share an address space. Two rendering contexts share an
539 address space if both are nondirect using the same server, or if both
540 are direct and owned by a single process. Note that in the nondirect
541 case it is not necessary for the calling threads to share an address
542 space, only for their related rendering contexts to share an address
543 space.
544
545 Not all values for GL state can be copied. For example, pixel pack and
546 unpack state, render mode state, and select and feedback state are not
547 copied. The state that can be copied is exactly the state that is
548 manipulated by the GL command @code{glPushAttrib}.
549
550 An implicit @code{glFlush} is done by @code{glXCopyContext} if @var{src}
551 is the current context for the calling thread.
552
553 @code{BadMatch} is generated if rendering contexts @var{src} and
554 @var{dst} do not share an address space or were not created with respect
555 to the same screen.
556
557 @code{BadAccess} is generated if @var{dst} is current to any thread
558 (including the calling thread) at the time @code{glXCopyContext} is
559 called.
560
561 @code{GLXBadCurrentWindow} is generated if @var{src} is the current
562 context and the current drawable is a window that is no longer valid.
563
564 @code{GLXBadContext} is generated if either @var{src} or @var{dst} is
565 not a valid GLX context.
566
567 @end deftypefun
568
569 @deftypefun GLXContext glXCreateContext dpy vis shareList direct
570 Create a new GLX rendering context.
571
572 @table @asis
573 @item @var{dpy}
574 Specifies the connection to the X server.
575
576 @item @var{vis}
577 Specifies the visual that defines the frame buffer resources available
578 to the rendering context. It is a pointer to an @code{XVisualInfo}
579 structure, not a visual ID or a pointer to a @code{Visual}.
580
581 @item @var{shareList}
582 Specifies the context with which to share display lists. @code{NULL}
583 indicates that no sharing is to take place.
584
585 @item @var{direct}
586 Specifies whether rendering is to be done with a direct connection to
587 the graphics system if possible (@code{True}) or through the X server
588 (@code{False}).
589
590 @end table
591
592 @code{glXCreateContext} creates a GLX rendering context and returns its
593 handle. This context can be used to render into both windows and GLX
594 pixmaps. If @code{glXCreateContext} fails to create a rendering context,
595 @code{NULL} is returned.
596
597 If @var{direct} is @code{True}, then a direct rendering context is
598 created if the implementation supports direct rendering, if the
599 connection is to an X server that is local, and if a direct rendering
600 context is available. (An implementation may return an indirect context
601 when @var{direct} is @code{True}.) If @var{direct} is @code{False}, then
602 a rendering context that renders through the X server is always created.
603 Direct rendering provides a performance advantage in some
604 implementations. However, direct rendering contexts cannot be shared
605 outside a single process, and they may be unable to render to GLX
606 pixmaps.
607
608 If @var{shareList} is not @code{NULL}, then all display-list indexes and
609 definitions are shared by context @var{shareList} and by the newly
610 created context. An arbitrary number of contexts can share a single
611 display-list space. However, all rendering contexts that share a single
612 display-list space must themselves exist in the same address space. Two
613 rendering contexts share an address space if both are nondirect using
614 the same server, or if both are direct and owned by a single process.
615 Note that in the nondirect case, it is not necessary for the calling
616 threads to share an address space, only for their related rendering
617 contexts to share an address space.
618
619 If the GL version is 1.1 or greater, then all texture objects except
620 object 0 are shared by any contexts that share display lists.
621
622 @code{NULL} is returned if execution fails on the client side.
623
624 @code{BadMatch} is generated if the context to be created would not
625 share the address space or the screen of the context specified by
626 @var{shareList}.
627
628 @code{BadValue} is generated if @var{vis} is not a valid visual (for
629 example, if a particular GLX implementation does not support it).
630
631 @code{GLXBadContext} is generated if @var{shareList} is not a GLX
632 context and is not @code{NULL}.
633
634 @code{BadAlloc} is generated if the server does not have enough
635 resources to allocate the new context.
636
637 @end deftypefun
638
639 @deftypefun GLXPixmap glXCreateGLXPixmap dpy vis pixmap
640 Create an off-screen GLX rendering area.
641
642 @table @asis
643 @item @var{dpy}
644 Specifies the connection to the X server.
645
646 @item @var{vis}
647 Specifies the visual that defines the structure of the rendering area.
648 It is a pointer to an @code{XVisualInfo} structure, not a visual ID or a
649 pointer to a @code{Visual}.
650
651 @item @var{pixmap}
652 Specifies the X pixmap that will be used as the front left color buffer
653 of the off-screen rendering area.
654
655 @end table
656
657 @code{glXCreateGLXPixmap} creates an off-screen rendering area and
658 returns its XID. Any GLX rendering context that was created with respect
659 to @var{vis} can be used to render into this off-screen area. Use
660 @code{glXMakeCurrent} to associate the rendering area with a GLX
661 rendering context.
662
663 The X pixmap identified by @var{pixmap} is used as the front left buffer
664 of the resulting off-screen rendering area. All other buffers specified
665 by @var{vis}, including color buffers other than the front left buffer,
666 are created without externally visible names. GLX pixmaps with
667 double-buffering are supported. However, @code{glXSwapBuffers} is
668 ignored by these pixmaps.
669
670 Some implementations may not support GLX pixmaps with direct rendering
671 contexts.
672
673 @code{BadMatch} is generated if the depth of @var{pixmap} does not match
674 the depth value reported by core X11 for @var{vis}, or if @var{pixmap}
675 was not created with respect to the same screen as @var{vis}.
676
677 @code{BadValue} is generated if @var{vis} is not a valid XVisualInfo
678 pointer (for example, if a particular GLX implementation does not
679 support this visual).
680
681 @code{BadPixmap} is generated if @var{pixmap} is not a valid pixmap.
682
683 @code{BadAlloc} is generated if the server cannot allocate the GLX
684 pixmap.
685
686 @end deftypefun
687
688 @deftypefun GLXContext glXCreateNewContext dpy config render_type share_list direct
689 Create a new GLX rendering context.
690
691 @table @asis
692 @item @var{dpy}
693 Specifies the connection to the X server.
694
695 @item @var{config}
696 Specifies the GLXFBConfig structure with the desired attributes for the
697 context.
698
699 @item @var{render_type}
700 Specifies the type of the context to be created. Must be one of
701 @code{GLX_RGBA_TYPE} or @code{GLX_COLOR_INDEX_TYPE}.
702
703 @item @var{share_list}
704 Specifies the context with which to share display lists. @code{NULL}
705 indicates that no sharing is to take place.
706
707 @item @var{share_list}
708 Specifies whether rendering is to be done with a direct connection to
709 the graphics system if possible (@code{True}) or through the X server
710 (@code{False}).
711
712 @end table
713
714 @code{glXCreateNewContext} creates a GLX rendering context and returns
715 its handle. This context can be used to render into GLX windows,
716 pixmaps, or pixel buffers. If @code{glXCreateNewContext} fails to create
717 a rendering context, @code{NULL} is returned.
718
719 If @var{render_type} is @code{GLX_RGBA_TYPE}, then a context that
720 supports RGBA rendering is created. If @var{config} is
721 @code{GLX_COLOR_INDEX_TYPE}, then context supporting color-index
722 rendering is created.
723
724 If @var{render_type} is not @code{NULL}, then all display-list indexes
725 and definitions are shared by context @var{render_type} and by the newly
726 created context. An arbitrary number of contexts can share a single
727 display-list space. However, all rendering contexts that share a single
728 display-list space must themselves exist in the same address space. Two
729 rendering contexts share an address space if both are nondirect using
730 the same server, or if both are direct and owned by a single process.
731 Note that in the nondirect case, it is not necessary for the calling
732 threads to share an address space, only for their related rendering
733 contexts to share an address space.
734
735 If @var{share_list} is @code{True}, then a direct-rendering context is
736 created if the implementation supports direct rendering, if the
737 connection is to an X server that is local, and if a direct-rendering
738 context is available. (An implementation may return an indirect context
739 when @var{share_list} is @code{True}.) If @var{share_list} is
740 @code{False}, then a rendering context that renders through the X server
741 is always created. Direct rendering provides a performance advantage in
742 some implementations. However, direct-rendering contexts cannot be
743 shared outside a single process, and they may be unable to render to GLX
744 pixmaps.
745
746 @code{NULL} is returned if execution fails on the client side.
747
748 @code{GLXBadContext} is generated if @var{render_type} is not a GLX
749 context and is not @code{NULL}.
750
751 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
752 GLXFBConfig.
753
754 @code{BadMatch} is generated if the context to be created would not
755 share the address space or the screen of the context specified by
756 @var{render_type}.
757
758 @code{BadAlloc} is generated if the server does not have enough
759 resources to allocate the new context.
760
761 @code{BadValue} is generated if @var{config} is not a valid visual (for
762 example, if a particular GLX implementation does not support it).
763
764 @end deftypefun
765
766 @deftypefun GLXPbuffer glXCreatePbuffer dpy config attrib_list
767 Create an off-screen rendering area.
768
769 @table @asis
770 @item @var{dpy}
771 Specifies the connection to the X server.
772
773 @item @var{config}
774 Specifies a GLXFBConfig structure with the desired attributes for the
775 window.
776
777 @item @var{attrib_list}
778 Specifies a list of attribute value pairs, which must be terminated with
779 @code{None} or @code{NULL}. Accepted attributes are
780 @code{GLX_PBUFFER_WIDTH}, @code{GLX_PBUFFER_HEIGHT},
781 @code{GLX_PRESERVED_CONTENTS}, and @code{GLX_LARGEST_PBUFFER}.
782
783 @end table
784
785 @code{glXCreatePbuffer} creates an off-screen rendering area and returns
786 its XID. Any GLX rendering context that was created with respect to
787 @var{config} can be used to render into this window. Use
788 @code{glXMakeContextCurrent} to associate the rendering area with a GLX
789 rendering context.
790
791 The accepted attributes for a GLXPbuffer are:
792
793 @table @asis
794 @item @code{GLX_PBUFFER_WIDTH}
795 Specify the pixel width of the requested GLXPbuffer. The default value
796 is 0.
797
798 @item @code{GLX_PBUFFER_HEIGHT}
799 Specify the pixel height of the requested GLXPbuffer. The default value
800 is 0.
801
802 @item @code{GLX_LARGEST_PBUFFER}
803 Specify to obtain the largest available pixel buffer, if the requested
804 allocation would have failed. The width and height of the allocated
805 pixel buffer will never exceed the specified @code{GLX_PBUFFER_WIDTH} or
806 @code{GLX_PBUFFER_HEIGHT}, respectively. Use @code{glXQueryDrawable} to
807 retrieve the dimensions of the allocated pixel buffer. The default value
808 is @code{False}.
809
810 @item @code{GLX_PRESERVED_CONTENTS}
811 Specify if the contents of the pixel buffer should be preserved when a
812 resource conflict occurs. If set to @code{False}, the contents of the
813 pixel buffer may be lost at any time. If set to @code{True}, or not
814 specified in @var{attrib_list}, then the contents of the pixel buffer
815 will be preserved (most likely by copying the contents into main system
816 memory from the frame buffer). In either case, the client can register
817 (using @code{glXSelectEvent}, to receive pixel buffer clobber events
818 that are generated when the pbuffer contents have been preserved or
819 damaged.
820
821 @end table
822
823 GLXPbuffers contain the color and ancillary buffers specified by
824 @var{config}. It is possible to create a pixel buffer with back buffers
825 and to swap those buffers using @code{glXSwapBuffers}.
826
827 @code{BadAlloc} is generated if there are insufficient resources to
828 allocate the requested GLXPbuffer.
829
830 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
831 GLXFBConfig.
832
833 @code{BadMatch} is generated if @var{config} does not support rendering
834 to pixel buffers (e.g., @code{GLX_DRAWABLE_TYPE} does not contain
835 @code{GLX_PBUFFER_BIT}).
836
837 @end deftypefun
838
839 @deftypefun GLXPixmap glXCreatePixmap dpy config pixmap attrib_list
840 Create an off-screen rendering area.
841
842 @table @asis
843 @item @var{dpy}
844 Specifies the connection to the X server.
845
846 @item @var{config}
847 Specifies a GLXFBConfig structure with the desired attributes for the
848 window.
849
850 @item @var{pixmap}
851 Specifies the X pixmap to be used as the rendering area.
852
853 @item @var{attrib_list}
854 Currently unused. This must be set to @code{NULL} or be an empty list
855 (i.e., one in which the first element is @code{None}).
856
857 @end table
858
859 @code{glXCreatePixmap} creates an off-screen rendering area and returns
860 its XID. Any GLX rendering context that was created with respect to
861 @var{config} can be used to render into this window. Use
862 @code{glXMakeCurrent} to associate the rendering area with a GLX
863 rendering context.
864
865 @code{BadMatch} is generated if @var{pixmap} was not created with a
866 visual that corresponds to @var{config}.
867
868 @code{BadMatch} is generated if @var{config} does not support rendering
869 to windows (e.g., @code{GLX_DRAWABLE_TYPE} does not contain
870 @code{GLX_WINDOW_BIT}).
871
872 @code{BadWindow} is generated if @var{pixmap} is not a valid window XID.
873 @code{BadAlloc} is generated if there is already a GLXFBConfig
874 associated with @var{pixmap}.
875
876 @code{BadAlloc} is generated if the X server cannot allocate a new GLX
877 window.
878
879 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
880 GLXFBConfig.
881
882
883
884 @end deftypefun
885
886 @deftypefun GLXWindow glXCreateWindow dpy config win attrib_list
887 Create an on-screen rendering area.
888
889 @table @asis
890 @item @var{dpy}
891 Specifies the connection to the X server.
892
893 @item @var{config}
894 Specifies a GLXFBConfig structure with the desired attributes for the
895 window.
896
897 @item @var{win}
898 Specifies the X window to be used as the rendering area.
899
900 @item @var{attrib_list}
901 Currently unused. This must be set to @code{NULL} or be an empty list
902 (i.e., one in which the first element is @code{None}).
903
904 @end table
905
906 @code{glXCreateWindow} creates an on-screen rendering area from an
907 existing X window that was created with a visual matching @var{config}.
908 The XID of the GLXWindow is returned. Any GLX rendering context that was
909 created with respect to @var{config} can be used to render into this
910 window. Use @code{glXMakeContextCurrent} to associate the rendering area
911 with a GLX rendering context.
912
913 @code{BadMatch} is generated if @var{win} was not created with a visual
914 that corresponds to @var{config}.
915
916 @code{BadMatch} is generated if @var{config} does not support rendering
917 to windows (i.e., @code{GLX_DRAWABLE_TYPE} does not contain
918 @code{GLX_WINDOW_BIT}).
919
920 @code{BadWindow} is generated if @var{win} is not a valid pixmap XID.
921
922 @code{BadAlloc} is generated if there is already a GLXFBConfig
923 associated with @var{win}.
924
925 @code{BadAlloc} is generated if the X server cannot allocate a new GLX
926 window.
927
928 @code{GLXBadFBConfig} is generated if @var{config} is not a valid
929 GLXFBConfig.
930
931
932
933 @end deftypefun
934
935 @deftypefun void glXDestroyContext dpy ctx
936 Destroy a GLX context.
937
938 @table @asis
939 @item @var{dpy}
940 Specifies the connection to the X server.
941
942 @item @var{ctx}
943 Specifies the GLX context to be destroyed.
944
945 @end table
946
947 If the GLX rendering context @var{ctx} is not current to any thread,
948 @code{glXDestroyContext} destroys it immediately. Otherwise, @var{ctx}
949 is destroyed when it becomes not current to any thread. In either case,
950 the resource ID referenced by @var{ctx} is freed immediately.
951
952 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
953 context.
954
955 @end deftypefun
956
957 @deftypefun void glXDestroyGLXPixmap dpy pix
958 Destroy a GLX pixmap.
959
960 @table @asis
961 @item @var{dpy}
962 Specifies the connection to the X server.
963
964 @item @var{pix}
965 Specifies the GLX pixmap to be destroyed.
966
967 @end table
968
969 If the GLX pixmap @var{pix} is not current to any client,
970 @code{glXDestroyGLXPixmap} destroys it immediately. Otherwise, @var{pix}
971 is destroyed when it becomes not current to any client. In either case,
972 the resource ID is freed immediately.
973
974 @code{GLXBadPixmap} is generated if @var{pix} is not a valid GLX pixmap.
975
976 @end deftypefun
977
978 @deftypefun void glXDestroyPbuffer dpy pbuf
979 Destroy an off-screen rendering area.
980
981 @table @asis
982 @item @var{dpy}
983 Specifies the connection to the X server.
984
985 @item @var{pbuf}
986 Specifies the GLXPbuffer to be destroyed.
987
988 @end table
989
990 @code{glXDestroyPbuffer} destroys a GLXPbuffer created by
991 @code{glXCreatePbuffer}.
992
993 @code{GLXBadPbuffer} is generated if @var{pbuf} is not a valid
994 GLXPbuffer.
995
996 @end deftypefun
997
998 @deftypefun void glXDestroyPixmap dpy pixmap
999 Destroy an off-screen rendering area.
1000
1001 @table @asis
1002 @item @var{dpy}
1003 Specifies the connection to the X server.
1004
1005 @item @var{pixmap}
1006 Specifies the GLXPixmap to be destroyed.
1007
1008 @end table
1009
1010 @code{glXDestroyPixmap} destroys a GLXPixmap created by
1011 @code{glXCreatePixmap}.
1012
1013 @code{GLXBadPixmap} is generated if @var{pixmap} is not a valid
1014 GLXPixmap.
1015
1016 @end deftypefun
1017
1018 @deftypefun void glXDestroyWindow dpy win
1019 Destroy an on-screen rendering area.
1020
1021 @table @asis
1022 @item @var{dpy}
1023 Specifies the connection to the X server.
1024
1025 @item @var{win}
1026 Specifies the GLXWindow to be destroyed.
1027
1028 @end table
1029
1030 @code{glXDestroyWindow} destroys a GLXWindow created by
1031 @code{glXCreateWindow}.
1032
1033 @code{GLXBadWindow} is generated if @var{win} is not a valid GLXPixmap.
1034
1035 @end deftypefun
1036
1037 @deftypefun void glXFreeContextEXT dpy ctx
1038 Free client-side memory for imported context.
1039
1040 @table @asis
1041 @item @var{dpy}
1042 Specifies the connection to the X server.
1043
1044 @item @var{ctx}
1045 Specifies a GLX rendering context.
1046
1047 @end table
1048
1049 @code{glXFreeContextEXT} frees the client-side part of a GLXContext that
1050 was created with @code{glXImportContextEXT}. @code{glXFreeContextEXT}
1051 does not free the server-side context information or the XID associated
1052 with the server-side context.
1053
1054 @code{glXFreeContextEXT} is part of the @code{EXT_import_context}
1055 extension, not part of the core GLX command set. If
1056 _glxextstring(EXT_import_context) is included in the string returned by
1057 @code{glXQueryExtensionsString}, when called with argument
1058 @code{GLX_EXTENSIONS}, extension @code{EXT_vertex_array} is supported.
1059
1060 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1061 context.
1062
1063 @end deftypefun
1064
1065 @deftypefun const-char-* glXGetClientString dpy name
1066 Return a string describing the client.
1067
1068 @table @asis
1069 @item @var{dpy}
1070 Specifies the connection to the X server.
1071
1072 @item @var{name}
1073 Specifies which string is returned. The symbolic constants
1074 @code{GLX_VENDOR}, @code{GLX_VERSION}, and @code{GLX_EXTENSIONS} are
1075 accepted.
1076
1077 @end table
1078
1079 @code{glXGetClientString} returns a string describing some aspect of the
1080 client library. The possible values for @var{name} are
1081 @code{GLX_VENDOR}, @code{GLX_VERSION}, and @code{GLX_EXTENSIONS}. If
1082 @var{name} is not set to one of these values, @code{glXGetClientString}
1083 returns @code{NULL}. The format and contents of the vendor string is
1084 implementation dependent.
1085
1086 The extensions string is null-terminated and contains a space-separated
1087 list of extension names. (The extension names never contain spaces.) If
1088 there are no extensions to GLX, then the empty string is returned.
1089
1090 The version string is laid out as follows:
1091
1092 <major_version.minor_version><space><vendor-specific info>
1093
1094 Both the major and minor portions of the version number are of arbitrary
1095 length. The vendor-specific information is optional. However, if it is
1096 present, the format and contents are implementation specific.
1097
1098 @end deftypefun
1099
1100 @deftypefun int glXGetConfig dpy vis attrib value
1101 Return information about GLX visuals.
1102
1103 @table @asis
1104 @item @var{dpy}
1105 Specifies the connection to the X server.
1106
1107 @item @var{vis}
1108 Specifies the visual to be queried. It is a pointer to an
1109 @code{XVisualInfo} structure, not a visual ID or a pointer to a
1110 @code{Visual}.
1111
1112 @item @var{attrib}
1113 Specifies the visual attribute to be returned.
1114
1115 @item @var{value}
1116 Returns the requested value.
1117
1118 @end table
1119
1120 @code{glXGetConfig} sets @var{value} to the @var{attrib} value of
1121 windows or GLX pixmaps created with respect to @var{vis}.
1122 @code{glXGetConfig} returns an error code if it fails for any reason.
1123 Otherwise, zero is returned.
1124
1125 @var{attrib} is one of the following:
1126
1127
1128
1129 @table @asis
1130 @item @code{GLX_USE_GL}
1131 @code{True} if OpenGL rendering is supported by this visual,
1132 @code{False} otherwise.
1133
1134 @item @code{GLX_BUFFER_SIZE}
1135 Number of bits per color buffer. For RGBA visuals,
1136 @code{GLX_BUFFER_SIZE} is the sum of @code{GLX_RED_SIZE},
1137 @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, and @code{GLX_ALPHA_SIZE}.
1138 For color index visuals, @code{GLX_BUFFER_SIZE} is the size of the color
1139 indexes.
1140
1141 @item @code{GLX_LEVEL}
1142 Frame buffer level of the visual. Level zero is the default frame
1143 buffer. Positive levels correspond to frame buffers that overlay the
1144 default buffer, and negative levels correspond to frame buffers that
1145 underlay the default buffer.
1146
1147 @item @code{GLX_RGBA}
1148 @code{True} if color buffers store red, green, blue, and alpha values.
1149 @code{False} if they store color indexes.
1150
1151 @item @code{GLX_DOUBLEBUFFER}
1152 @code{True} if color buffers exist in front/back pairs that can be
1153 swapped, @code{False} otherwise.
1154
1155 @item @code{GLX_STEREO}
1156 @code{True} if color buffers exist in left/right pairs, @code{False}
1157 otherwise.
1158
1159 @item @code{GLX_AUX_BUFFERS}
1160 Number of auxiliary color buffers that are available. Zero indicates
1161 that no auxiliary color buffers exist.
1162
1163 @item @code{GLX_RED_SIZE}
1164 Number of bits of red stored in each color buffer. Undefined if
1165 @code{GLX_RGBA} is @code{False}.
1166
1167 @item @code{GLX_GREEN_SIZE}
1168 Number of bits of green stored in each color buffer. Undefined if
1169 @code{GLX_RGBA} is @code{False}.
1170
1171 @item @code{GLX_BLUE_SIZE}
1172 Number of bits of blue stored in each color buffer. Undefined if
1173 @code{GLX_RGBA} is @code{False}.
1174
1175 @item @code{GLX_ALPHA_SIZE}
1176 Number of bits of alpha stored in each color buffer. Undefined if
1177 @code{GLX_RGBA} is @code{False}.
1178
1179 @item @code{GLX_DEPTH_SIZE}
1180 Number of bits in the depth buffer.
1181
1182 @item @code{GLX_STENCIL_SIZE}
1183 Number of bits in the stencil buffer.
1184
1185 @item @code{GLX_ACCUM_RED_SIZE}
1186 Number of bits of red stored in the accumulation buffer.
1187
1188 @item @code{GLX_ACCUM_GREEN_SIZE}
1189 Number of bits of green stored in the accumulation buffer.
1190
1191 @item @code{GLX_ACCUM_BLUE_SIZE}
1192 Number of bits of blue stored in the accumulation buffer.
1193
1194 @item @code{GLX_ACCUM_ALPHA_SIZE}
1195 Number of bits of alpha stored in the accumulation buffer.
1196
1197 @end table
1198
1199 The X protocol allows a single visual ID to be instantiated with
1200 different numbers of bits per pixel. Windows or GLX pixmaps that will be
1201 rendered with OpenGL, however, must be instantiated with a color buffer
1202 depth of @code{GLX_BUFFER_SIZE}.
1203
1204 Although a GLX implementation can export many visuals that support GL
1205 rendering, it must support at least one RGBA visual. This visual must
1206 have at least one color buffer, a stencil buffer of at least 1 bit, a
1207 depth buffer of at least 12 bits, and an accumulation buffer. Alpha
1208 bitplanes are optional in this visual. However, its color buffer size
1209 must be as great as that of the deepest @code{TrueColor},
1210 @code{DirectColor}, @code{PseudoColor}, or @code{StaticColor} visual
1211 supported on level zero, and it must itself be made available on level
1212 zero.
1213
1214 In addition, if the X server exports a @code{PseudoColor} or
1215 @code{StaticColor} visual on framebuffer level 0, a color index visual
1216 is also required on that level. It must have at least one color buffer,
1217 a stencil buffer of at least 1 bit, and a depth buffer of at least 12
1218 bits. This visual must have as many color bitplanes as the deepest
1219 @code{PseudoColor} or @code{StaticColor} visual supported on level 0.
1220
1221 Applications are best written to select the visual that most closely
1222 meets their requirements. Creating windows or GLX pixmaps with
1223 unnecessary buffers can result in reduced rendering performance as well
1224 as poor resource allocation.
1225
1226 @code{GLX_NO_EXTENSION} is returned if @var{dpy} does not support the
1227 GLX extension.
1228
1229 @code{GLX_BAD_SCREEN} is returned if the screen of @var{vis} does not
1230 correspond to a screen.
1231
1232 @code{GLX_BAD_ATTRIBUTE} is returned if @var{attrib} is not a valid GLX
1233 attribute.
1234
1235 @code{GLX_BAD_VISUAL} is returned if @var{vis} doesn't support GLX and
1236 an attribute other than @code{GLX_USE_GL} is requested.
1237
1238 @end deftypefun
1239
1240 @deftypefun GLXContextID glXGetContextIDEXT ctx
1241 Get the XID for a context..
1242
1243 @table @asis
1244 @item @var{ctx}
1245 Specifies a GLX rendering context.
1246
1247 @end table
1248
1249 @code{glXGetContextIDEXT} returns the XID associated with a GLXContext.
1250
1251 No round trip is forced to the server; unlike most X calls that return a
1252 value, @code{glXGetContextIDEXT} does not flush any pending events.
1253
1254 @code{glXGetContextIDEXT} is part of the @code{EXT_import_context}
1255 extension, not part of the core GLX command set. If
1256 _glxextstring(EXT_import_context) is included in the string returned by
1257 @code{glXQueryExtensionsString}, when called with argument
1258 @code{GLX_EXTENSIONS}, extension @code{EXT_import_context} is supported.
1259
1260 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1261 context.
1262
1263 @end deftypefun
1264
1265 @deftypefun GLXContext glXGetCurrentContext
1266 Return the current context.
1267
1268 @code{glXGetCurrentContext} returns the current context, as specified by
1269 @code{glXMakeCurrent}. If there is no current context, @code{NULL} is
1270 returned.
1271
1272 @code{glXGetCurrentContext} returns client-side information. It does not
1273 make a round trip to the server.
1274
1275
1276
1277 @end deftypefun
1278
1279 @deftypefun Display-* glXGetCurrentDisplay
1280 Get display for current context.
1281
1282 @code{glXGetCurrentDisplay} returns the display for the current context.
1283 If no context is current, @code{NULL} is returned.
1284
1285 @code{glXGetCurrentDisplay} returns client-side information. It does not
1286 make a round-trip to the server, and therefore does not flush any
1287 pending events.
1288
1289 @end deftypefun
1290
1291 @deftypefun GLXDrawable glXGetCurrentDrawable
1292 Return the current drawable.
1293
1294 @code{glXGetCurrentDrawable} returns the current drawable, as specified
1295 by @code{glXMakeCurrent}. If there is no current drawable, @code{None}
1296 is returned.
1297
1298 @code{glXGetCurrentDrawable} returns client-side information. It does
1299 not make a round trip to the server.
1300
1301 @end deftypefun
1302
1303 @deftypefun GLXDrawable glXGetCurrentReadDrawable
1304 Return the current drawable.
1305
1306 @code{glXGetCurrentReadDrawable} returns the current read drawable, as
1307 specified by @code{read} parameter of @code{glXMakeContextCurrent}. If
1308 there is no current drawable, @code{None} is returned.
1309
1310 @code{glXGetCurrentReadDrawable} returns client-side information. It
1311 does not make a round-trip to the server.
1312
1313 @end deftypefun
1314
1315 @deftypefun int glXGetFBConfigAttrib dpy config attribute value
1316 Return information about a GLX frame buffer configuration.
1317
1318 @table @asis
1319 @item @var{dpy}
1320 Specifies the connection to the X server.
1321
1322 @item @var{config}
1323 Specifies the GLX frame buffer configuration to be queried.
1324
1325 @item @var{attribute}
1326 Specifies the attribute to be returned.
1327
1328 @item @var{value}
1329 Returns the requested value.
1330
1331 @end table
1332
1333 @code{glXGetFBConfigAttrib} sets @var{value} to the @var{attribute}
1334 value of GLX drawables created with respect to @var{config}.
1335 @code{glXGetFBConfigAttrib} returns an error code if it fails for any
1336 reason. Otherwise, @code{Success} is returned.
1337
1338 @var{attribute} is one of the following:
1339
1340
1341
1342 @table @asis
1343 @item @code{GLX_FBCONFIG_ID}
1344 XID of the given GLXFBConfig.
1345
1346 @item @code{GLX_BUFFER_SIZE}
1347
1348
1349 Number of bits per color buffer. If the frame buffer configuration
1350 supports RGBA contexts, then @code{GLX_BUFFER_SIZE} is the sum of
1351 @code{GLX_RED_SIZE}, @code{GLX_GREEN_SIZE}, @code{GLX_BLUE_SIZE}, and
1352 @code{GLX_ALPHA_SIZE}. If the frame buffer configuration supports only
1353 color index contexts, @code{GLX_BUFFER_SIZE} is the size of the color
1354 indexes.
1355
1356 @item @code{GLX_LEVEL}
1357
1358
1359 Frame buffer level of the configuration. Level zero is the default frame
1360 buffer. Positive levels correspond to frame buffers that overlay the
1361 default buffer, and negative levels correspond to frame buffers that
1362 underlie the default buffer.
1363
1364 @item @code{GLX_DOUBLEBUFFER}
1365
1366
1367 @code{True} if color buffers exist in front/back pairs that can be
1368 swapped, @code{False} otherwise.
1369
1370 @item @code{GLX_STEREO}
1371
1372
1373 @code{True} if color buffers exist in left/right pairs, @code{False}
1374 otherwise.
1375
1376 @item @code{GLX_AUX_BUFFERS}
1377
1378
1379 Number of auxiliary color buffers that are available. Zero indicates
1380 that no auxiliary color buffers exist.
1381
1382 @item @code{GLX_RED_SIZE}
1383
1384
1385 Number of bits of red stored in each color buffer. Undefined if RGBA
1386 contexts are not supported by the frame buffer configuration.
1387
1388 @item @code{GLX_GREEN_SIZE}
1389
1390
1391 Number of bits of green stored in each color buffer. Undefined if RGBA
1392 contexts are not supported by the frame buffer configuration.
1393
1394 @item @code{GLX_BLUE_SIZE}
1395
1396
1397 Number of bits of blue stored in each color buffer. Undefined if RGBA
1398 contexts are not supported by the frame buffer configuration.
1399
1400 @item @code{GLX_ALPHA_SIZE}
1401
1402
1403 Number of bits of alpha stored in each color buffer. Undefined if RGBA
1404 contexts are not supported by the frame buffer configuration.
1405
1406 @item @code{GLX_DEPTH_SIZE}
1407
1408
1409 Number of bits in the depth buffer.
1410
1411 @item @code{GLX_STENCIL_SIZE}
1412
1413
1414 Number of bits in the stencil buffer.
1415
1416 @item @code{GLX_ACCUM_RED_SIZE}
1417
1418
1419 Number of bits of red stored in the accumulation buffer.
1420
1421 @item @code{GLX_ACCUM_GREEN_SIZE}
1422
1423
1424 Number of bits of green stored in the accumulation buffer.
1425
1426 @item @code{GLX_ACCUM_BLUE_SIZE}
1427
1428
1429 Number of bits of blue stored in the accumulation buffer.
1430
1431 @item @code{GLX_ACCUM_ALPHA_SIZE}
1432
1433
1434 Number of bits of alpha stored in the accumulation buffer.
1435
1436 @item @code{GLX_RENDER_TYPE}
1437
1438
1439 Mask indicating what type of GLX contexts can be made current to the
1440 frame buffer configuration. Valid bits are @code{GLX_RGBA_BIT} and
1441 @code{GLX_COLOR_INDEX_BIT}.
1442
1443 @item @code{GLX_DRAWABLE_TYPE}
1444
1445
1446 Mask indicating what drawable types the frame buffer configuration
1447 supports. Valid bits are @code{GLX_WINDOW_BIT}, @code{GLX_PIXMAP_BIT},
1448 and @code{GLX_PBUFFER_BIT}.
1449
1450 @item @code{GLX_X_RENDERABLE}
1451
1452
1453 @code{True} if drawables created with the frame buffer configuration can
1454 be rendered to by X.
1455
1456 @item @code{GLX_VISUAL_ID}
1457
1458
1459 XID of the corresponding visual, or zero if there is no associated
1460 visual (i.e., if @code{GLX_X_RENDERABLE} is @code{False} or
1461 @code{GLX_DRAWABLE_TYPE} does not have the @code{GLX_WINDOW_BIT} bit
1462 set).
1463
1464 @item @code{GLX_X_VISUAL_TYPE}
1465
1466
1467 Visual type of associated visual. The returned value will be one of:
1468 @code{GLX_TRUE_COLOR}, @code{GLX_DIRECT_COLOR}, @code{GLX_PSEUDO_COLOR},
1469 @code{GLX_STATIC_COLOR}, @code{GLX_GRAY_SCALE}, @code{GLX_STATIC_GRAY},
1470 or @code{GLX_NONE}, if there is no associated visual (i.e., if
1471 @code{GLX_X_RENDERABLE} is @code{False} or @code{GLX_DRAWABLE_TYPE} does
1472 not have the @code{GLX_WINDOW_BIT} bit set).
1473
1474 @item @code{GLX_CONFIG_CAVEAT}
1475
1476
1477 One of @code{GLX_NONE}, @code{GLX_SLOW_CONFIG}, or
1478 @code{GLX_NON_CONFORMANT_CONFIG}, indicating that the frame buffer
1479 configuration has no caveats, some aspect of the frame buffer
1480 configuration runs slower than other frame buffer configurations, or
1481 some aspect of the frame buffer configuration is nonconformant,
1482 respectively.
1483
1484 @item @code{GLX_TRANSPARENT_TYPE}
1485
1486
1487 One of @code{GLX_NONE}, @code{GLX_TRANSPARENT_RGB},
1488 @code{GLX_TRANSPARENT_INDEX}, indicating that the frame buffer
1489 configuration is opaque, is transparent for particular values of red,
1490 green, and blue, or is transparent for particular index values,
1491 respectively.
1492
1493 @item @code{GLX_TRANSPARENT_INDEX_VALUE}
1494
1495
1496 Integer value between 0 and the maximum frame buffer value for indices,
1497 indicating the transparent index value for the frame buffer
1498 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1499 @code{GLX_TRANSPARENT_INDEX}.
1500
1501 @item @code{GLX_TRANSPARENT_RED_VALUE}
1502
1503
1504 Integer value between 0 and the maximum frame buffer value for red,
1505 indicating the transparent red value for the frame buffer configuration.
1506 Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1507 @code{GLX_TRANSPARENT_RGB}.
1508
1509 @item @code{GLX_TRANSPARENT_GREEN_VALUE}
1510
1511
1512 Integer value between 0 and the maximum frame buffer value for green,
1513 indicating the transparent green value for the frame buffer
1514 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1515 @code{GLX_TRANSPARENT_RGB}.
1516
1517 @item @code{GLX_TRANSPARENT_BLUE_VALUE}
1518
1519
1520 Integer value between 0 and the maximum frame buffer value for blue,
1521 indicating the transparent blue value for the frame buffer
1522 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1523 @code{GLX_TRANSPARENT_RGB}.
1524
1525 @item @code{GLX_TRANSPARENT_ALPHA_VALUE}
1526
1527
1528 Integer value between 0 and the maximum frame buffer value for alpha,
1529 indicating the transparent blue value for the frame buffer
1530 configuration. Undefined if @code{GLX_TRANSPARENT_TYPE} is not
1531 @code{GLX_TRANSPARENT_RGB}.
1532
1533 @item @code{GLX_MAX_PBUFFER_WIDTH}
1534
1535
1536 The maximum width that can be specified to @code{glXCreatePbuffer}.
1537
1538 @item @code{GLX_MAX_PBUFFER_HEIGHT}
1539
1540
1541 The maximum height that can be specified to @code{glXCreatePbuffer}.
1542
1543 @item @code{GLX_MAX_PBUFFER_PIXELS}
1544
1545
1546 The maximum number of pixels (width times height) for a pixel buffer.
1547 Note that this value may be less than @code{GLX_MAX_PBUFFER_WIDTH} times
1548 @code{GLX_MAX_PBUFFER_HEIGHT}. Also, this value is static and assumes
1549 that no other pixel buffers or X resources are contending for the frame
1550 buffer memory. As a result, it may not be possible to allocate a pixel
1551 buffer of the size given by @code{GLX_MAX_PBUFFER_PIXELS}.
1552
1553 @end table
1554
1555 Applications should choose the frame buffer configuration that most
1556 closely meets their requirements. Creating windows, GLX pixmaps, or GLX
1557 pixel buffers with unnecessary buffers can result in reduced rendering
1558 performance as well as poor resource allocation.
1559
1560 @code{GLX_NO_EXTENSION} is returned if @var{dpy} does not support the
1561 GLX extension. @code{GLX_BAD_ATTRIBUTE} is returned if @var{attribute}
1562 is not a valid GLX attribute.
1563
1564 @end deftypefun
1565
1566 @deftypefun GLXFBConfig-* glXGetFBConfigs dpy screen nelements
1567 List all GLX frame buffer configurations for a given screen.
1568
1569 @table @asis
1570 @item @var{dpy}
1571 Specifies the connection to the X server.
1572
1573 @item @var{screen}
1574 Specifies the screen number.
1575
1576 @item @var{nelements}
1577 Returns the number of GLXFBConfigs returned.
1578
1579 @end table
1580
1581 @code{glXGetFBConfigs} returns a list of all GLXFBConfigs available on
1582 the screen specified by @var{screen}. Use @code{glXGetFBConfigAttrib} to
1583 obtain attribute values from a specific GLXFBConfig.
1584
1585 @end deftypefun
1586
1587 @deftypefun void(*)() glXGetProcAddress procName
1588 Obtain a pointer to an OpenGL or GLX function.
1589
1590 @table @asis
1591 @item @var{procName}
1592 Specifies the name of the OpenGL or GLX function whose address is to be
1593 returned.
1594
1595 @end table
1596
1597 @code{glXGetProcAddress} returns the address of the function specified
1598 in @var{procName}. This is necessary in environments where the OpenGL
1599 link library exports a different set of functions than the runtime
1600 library.
1601
1602 @end deftypefun
1603
1604 @deftypefun void glXGetSelectedEvent dpy draw event_mask
1605 Returns GLX events that are selected for a window or a GLX pixel buffer.
1606
1607 @table @asis
1608 @item @var{dpy}
1609 Specifies the connection to the X server.
1610
1611 @item @var{draw}
1612 Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
1613
1614 @item @var{event_mask}
1615 Returns the events that are selected for @var{draw}.
1616
1617 @end table
1618
1619 @code{glXGetSelectedEvent} returns in @var{event_mask} the events
1620 selected for @var{draw}.
1621
1622 @code{GLXBadDrawable} is generated if @var{draw} is not a valid window
1623 or a valid GLX pixel buffer.
1624
1625 @end deftypefun
1626
1627 @deftypefun XVisualInfo-* glXGetVisualFromFBConfig dpy config
1628 Return visual that is associated with the frame buffer configuration.
1629
1630 @table @asis
1631 @item @var{dpy}
1632 Specifies the connection to the X server.
1633
1634 @item @var{config}
1635 Specifies the GLX frame buffer configuration.
1636
1637 @end table
1638
1639 If @var{config} is a valid GLX frame buffer configuration and it has an
1640 associated X Visual, then information describing that visual is
1641 returned; otherwise @code{NULL} is returned. Use @code{XFree} to free
1642 the data returned.
1643
1644 Returns @code{NULL} if @var{config} is not a valid GLXFBConfig.
1645
1646 @end deftypefun
1647
1648 @deftypefun GLXContext glXImportContextEXT dpy contextID
1649 Import another process's indirect rendering context..
1650
1651 @table @asis
1652 @item @var{dpy}
1653 Specifies the connection to the X server.
1654
1655 @item @var{contextID}
1656 Specifies a GLX rendering context.
1657
1658 @end table
1659
1660 @code{glXImportContextEXT} creates a GLXContext given the XID of an
1661 existing GLXContext. It may be used in place of @code{glXCreateContext},
1662 to share another process's indirect rendering context.
1663
1664 Only the server-side context information can be shared between X
1665 clients; client-side state, such as pixel storage modes, cannot be
1666 shared. Thus, @code{glXImportContextEXT} must allocate memory to store
1667 client-side information. This memory is freed by calling
1668 @code{glXFreeContextEXT}.
1669
1670 This call does not create a new XID. It merely makes an existing object
1671 available to the importing client (Display *). Like any XID, it goes
1672 away when the creating client drops its connection or the ID is
1673 explicitly deleted. Note that this is when the XID goes away. The object
1674 goes away when the XID goes away AND the context is not current to any
1675 thread.
1676
1677 If @var{contextID} refers to a direct rendering context then no error is
1678 generated but @code{glXImportContextEXT} returns NULL.
1679
1680 @code{glXImportContextEXT} is part of the @code{EXT_import_context}
1681 extension, not part of the core GLX command set. If
1682 _glxextstring(EXT_import_context) is included in the string returned by
1683 @code{glXQueryExtensionsString}, when called with argument
1684 @code{GLX_EXTENSIONS}, extension @code{EXT_import_context} is supported.
1685
1686 @code{GLXBadContext} is generated if @var{contextID} does not refer to a
1687 valid context.
1688
1689 @end deftypefun
1690
1691 @deftypefun Bool glXIsDirect dpy ctx
1692 Indicate whether direct rendering is enabled.
1693
1694 @table @asis
1695 @item @var{dpy}
1696 Specifies the connection to the X server.
1697
1698 @item @var{ctx}
1699 Specifies the GLX context that is being queried.
1700
1701 @end table
1702
1703 @code{glXIsDirect} returns @code{True} if @var{ctx} is a direct
1704 rendering context, @code{False} otherwise. Direct rendering contexts
1705 pass rendering commands directly from the calling process's address
1706 space to the rendering system, bypassing the X server. Nondirect
1707 rendering contexts pass all rendering commands to the X server.
1708
1709 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1710 context.
1711
1712 @end deftypefun
1713
1714 @deftypefun Bool glXMakeContextCurrent display draw read ctx
1715 Attach a GLX context to a GLX drawable.
1716
1717 @table @asis
1718 @item @var{display}
1719 Specifies the connection to the X server.
1720
1721 @item @var{draw}
1722 Specifies a GLX drawable to render into. Must be an XID representing a
1723 GLXWindow, GLXPixmap, or GLXPbuffer.
1724
1725 @item @var{read}
1726 Specifies a GLX drawable to read from. Must be an XID representing a
1727 GLXWindow, GLXPixmap, or GLXPbuffer.
1728
1729 @item @var{ctx}
1730 Specifies the GLX context to be bound to @var{read} and @var{ctx}.
1731
1732 @end table
1733
1734 @code{glXMakeContextCurrent} binds @var{ctx} to the current rendering
1735 thread and to the @var{draw} and @var{read} GLX drawables. @var{draw}
1736 and @var{read} may be the same.
1737
1738 @var{draw} is used for all OpenGL operations except:
1739
1740 Any pixel data that are read based on the value of
1741 @code{GLX_READ_BUFFER}. Note that accumulation operations use the value
1742 of @code{GLX_READ_BUFFER}, but are not allowed unless @var{draw} is
1743 identical to @var{read}.
1744
1745 Any depth values that are retrieved by @code{glReadPixels} or
1746 @code{glCopyPixels}.
1747
1748 Any stencil values that are retrieved by @code{glReadPixels} or
1749 @code{glCopyPixels}.
1750
1751 Frame buffer values are taken from @var{draw}.
1752
1753 If the current rendering thread has a current rendering context, that
1754 context is flushed and replaced by @var{ctx}.
1755
1756 The first time that @var{ctx} is made current, the viewport and scissor
1757 dimensions are set to the size of the @var{draw} drawable. The viewport
1758 and scissor are not modified when @var{ctx} is subsequently made
1759 current.
1760
1761 To release the current context without assigning a new one, call
1762 @code{glXMakeContextCurrent} with @var{draw} and @var{read} set to
1763 @code{None} and @var{ctx} set to @code{NULL}.
1764
1765 @code{glXMakeContextCurrent} returns @code{True} if it is successful,
1766 @code{False} otherwise. If @code{False} is returned, the previously
1767 current rendering context and drawable (if any) remain unchanged.
1768
1769 @code{BadMatch} is generated if @var{draw} and @var{read} are not
1770 compatible.
1771
1772 @code{BadAccess} is generated if @var{ctx} is current to some other
1773 thread.
1774
1775 @code{GLXContextState} is generated if there is a current rendering
1776 context and its render mode is either @code{GLX_FEEDBACK} or
1777 @code{GLX_SELECT}.
1778
1779 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1780 rendering context.
1781
1782 @code{GLXBadDrawable} is generated if @var{draw} or @var{read} is not a
1783 valid GLX drawable.
1784
1785 @code{GLXBadWindow} is generated if the underlying X window for either
1786 @var{draw} or @var{read} is no longer valid.
1787
1788 @code{GLXBadCurrentDrawable} is generated if the previous context of the
1789 calling thread has unflushed commands and the previous drawable is no
1790 longer valid.
1791
1792 @code{BadAlloc} is generated if the X server does not have enough
1793 resources to allocate the buffers.
1794
1795 @code{BadMatch} is generated if:
1796
1797 @var{draw} and @var{read} cannot fit into frame buffer memory
1798 simultaneously.
1799
1800 @var{draw} or @var{read} is a GLXPixmap and @var{ctx} is a
1801 direct-rendering context.
1802
1803 @var{draw} or @var{read} is a GLXPixmap and @var{ctx} was previously
1804 bound to a GLXWindow or GLXPbuffer.
1805
1806 @var{draw} or @var{read} is a GLXWindow or GLXPbuffer and @var{ctx} was
1807 previously bound to a GLXPixmap.
1808
1809 @end deftypefun
1810
1811 @deftypefun Bool glXMakeCurrent dpy drawable ctx
1812 Attach a GLX context to a window or a GLX pixmap.
1813
1814 @table @asis
1815 @item @var{dpy}
1816 Specifies the connection to the X server.
1817
1818 @item @var{drawable}
1819 Specifies a GLX drawable. Must be either an X window ID or a GLX pixmap
1820 ID.
1821
1822 @item @var{ctx}
1823 Specifies a GLX rendering context that is to be attached to
1824 @var{drawable}.
1825
1826 @end table
1827
1828 @code{glXMakeCurrent} does two things: It makes @var{ctx} the current
1829 GLX rendering context of the calling thread, replacing the previously
1830 current context if there was one, and it attaches @var{ctx} to a GLX
1831 drawable, either a window or a GLX pixmap. As a result of these two
1832 actions, subsequent GL rendering calls use rendering context @var{ctx}
1833 to modify GLX drawable @var{drawable} (for reading and writing). Because
1834 @code{glXMakeCurrent} always replaces the current rendering context with
1835 @var{ctx}, there can be only one current context per thread.
1836
1837 Pending commands to the previous context, if any, are flushed before it
1838 is released.
1839
1840 The first time @var{ctx} is made current to any thread, its viewport is
1841 set to the full size of @var{drawable}. Subsequent calls by any thread
1842 to @code{glXMakeCurrent} with @var{ctx} have no effect on its viewport.
1843
1844 To release the current context without assigning a new one, call
1845 @code{glXMakeCurrent} with @var{drawable} set to @code{None} and
1846 @var{ctx} set to @code{NULL}.
1847
1848 @code{glXMakeCurrent} returns @code{True} if it is successful,
1849 @code{False} otherwise. If @code{False} is returned, the previously
1850 current rendering context and drawable (if any) remain unchanged.
1851
1852 @code{BadMatch} is generated if @var{drawable} was not created with the
1853 same X screen and visual as @var{ctx}. It is also generated if
1854 @var{drawable} is @code{None} and @var{ctx} is not @code{NULL}.
1855
1856 @code{BadAccess} is generated if @var{ctx} was current to another thread
1857 at the time @code{glXMakeCurrent} was called.
1858
1859 @code{GLXBadDrawable} is generated if @var{drawable} is not a valid GLX
1860 drawable.
1861
1862 @code{GLXBadContext} is generated if @var{ctx} is not a valid GLX
1863 context.
1864
1865 @code{GLXBadContextState} is generated if @code{glXMakeCurrent} is
1866 executed between the execution of @code{glBegin} and the corresponding
1867 execution of @code{glEnd}.
1868
1869 @code{GLXBadContextState} is also generated if the rendering context
1870 current to the calling thread has GL renderer state @code{GLX_FEEDBACK}
1871 or @code{GLX_SELECT}.
1872
1873 @code{GLXBadCurrentWindow} is generated if there are pending GL commands
1874 for the previous context and the current drawable is a window that is no
1875 longer valid.
1876
1877 @code{BadAlloc} may be generated if the server has delayed allocation of
1878 ancillary buffers until @code{glXMakeCurrent} is called, only to find
1879 that it has insufficient resources to complete the allocation.
1880
1881 @end deftypefun
1882
1883 @deftypefun int glXQueryContextInfoEXT dpy ctx attribute value
1884 Query context information.
1885
1886 @table @asis
1887 @item @var{dpy}
1888 Specifies the connection to the X server.
1889
1890 @item @var{ctx}
1891 Specifies a GLX rendering context.
1892
1893 @item @var{attribute}
1894 Specifies that a context parameter should be retrieved. Must be one of
1895 @code{GLX_SHARED_CONTEXT_EXT}, @code{GLX_VISUAL_ID_EXT}, or
1896 @code{GLX_SCREEN_EXT}.
1897
1898 @item @var{value}
1899 Contains the return value for @var{attribute}.
1900
1901 @end table
1902
1903 @code{glXQueryContextInfoEXT} sets @var{value} to the value of
1904 @var{attribute} with respect to @var{ctx}. @code{glXQueryContextInfoEXT}
1905 returns an error code if it fails for any reason. Otherwise,
1906 @code{Success} is returned.
1907
1908 @var{attribute} may be one of the following:
1909
1910 @table @asis
1911 @item @code{GLX_SHARED_CONTEXT_EXT}
1912 Returns the XID of the share list context associated with @var{ctx} at
1913 its creation.
1914
1915 @item @code{GLX_VISUAL_ID_EXT}
1916 Returns the XID of the GLX Visual associated with @var{ctx}.
1917
1918 @item @code{GLX_SCREEN_EXT}
1919 Returns the screen number associated with @var{ctx}.
1920
1921 @end table
1922
1923 This call may cause a round-trip to the server.
1924
1925 @code{glXQueryContextInfoEXT} is part of the @code{EXT_import_context}
1926 extension, not part of the core GLX command set. If
1927 _glxextstring(EXT_import_context) is included in the string returned by
1928 @code{glXQueryExtensionsString}, when called with argument
1929 @code{GLX_EXTENSIONS}, extension @code{EXT_import_context} is supported.
1930
1931 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1932 context.
1933
1934 @code{GLX_BAD_ATTRIBUTE} is returned if @var{attribute} is not a valid
1935 GLX context attribute.
1936
1937 fred @code{GLX_BAD_CONTEXT} is returned if @var{attribute} is not a
1938 valid context.
1939
1940 @end deftypefun
1941
1942 @deftypefun int glXQueryContext dpy ctx attribute value
1943 Query context information.
1944
1945 @table @asis
1946 @item @var{dpy}
1947 Specifies the connection to the X server.
1948
1949 @item @var{ctx}
1950 Specifies a GLX rendering context.
1951
1952 @item @var{attribute}
1953 Specifies that a context parameter should be retrieved. Must be one of
1954 @code{GLX_FBCONFIG_ID}, @code{GLX_RENDER_TYPE}, or @code{GLX_SCREEN}.
1955
1956 @item @var{value}
1957 Contains the return value for @var{attribute}.
1958
1959 @end table
1960
1961 @code{glXQueryContext} sets @var{value} to the value of @var{attribute}
1962 with respect to @var{ctx}. @var{attribute} may be one of the following:
1963
1964 @table @asis
1965 @item @code{GLX_FBCONFIG_ID}
1966 Returns the XID of the GLXFBConfig associated with @var{ctx}.
1967
1968 @item @code{GLX_RENDER_TYPE}
1969 Returns the rendering type supported by @var{ctx}.
1970
1971 @item @code{GLX_SCREEN}
1972 Returns the screen number associated with @var{ctx}.
1973
1974 @end table
1975
1976 @code{Success} is returned unless @var{attribute} is not a valid GLX
1977 context attribute, in which case @code{GLX_BAD_ATTRIBUTE} is returned.
1978
1979 This call may cause a round-trip to the server.
1980
1981 @code{GLXBadContext} is generated if @var{ctx} does not refer to a valid
1982 context.
1983
1984 @end deftypefun
1985
1986 @deftypefun int glXQueryDrawable dpy draw attribute value
1987 Returns an attribute assoicated with a GLX drawable.
1988
1989 @table @asis
1990 @item @var{dpy}
1991 Specifies the connection to the X server.
1992
1993 @item @var{draw}
1994 Specifies the GLX drawable to be queried.
1995
1996 @item @var{attribute}
1997 Specifies the attribute to be returned. Must be one of @code{GLX_WIDTH},
1998 @code{GLX_HEIGHT}, @code{GLX_PRESERVED_CONTENTS},
1999 @code{GLX_LARGEST_PBUFFER}, or @code{GLX_FBCONFIG_ID}.
2000
2001 @item @var{value}
2002 Contains the return value for @var{attribute}.
2003
2004 @end table
2005
2006 @code{glXQueryDrawable} sets @var{value} to the value of @var{attribute}
2007 with respect to the GLXDrawable @var{draw}.
2008
2009 @var{attribute} may be one of the following:
2010
2011 @table @asis
2012 @item @code{GLX_WIDTH}
2013 Returns the width of @var{ctx}.
2014
2015 @item @code{GLX_HEIGHT}
2016 Returns the height of @var{ctx}.
2017
2018 @item @code{GLX_PRESERVED_CONTENTS}
2019 Returns @code{True} if the contents of a GLXPbuffer are preserved when a
2020 resource conflict occurs; @code{False} otherwise.
2021
2022 @item @code{GLX_LARGEST_PBUFFER}
2023 Returns the value set when @code{glXCreatePbuffer} was called to create
2024 the GLXPbuffer. If @code{False} is returned, then the call to
2025 @code{glXCreatePbuffer} will fail to create a GLXPbuffer if the
2026 requested size is larger than the implementation maximum or available
2027 resources. If @code{True} is returned, a GLXPbuffer of the maximum
2028 availble size (if less than the requested width and height) is created.
2029
2030 @item @code{GLX_FBCONFIG_ID}
2031 Returns the XID for @var{draw}.
2032
2033 @end table
2034
2035 If @var{draw} is a GLXWindow or GLXPixmap and @var{attribute} is set to
2036 @code{GLX_PRESERVED_CONTENTS} or @code{GLX_LARGETST_PBUFFER}, the
2037 contents of @var{value} are undefined. If @var{attribute} is not one of
2038 the attributes listed above, the contents of @var{value} are unedfined.
2039
2040 A @code{GLXBadDrawable} is generated if @var{draw} is not a valid
2041 GLXDrawable.
2042
2043 @end deftypefun
2044
2045 @deftypefun const-char-* glXQueryExtensionsString dpy screen
2046 Return list of supported extensions.
2047
2048 @table @asis
2049 @item @var{dpy}
2050 Specifies the connection to the X server.
2051
2052 @item @var{screen}
2053 Specifies the screen number.
2054
2055 @end table
2056
2057 @code{glXQueryExtensionsString} returns a pointer to a string describing
2058 which GLX extensions are supported on the connection. The string is
2059 null-terminated and contains a space-separated list of extension names.
2060 (The extension names themselves never contain spaces.) If there are no
2061 extensions to GLX, then the empty string is returned.
2062
2063 @end deftypefun
2064
2065 @deftypefun Bool glXQueryExtension dpy errorBase eventBase
2066 Indicate whether the GLX extension is supported.
2067
2068 @table @asis
2069 @item @var{dpy}
2070 Specifies the connection to the X server.
2071
2072 @item @var{errorBase}
2073 Returns the base error code of the GLX server extension.
2074
2075 @item @var{eventBase}
2076 Returns the base event code of the GLX server extension.
2077
2078 @end table
2079
2080 @code{glXQueryExtension} returns @code{True} if the X server of
2081 connection @var{dpy} supports the GLX extension, @code{False} otherwise.
2082 If @code{True} is returned, then @var{errorBase} and @var{eventBase}
2083 return the error base and event base of the GLX extension. These values
2084 should be added to the constant error and event values to determine the
2085 actual event or error values. Otherwise, @var{errorBase} and
2086 @var{eventBase} are unchanged.
2087
2088 @var{errorBase} and @var{eventBase} do not return values if they are
2089 specified as @code{NULL}.
2090
2091 @end deftypefun
2092
2093 @deftypefun const-char-* glXQueryServerString dpy screen name
2094 Return string describing the server.
2095
2096 @table @asis
2097 @item @var{dpy}
2098 Specifies the connection to the X server.
2099
2100 @item @var{screen}
2101 Specifies the screen number.
2102
2103 @item @var{name}
2104 Specifies which string is returned: one of @code{GLX_VENDOR},
2105 @code{GLX_VERSION}, or @code{GLX_EXTENSIONS}.
2106
2107 @end table
2108
2109 @code{glXQueryServerString} returns a pointer to a static,
2110 null-terminated string describing some aspect of the server's GLX
2111 extension. The possible values for @var{name} and the format of the
2112 strings is the same as for @code{glXGetClientString}. If @var{name} is
2113 not set to a recognized value, @code{NULL} is returned.
2114
2115 @end deftypefun
2116
2117 @deftypefun Bool glXQueryVersion dpy major minor
2118 Return the version numbers of the GLX extension.
2119
2120 @table @asis
2121 @item @var{dpy}
2122 Specifies the connection to the X server.
2123
2124 @item @var{major}
2125 Returns the major version number of the GLX server extension.
2126
2127 @item @var{minor}
2128 Returns the minor version number of the GLX server extension.
2129
2130 @end table
2131
2132 @code{glXQueryVersion} returns the major and minor version numbers of
2133 the GLX extension implemented by the server associated with connection
2134 @var{dpy}. Implementations with the same major version number are upward
2135 compatible, meaning that the implementation with the higher minor number
2136 is a superset of the version with the lower minor number.
2137
2138 @var{major} and @var{minor} do not return values if they are specified
2139 as @code{NULL}.
2140
2141 @code{glXQueryVersion} returns @code{False} if it fails, @code{True}
2142 otherwise.
2143
2144 @var{major} and @var{minor} are not updated when @code{False} is
2145 returned.
2146
2147 @end deftypefun
2148
2149 @deftypefun void glXSelectEvent dpy draw event_mask
2150 Select GLX events for a window or a GLX pixel buffer.
2151
2152 @table @asis
2153 @item @var{dpy}
2154 Specifies the connection to the X server.
2155
2156 @item @var{draw}
2157 Specifies a GLX drawable. Must be a GLX pixel buffer or a window.
2158
2159 @item @var{event_mask}
2160 Specifies the events to be returned for @var{draw}.
2161
2162 @end table
2163
2164 @code{glXSelectEvent} sets the GLX event mask for a GLX pixel buffer or
2165 a window. Calling @code{glXSelectEvent} overrides any previous event
2166 mask that was set by the client for @var{draw}. Note that it does not
2167 affect the event masks that other clients may have specified for
2168 @var{draw} since each client rendering to @var{draw} has a separate
2169 event mask for it.
2170
2171 Currently, only one GLX event, @code{GLX_PBUFFER_CLOBBER_MASK}, can be
2172 selected. The following data is returned to the client when a
2173 @code{GLX_PBUFFER_CLOBBER_MASK} event occurs:
2174
2175 typedef struct @{
2176
2177 @table @asis
2178 @item
2179 int @var{event_type};
2180 /* GLX_DAMAGED or GLX_SAVED */
2181
2182 @item
2183 int @var{draw_type};
2184 /* GLX_WINDOW or GLX_PBUFFER */
2185
2186 @item
2187 unsigned long @var{serial};
2188 /* # of last request processed by server */
2189
2190 @item
2191 Bool @var{send_event};
2192 /* true if this came for SendEvent request */
2193
2194 @item
2195 Display @var{*display};
2196 /* display the event was read from */
2197
2198 @item
2199 GLXDrawable @var{drawable};
2200 /* i.d. of Drawable */
2201
2202 @item
2203 unsigned int @var{buffer_mask};
2204 /* mask indicating affected buffers */
2205
2206 @item
2207 int @var{x, y};
2208
2209
2210 @item
2211 int @var{width, height};
2212
2213
2214 @item
2215 int @var{count};
2216 /* if nonzero, at least this many more */
2217
2218 @end table
2219
2220 @} GLXPbufferClobberEvent; The valid bit masks used in @var{buffer_mask}
2221 are:
2222
2223
2224
2225 @table @asis
2226 @item @strong{Bitmask}
2227 @strong{Corresponding Buffer}
2228
2229 @item @code{GLX_FRONT_LEFT_BUFFER_BIT}
2230 Front left color buffer
2231
2232 @item @code{GLX_FRONT_RIGHT_BUFFER_BIT}
2233 Front right color buffer
2234
2235 @item @code{GLX_BACK_LEFT_BUFFER_BIT}
2236 Back left color buffer
2237
2238 @item @code{GLX_BACK_RIGHT_BUFFER_BIT}
2239 Back right color buffer
2240
2241 @item @code{GLX_AUX_BUFFERS_BIT}
2242 Auxiliary buffer
2243
2244 @item @code{GLX_DEPTH_BUFFER_BIT}
2245 Depth buffer
2246
2247 @item @code{GLX_STENCIL_BUFFER_BIT}
2248 Stencil buffer
2249
2250 @item @code{GLX_ACCUM_BUFFER_BIT}
2251 Accumulation buffer
2252
2253 @end table
2254
2255 A single X server operation can cause several buffer clobber events to
2256 be sent. (e.g., a single GLX pixel buffer may be damaged and cause
2257 multiple buffer clobber events to be generated). Each event specifies
2258 one region of the GLX drawable that was affected by the X Server
2259 operation. The @var{buffer_mask} field indicates which color buffers and
2260 ancillary buffers were affected. All the buffer clobber events generated
2261 by a single X server action are guaranteed to be contiguous in the event
2262 queue. The conditions under which this event is generated and the
2263 @var{event_type} varies, depending on the type of the GLX drawable.
2264
2265 When the @code{GLX_AUX_BUFFERS_BIT} is set in @var{buffer_mask}, then
2266 @var{aux_buffer} is set to indicate which buffer was affected. If more
2267 than one aux buffer was affected, then additional events are generated
2268 as part of the same contiguous event group. Each additional event will
2269 have only the @code{GLX_AUX_BUFFERS_BIT} set in @var{buffer_mask}, and
2270 the @var{aux_buffer} field will be set appropriately. For nonstereo
2271 drawables, @code{GLX_FRONT_LEFT_BUFFER_BIT} and
2272 @code{GLX_BACK_LEFT_BUFFER_BIT} are used to specify the front and back
2273 color buffers.
2274
2275 For preserved GLX pixel buffers, a buffer clobber event with type
2276 @code{GLX_SAVED} is generated whenever the contents of the GLX pixel
2277 buffer is moved out of offscreen memory. The event(s) describes which
2278 portions of the GLX pixel buffer were affected. Clients who receive many
2279 buffer clobber events, referring to different save actions, should
2280 consider freeing the GLX pixel buffer resource in order to prevent the
2281 system from thrashing due to insufficient resources.
2282
2283 For an unpreserved GLXPbuffer, a buffer clobber event, with type
2284 @code{GLX_DAMAGED}, is generated whenever a portion of the GLX pixel
2285 buffer becomes invalid. The client may wish to regenerate the invalid
2286 portions of the GLX pixel buffer.
2287
2288 For Windows, buffer clobber events, with type @code{GLX_SAVED}, occur
2289 whenever an ancillary buffer, associated with the window, gets clobbered
2290 or moved out of off-screen memory. The event contains information
2291 indicating which color buffers and ancillary buffers\(emand which
2292 portions of those buffers\(emwere affected.
2293
2294 @code{GLXBadDrawable} is generated if @var{draw} is not a valid window
2295 or a valid GLX pixel buffer.
2296
2297 @end deftypefun
2298
2299 @deftypefun void glXSwapBuffers dpy drawable
2300 Exchange front and back buffers.
2301
2302 @table @asis
2303 @item @var{dpy}
2304 Specifies the connection to the X server.
2305
2306 @item @var{drawable}
2307 Specifies the drawable whose buffers are to be swapped.
2308
2309 @end table
2310
2311 @code{glXSwapBuffers} promotes the contents of the back buffer of
2312 @var{drawable} to become the contents of the front buffer of
2313 @var{drawable}. The contents of the back buffer then become undefined.
2314 The update typically takes place during the vertical retrace of the
2315 monitor, rather than immediately after @code{glXSwapBuffers} is called.
2316
2317 @code{glXSwapBuffers} performs an implicit @code{glFlush} before it
2318 returns. Subsequent OpenGL commands may be issued immediately after
2319 calling @code{glXSwapBuffers}, but are not executed until the buffer
2320 exchange is completed.
2321
2322 If @var{drawable} was not created with respect to a double-buffered
2323 visual, @code{glXSwapBuffers} has no effect, and no error is generated.
2324
2325 @code{GLXBadDrawable} is generated if @var{drawable} is not a valid GLX
2326 drawable.
2327
2328 @code{GLXBadCurrentWindow} is generated if @var{dpy} and @var{drawable}
2329 are respectively the display and drawable associated with the current
2330 context of the calling thread, and @var{drawable} identifies a window
2331 that is no longer valid.
2332
2333 @end deftypefun
2334
2335 @deftypefun void glXUseXFont font first count listBase
2336 Create bitmap display lists from an X font.
2337
2338 @table @asis
2339 @item @var{font}
2340 Specifies the font from which character glyphs are to be taken.
2341
2342 @item @var{first}
2343 Specifies the index of the first glyph to be taken.
2344
2345 @item @var{count}
2346 Specifies the number of glyphs to be taken.
2347
2348 @item @var{listBase}
2349 Specifies the index of the first display list to be generated.
2350
2351 @end table
2352
2353 @code{glXUseXFont} generates @var{count} display lists, named
2354 @var{listBase} through @r{@var{listBase}+@var{count}-1}, each containing
2355 a single @code{glBitmap} command. The parameters of the @code{glBitmap}
2356 command of display list @r{@var{listBase}+@var{i}} are derived from
2357 glyph @r{@var{first}+@var{i}}. Bitmap parameters @r{@var{xorig}},
2358 @r{@var{yorig}}, @r{@var{width}}, and @r{@var{height}} are computed from
2359 font metrics as @r{@var{descent}-1}, @r{-@var{lbearing}},
2360 @r{@var{rbearing}-@var{lbearing}}, and @r{@var{ascent}+@var{descent}},
2361 respectively. @r{@var{xmove}} is taken from the glyph's @r{@var{width}}
2362 metric, and @r{@var{ymove}} is set to zero. Finally, the glyph's image
2363 is converted to the appropriate format for @code{glBitmap}.
2364
2365 Using @code{glXUseXFont} may be more efficient than accessing the X font
2366 and generating the display lists explicitly, both because the display
2367 lists are created on the server without requiring a round trip of the
2368 glyph data, and because the server may choose to delay the creation of
2369 each bitmap until it is accessed.
2370
2371 Empty display lists are created for all glyphs that are requested and
2372 are not defined in @var{font}. @code{glXUseXFont} is ignored if there is
2373 no current GLX context.
2374
2375 @code{BadFont} is generated if @var{font} is not a valid font.
2376
2377 @code{GLXBadContextState} is generated if the current GLX context is in
2378 display-list construction mode.
2379
2380 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2381 the current context of the calling thread is a window, and that window
2382 is no longer valid.
2383
2384 @end deftypefun
2385
2386 @deftypefun void glXWaitGL
2387 Complete GL execution prior to subsequent X calls.
2388
2389 GL rendering calls made prior to @code{glXWaitGL} are guaranteed to be
2390 executed before X rendering calls made after @code{glXWaitGL}. Although
2391 this same result can be achieved using @code{glFinish}, @code{glXWaitGL}
2392 does not require a round trip to the server, and it is therefore more
2393 efficient in cases where client and server are on separate machines.
2394
2395 @code{glXWaitGL} is ignored if there is no current GLX context.
2396
2397 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2398 the current context of the calling thread is a window, and that window
2399 is no longer valid.
2400
2401 @end deftypefun
2402
2403 @deftypefun void glXWaitX
2404 Complete X execution prior to subsequent GL calls.
2405
2406 X rendering calls made prior to @code{glXWaitX} are guaranteed to be
2407 executed before GL rendering calls made after @code{glXWaitX}. Although
2408 the same result can be achieved using @code{XSync}, @code{glXWaitX} does
2409 not require a round trip to the server, and it is therefore more
2410 efficient in cases where client and server are on separate machines.
2411
2412 @code{glXWaitX} is ignored if there is no current GLX context.
2413
2414 @code{GLXBadCurrentWindow} is generated if the drawable associated with
2415 the current context of the calling thread is a window, and that window
2416 is no longer valid.
2417
2418 @end deftypefun
2419
2420
2421 @c %end of fragment