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