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