blob: 1b5d78b806b2755d5be58c8b8af7339f5ed279f1 [file] [log] [blame]
Brian Paul086f1b82001-07-27 14:26:27 +00001/* $Id: glx.h,v 1.29 2001/07/27 14:26:27 brianp Exp $ */
jtgafb833d1999-08-19 00:55:39 +00002
3/*
4 * Mesa 3-D graphics library
Brian Paul68656662000-11-25 18:52:58 +00005 * Version: 3.5
jtgafb833d1999-08-19 00:55:39 +00006 *
Brian Paulf3232bc2000-02-23 23:04:27 +00007 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
jtgafb833d1999-08-19 00:55:39 +00008 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
jtgafb833d1999-08-19 00:55:39 +000028#ifndef GLX_H
29#define GLX_H
30
31
Jouk Jansen3f600e42000-03-06 12:59:24 +000032#ifdef __VMS
Jouk Jansenb5b5c522000-08-22 13:31:00 +000033#include <GL/vms_x_fix.h>
Jouk Jansen3f600e42000-03-06 12:59:24 +000034# ifdef __cplusplus
35/* VMS Xlib.h gives problems with C++.
36 * this avoids a bunch of trivial warnings */
37#pragma message disable nosimpint
38#endif
39#endif
jtgafb833d1999-08-19 00:55:39 +000040#include <X11/Xlib.h>
41#include <X11/Xutil.h>
Jouk Jansen3f600e42000-03-06 12:59:24 +000042#ifdef __VMS
43# ifdef __cplusplus
44#pragma message enable nosimpint
45#endif
46#endif
Brian Paul23b15032000-12-08 18:08:15 +000047#include <GL/gl.h>
jtgafb833d1999-08-19 00:55:39 +000048
49
50#if defined(USE_MGL_NAMESPACE)
Brian Paul23b15032000-12-08 18:08:15 +000051#include <GL/glx_mangle.h>
jtgafb833d1999-08-19 00:55:39 +000052#endif
53
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59
60#define GLX_VERSION_1_1 1
Brian Paulbf3f9bd1999-11-22 21:51:53 +000061#define GLX_VERSION_1_2 1
Brian Paul07b220a2000-06-08 22:50:24 +000062#define GLX_VERSION_1_3 1
jtgafb833d1999-08-19 00:55:39 +000063
Brian Paulfbd8f211999-11-11 01:22:25 +000064#define GLX_EXTENSION_NAME "GLX"
65
66
jtgafb833d1999-08-19 00:55:39 +000067
68/*
69 * Tokens for glXChooseVisual and glXGetConfig:
70 */
Brian Paulfbd8f211999-11-11 01:22:25 +000071#define GLX_USE_GL 1
72#define GLX_BUFFER_SIZE 2
73#define GLX_LEVEL 3
74#define GLX_RGBA 4
75#define GLX_DOUBLEBUFFER 5
76#define GLX_STEREO 6
77#define GLX_AUX_BUFFERS 7
78#define GLX_RED_SIZE 8
79#define GLX_GREEN_SIZE 9
80#define GLX_BLUE_SIZE 10
81#define GLX_ALPHA_SIZE 11
82#define GLX_DEPTH_SIZE 12
83#define GLX_STENCIL_SIZE 13
84#define GLX_ACCUM_RED_SIZE 14
85#define GLX_ACCUM_GREEN_SIZE 15
86#define GLX_ACCUM_BLUE_SIZE 16
87#define GLX_ACCUM_ALPHA_SIZE 17
jtgafb833d1999-08-19 00:55:39 +000088
Brian Paulfbd8f211999-11-11 01:22:25 +000089
jtgafb833d1999-08-19 00:55:39 +000090/*
91 * Error codes returned by glXGetConfig:
92 */
93#define GLX_BAD_SCREEN 1
94#define GLX_BAD_ATTRIBUTE 2
95#define GLX_NO_EXTENSION 3
96#define GLX_BAD_VISUAL 4
97#define GLX_BAD_CONTEXT 5
98#define GLX_BAD_VALUE 6
99#define GLX_BAD_ENUM 7
100
101
102/*
103 * GLX 1.1 and later:
104 */
105#define GLX_VENDOR 1
106#define GLX_VERSION 2
107#define GLX_EXTENSIONS 3
108
109
110/*
Brian Paul664a1f81999-11-23 19:54:53 +0000111 * GLX 1.3 and later:
Brian Paul664a1f81999-11-23 19:54:53 +0000112 */
Brian Paul47e719f2000-04-10 21:12:20 +0000113#define GLX_CONFIG_CAVEAT 0x20
114#define GLX_DONT_CARE 0xFFFFFFFF
115#define GLX_SLOW_CONFIG 0x8001
116#define GLX_NON_CONFORMANT_CONFIG 0x800D
Brian Paul664a1f81999-11-23 19:54:53 +0000117#define GLX_X_VISUAL_TYPE 0x22
118#define GLX_TRANSPARENT_TYPE 0x23
119#define GLX_TRANSPARENT_INDEX_VALUE 0x24
120#define GLX_TRANSPARENT_RED_VALUE 0x25
121#define GLX_TRANSPARENT_GREEN_VALUE 0x26
122#define GLX_TRANSPARENT_BLUE_VALUE 0x27
123#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
Brian Paul47e719f2000-04-10 21:12:20 +0000124#define GLX_MAX_PBUFFER_WIDTH 0x8016
125#define GLX_MAX_PBUFFER_HEIGHT 0x8017
126#define GLX_MAX_PBUFFER_PIXELS 0x8018
127#define GLX_PRESERVED_CONTENTS 0x801B
128#define GLX_LARGEST_BUFFER 0x801C
Brian Paul086f1b82001-07-27 14:26:27 +0000129#define GLX_WIDTH 0x801D
130#define GLX_HEIGHT 0x801E
131#define GLX_EVENT_MASK 0x801F
Brian Paul47e719f2000-04-10 21:12:20 +0000132#define GLX_DRAWABLE_TYPE 0x8010
133#define GLX_FBCONFIG_ID 0x8013
134#define GLX_VISUAL_ID 0x800B
135#define GLX_WINDOW_BIT 0x00000001
136#define GLX_PIXMAP_BIT 0x00000002
137#define GLX_PBUFFER_BIT 0x00000004
138#define GLX_AUX_BUFFERS_BIT 0x00000010
139#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
140#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
141#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
142#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
143#define GLX_AUX_BUFFERS_BIT 0x00000010
144#define GLX_DEPTH_BUFFER_BIT 0x00000020
145#define GLX_STENCIL_BUFFER_BIT 0x00000040
146#define GLX_ACCUM_BUFFER_BIT 0x00000080
147#define GLX_DRAWABLE_TYPE 0x8010
148#define GLX_RENDER_TYPE 0x8011
149#define GLX_X_RENDERABLE 0x8012
Brian Paul664a1f81999-11-23 19:54:53 +0000150#define GLX_NONE 0x8000
151#define GLX_TRUE_COLOR 0x8002
152#define GLX_DIRECT_COLOR 0x8003
153#define GLX_PSEUDO_COLOR 0x8004
154#define GLX_STATIC_COLOR 0x8005
155#define GLX_GRAY_SCALE 0x8006
156#define GLX_STATIC_GRAY 0x8007
157#define GLX_TRANSPARENT_INDEX 0x8009
Brian Paul47e719f2000-04-10 21:12:20 +0000158#define GLX_COLOR_INDEX_TYPE 0x8015
159#define GLX_COLOR_INDEX_BIT 0x00000002
Brian Paul086f1b82001-07-27 14:26:27 +0000160#define GLX_RGBA_BIT 0x00000001
Brian Paul47e719f2000-04-10 21:12:20 +0000161#define GLX_SCREEN 0x800C
162#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
163#define GLX_DAMAGED 0x8020
164#define GLX_SAVED 0x8021
165#define GLX_WINDOW 0x8022
Brian Paul68656662000-11-25 18:52:58 +0000166#define GLX_PBUFFER 0x8023
Brian Paul657323b2001-06-25 15:29:11 +0000167#define GLX_PBUFFER_HEIGHT 0x8040
168#define GLX_PBUFFER_WIDTH 0x8041
Brian Paul664a1f81999-11-23 19:54:53 +0000169
170
jtgafb833d1999-08-19 00:55:39 +0000171
Brian Paule203c9c2001-05-24 19:07:14 +0000172typedef struct __GLXcontextRec *GLXContext;
Brian Paul07b220a2000-06-08 22:50:24 +0000173typedef XID GLXPixmap;
174typedef XID GLXDrawable;
175/* GLX 1.3 and later */
Brian Paule203c9c2001-05-24 19:07:14 +0000176typedef struct __GLXFBConfigRec *GLXFBConfig;
Brian Paul07b220a2000-06-08 22:50:24 +0000177typedef XID GLXFBConfigID;
jtgafb833d1999-08-19 00:55:39 +0000178typedef XID GLXContextID;
Brian Paul07b220a2000-06-08 22:50:24 +0000179typedef XID GLXWindow;
180typedef XID GLXPbuffer;
jtgafb833d1999-08-19 00:55:39 +0000181
182
183
184extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
185 int *attribList );
186
187extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
188 GLXContext shareList, Bool direct );
189
190extern void glXDestroyContext( Display *dpy, GLXContext ctx );
191
192extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
193 GLXContext ctx);
194
195extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
Brian Paul3994b772000-02-27 18:26:54 +0000196 unsigned long mask );
jtgafb833d1999-08-19 00:55:39 +0000197
198extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
199
200extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
201 Pixmap pixmap );
202
203extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
204
205extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
206
207extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
208
209extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
210
211extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
212 int attrib, int *value );
213
214extern GLXContext glXGetCurrentContext( void );
215
216extern GLXDrawable glXGetCurrentDrawable( void );
217
218extern void glXWaitGL( void );
219
220extern void glXWaitX( void );
221
222extern void glXUseXFont( Font font, int first, int count, int list );
223
224
225
226/* GLX 1.1 and later */
227extern const char *glXQueryExtensionsString( Display *dpy, int screen );
228
229extern const char *glXQueryServerString( Display *dpy, int screen, int name );
230
231extern const char *glXGetClientString( Display *dpy, int name );
232
233
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000234/* GLX 1.2 and later */
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000235extern Display *glXGetCurrentDisplay( void );
236
237
Brian Paul664a1f81999-11-23 19:54:53 +0000238/* GLX 1.3 and later */
Brian Paul47e719f2000-04-10 21:12:20 +0000239extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
240 const int *attribList, int *nitems );
Brian Paul664a1f81999-11-23 19:54:53 +0000241
242extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
243 int attribute, int *value );
244
Brian Paul47e719f2000-04-10 21:12:20 +0000245extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
246 int *nelements );
247
Brian Paul664a1f81999-11-23 19:54:53 +0000248extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
249 GLXFBConfig config );
250
251extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
252 Window win, const int *attribList );
253
254extern void glXDestroyWindow( Display *dpy, GLXWindow window );
255
256extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
257 Pixmap pixmap, const int *attribList );
258
259extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
260
261extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
262 const int *attribList );
263
264extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
265
266extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
267 unsigned int *value );
268
269extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
270 int renderType, GLXContext shareList,
271 Bool direct );
272
273extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
274 GLXDrawable read, GLXContext ctx );
275
276extern GLXDrawable glXGetCurrentReadDrawable( void );
277
278extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
279 int *value );
280
281extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
282 unsigned long mask );
283
284extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
285 unsigned long *mask );
286
287
Brian Paul43c9c2c1999-09-16 15:52:51 +0000288
Brian Paul23b15032000-12-08 18:08:15 +0000289#ifndef GLX_GLXEXT_LEGACY
Brian Paul07b220a2000-06-08 22:50:24 +0000290
Brian Paul23b15032000-12-08 18:08:15 +0000291#include <GL/glxext.h>
Brian Paul07b220a2000-06-08 22:50:24 +0000292
Brian Paul23b15032000-12-08 18:08:15 +0000293#else
jtgafb833d1999-08-19 00:55:39 +0000294
Brian Paul43c9c2c1999-09-16 15:52:51 +0000295
Brian Paul07b220a2000-06-08 22:50:24 +0000296/*
297 * 28. GLX_EXT_visual_info extension
298 */
299#ifndef GLX_EXT_visual_info
300#define GLX_EXT_visual_info 1
301
302#define GLX_X_VISUAL_TYPE_EXT 0x22
303#define GLX_TRANSPARENT_TYPE_EXT 0x23
304#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
305#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
306#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
307#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
308#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
309#define GLX_TRUE_COLOR_EXT 0x8002
310#define GLX_DIRECT_COLOR_EXT 0x8003
311#define GLX_PSEUDO_COLOR_EXT 0x8004
312#define GLX_STATIC_COLOR_EXT 0x8005
313#define GLX_GRAY_SCALE_EXT 0x8006
314#define GLX_STATIC_GRAY_EXT 0x8007
315#define GLX_NONE_EXT 0x8000
316#define GLX_TRANSPARENT_RGB_EXT 0x8008
317#define GLX_TRANSPARENT_INDEX_EXT 0x8009
318
319#endif /* 28. GLX_EXT_visual_info extension */
jtgafb833d1999-08-19 00:55:39 +0000320
Brian Paul43c9c2c1999-09-16 15:52:51 +0000321
jtgafb833d1999-08-19 00:55:39 +0000322
Brian Paul07b220a2000-06-08 22:50:24 +0000323/*
324 * 41. GLX_SGI_video_sync
325 */
326#ifndef GLX_SGI_video_sync
327#define GLX_SGI_video_sync 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000328
jtgafb833d1999-08-19 00:55:39 +0000329extern int glXGetVideoSyncSGI(unsigned int *count);
Brian Paul07b220a2000-06-08 22:50:24 +0000330extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count);
331
332#endif /* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000333
334
Brian Paul353479f2000-04-19 01:40:00 +0000335
Brian Paul07b220a2000-06-08 22:50:24 +0000336/*
337 * 42. GLX_EXT_visual_rating
338 */
339#ifndef GLX_EXT_visual_rating
340#define GLX_EXT_visual_rating 1
341
342#define GLX_VISUAL_CAVEAT_EXT 0x20
343/*#define GLX_NONE_EXT 0x8000*/
344#define GLX_SLOW_VISUAL_EXT 0x8001
345#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
346
347#endif /* GLX_EXT_visual_rating */
348
349
350
351/*
352 * 47. GLX_EXT_import_context
353 */
354#ifndef GLX_EXT_import_context
355#define GLX_EXT_import_context 1
356
357#define GLX_SHARE_CONTEXT_EXT 0x800A
358#define GLX_VISUAL_ID_EXT 0x800B
359#define GLX_SCREEN_EXT 0x800C
360
Brian Paul353479f2000-04-19 01:40:00 +0000361extern void glXFreeContextEXT(Display *dpy, GLXContext context);
362
363extern GLXContextID glXGetContextIDEXT(const GLXContext context);
364
365extern Display *glXGetCurrentDisplayEXT(void);
366
367extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID);
368
369extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context,
370 int attribute,int *value);
371
Brian Paul07b220a2000-06-08 22:50:24 +0000372#endif /* GLX_EXT_import_context */
Brian Paul353479f2000-04-19 01:40:00 +0000373
374
Brian Paul07b220a2000-06-08 22:50:24 +0000375
376/*
Brian Paul401fc932000-06-23 17:39:18 +0000377 * 215. GLX_MESA_copy_sub_buffer
Brian Paul07b220a2000-06-08 22:50:24 +0000378 */
379#ifndef GLX_MESA_copy_sub_buffer
380#define GLX_MESA_copy_sub_buffer 1
381
382extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
383 int x, int y, int width, int height );
384
385#endif
386
387
388
389/*
Brian Paul401fc932000-06-23 17:39:18 +0000390 * 216. GLX_MESA_pixmap_colormap
391 */
392#ifndef GLX_MESA_pixmap_colormap
393#define GLX_MESA_pixmap_colormap 1
394
395extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
396 Pixmap pixmap, Colormap cmap );
397
398#endif /* GLX_MESA_pixmap_colormap */
399
400
401
402/*
403 * 217. GLX_MESA_release_buffers
404 */
405#ifndef GLX_MESA_release_buffers
406#define GLX_MESA_release_buffers 1
407
408extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
409
410#endif /* GLX_MESA_release_buffers */
411
412
413
414/*
415 * 218. GLX_MESA_set_3dfx_mode
Brian Paul07b220a2000-06-08 22:50:24 +0000416 */
417#ifndef GLX_MESA_set_3dfx_mode
418#define GLX_MESA_set_3dfx_mode 1
419
Brian Paul401fc932000-06-23 17:39:18 +0000420#define GLX_3DFX_WINDOW_MODE_MESA 0x1
421#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
422
Brian Pauldaabce72000-12-14 17:44:42 +0000423extern Bool glXSet3DfxModeMESA( int mode );
Brian Paul07b220a2000-06-08 22:50:24 +0000424
425#endif /* GLX_MESA_set_3dfx_mode */
426
427
428
Brian Paul401fc932000-06-23 17:39:18 +0000429/*
430 * ARB 2. GLX_ARB_get_proc_address
431 */
432#ifndef GLX_ARB_get_proc_address
433#define GLX_ARB_get_proc_address 1
434
435extern void (*glXGetProcAddressARB(const GLubyte *procName))();
436
437#endif /* GLX_ARB_get_proc_address */
438
439
440
Brian Paul23b15032000-12-08 18:08:15 +0000441#endif /* GLX_GLXEXT_LEGACY */
Brian Paul07b220a2000-06-08 22:50:24 +0000442
Brian Paulff06c831999-12-11 09:54:33 +0000443
jtgafb833d1999-08-19 00:55:39 +0000444
445#ifdef __cplusplus
446}
447#endif
448
449#endif