blob: ead38a91a053f5dfbce58d00c99c60c9fc43e935 [file] [log] [blame]
Brian Paul353479f2000-04-19 01:40:00 +00001/* $Id: glx.h,v 1.20 2000/04/19 01:40:00 brianp Exp $ */
jtgafb833d1999-08-19 00:55:39 +00002
3/*
4 * Mesa 3-D graphics library
Brian Paulfbd8f211999-11-11 01:22:25 +00005 * Version: 3.3
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
29#ifndef GLX_H
30#define GLX_H
31
32
Jouk Jansen3f600e42000-03-06 12:59:24 +000033#ifdef __VMS
34# 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
jtgafb833d1999-08-19 00:55:39 +000047#include "GL/gl.h"
jtgafb833d1999-08-19 00:55:39 +000048
49
50#if defined(USE_MGL_NAMESPACE)
51#include "glx_mangle.h"
52#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
jtgafb833d1999-08-19 00:55:39 +000062
Brian Paulfbd8f211999-11-11 01:22:25 +000063#define GLX_EXTENSION_NAME "GLX"
64
65
jtgafb833d1999-08-19 00:55:39 +000066
67/*
68 * Tokens for glXChooseVisual and glXGetConfig:
69 */
Brian Paulfbd8f211999-11-11 01:22:25 +000070#define GLX_USE_GL 1
71#define GLX_BUFFER_SIZE 2
72#define GLX_LEVEL 3
73#define GLX_RGBA 4
74#define GLX_DOUBLEBUFFER 5
75#define GLX_STEREO 6
76#define GLX_AUX_BUFFERS 7
77#define GLX_RED_SIZE 8
78#define GLX_GREEN_SIZE 9
79#define GLX_BLUE_SIZE 10
80#define GLX_ALPHA_SIZE 11
81#define GLX_DEPTH_SIZE 12
82#define GLX_STENCIL_SIZE 13
83#define GLX_ACCUM_RED_SIZE 14
84#define GLX_ACCUM_GREEN_SIZE 15
85#define GLX_ACCUM_BLUE_SIZE 16
86#define GLX_ACCUM_ALPHA_SIZE 17
jtgafb833d1999-08-19 00:55:39 +000087
Brian Paulfbd8f211999-11-11 01:22:25 +000088
jtgafb833d1999-08-19 00:55:39 +000089/*
90 * Error codes returned by glXGetConfig:
91 */
92#define GLX_BAD_SCREEN 1
93#define GLX_BAD_ATTRIBUTE 2
94#define GLX_NO_EXTENSION 3
95#define GLX_BAD_VISUAL 4
96#define GLX_BAD_CONTEXT 5
97#define GLX_BAD_VALUE 6
98#define GLX_BAD_ENUM 7
99
100
101/*
102 * GLX 1.1 and later:
103 */
104#define GLX_VENDOR 1
105#define GLX_VERSION 2
106#define GLX_EXTENSIONS 3
107
108
109/*
Brian Paul664a1f81999-11-23 19:54:53 +0000110 * GLX 1.3 and later:
Brian Paul664a1f81999-11-23 19:54:53 +0000111 */
Brian Paul47e719f2000-04-10 21:12:20 +0000112#define GLX_CONFIG_CAVEAT 0x20
113#define GLX_DONT_CARE 0xFFFFFFFF
114#define GLX_SLOW_CONFIG 0x8001
115#define GLX_NON_CONFORMANT_CONFIG 0x800D
Brian Paul664a1f81999-11-23 19:54:53 +0000116#define GLX_X_VISUAL_TYPE 0x22
117#define GLX_TRANSPARENT_TYPE 0x23
118#define GLX_TRANSPARENT_INDEX_VALUE 0x24
119#define GLX_TRANSPARENT_RED_VALUE 0x25
120#define GLX_TRANSPARENT_GREEN_VALUE 0x26
121#define GLX_TRANSPARENT_BLUE_VALUE 0x27
122#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
Brian Paul47e719f2000-04-10 21:12:20 +0000123#define GLX_MAX_PBUFFER_WIDTH 0x8016
124#define GLX_MAX_PBUFFER_HEIGHT 0x8017
125#define GLX_MAX_PBUFFER_PIXELS 0x8018
126#define GLX_PRESERVED_CONTENTS 0x801B
127#define GLX_LARGEST_BUFFER 0x801C
128#define GLX_DRAWABLE_TYPE 0x8010
129#define GLX_FBCONFIG_ID 0x8013
130#define GLX_VISUAL_ID 0x800B
131#define GLX_WINDOW_BIT 0x00000001
132#define GLX_PIXMAP_BIT 0x00000002
133#define GLX_PBUFFER_BIT 0x00000004
134#define GLX_AUX_BUFFERS_BIT 0x00000010
135#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
136#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
137#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
138#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
139#define GLX_AUX_BUFFERS_BIT 0x00000010
140#define GLX_DEPTH_BUFFER_BIT 0x00000020
141#define GLX_STENCIL_BUFFER_BIT 0x00000040
142#define GLX_ACCUM_BUFFER_BIT 0x00000080
143#define GLX_DRAWABLE_TYPE 0x8010
144#define GLX_RENDER_TYPE 0x8011
145#define GLX_X_RENDERABLE 0x8012
Brian Paul664a1f81999-11-23 19:54:53 +0000146#define GLX_NONE 0x8000
147#define GLX_TRUE_COLOR 0x8002
148#define GLX_DIRECT_COLOR 0x8003
149#define GLX_PSEUDO_COLOR 0x8004
150#define GLX_STATIC_COLOR 0x8005
151#define GLX_GRAY_SCALE 0x8006
152#define GLX_STATIC_GRAY 0x8007
153#define GLX_TRANSPARENT_INDEX 0x8009
Brian Paul47e719f2000-04-10 21:12:20 +0000154#define GLX_COLOR_INDEX_TYPE 0x8015
155#define GLX_COLOR_INDEX_BIT 0x00000002
156#define GLX_SCREEN 0x800C
157#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
158#define GLX_DAMAGED 0x8020
159#define GLX_SAVED 0x8021
160#define GLX_WINDOW 0x8022
161#define GLX_PBUFFER 0x8033
Brian Paul664a1f81999-11-23 19:54:53 +0000162
163
164/*
Brian Paulbd2055c2000-03-31 01:03:41 +0000165 * 28. GLX_EXT_visual_info extension
Brian Paul664a1f81999-11-23 19:54:53 +0000166 */
167#define GLX_X_VISUAL_TYPE_EXT 0x22
168#define GLX_TRANSPARENT_TYPE_EXT 0x23
169#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
170#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
171#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
172#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
173#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
jtgafb833d1999-08-19 00:55:39 +0000174#define GLX_TRUE_COLOR_EXT 0x8002
175#define GLX_DIRECT_COLOR_EXT 0x8003
176#define GLX_PSEUDO_COLOR_EXT 0x8004
177#define GLX_STATIC_COLOR_EXT 0x8005
178#define GLX_GRAY_SCALE_EXT 0x8006
179#define GLX_STATIC_GRAY_EXT 0x8007
180#define GLX_NONE_EXT 0x8000
181#define GLX_TRANSPARENT_RGB_EXT 0x8008
182#define GLX_TRANSPARENT_INDEX_EXT 0x8009
183
184
185/*
Brian Paulbd2055c2000-03-31 01:03:41 +0000186 * 42. GLX_EXT_visual_rating
187 */
188#define GLX_VISUAL_CAVEAT_EXT 0x20
189/*#define GLX_NONE_EXT 0x8000*/
Brian Paul37d34bc2000-03-31 14:48:28 +0000190#define GLX_SLOW_VISUAL_EXT 0x8001
Brian Paulbd2055c2000-03-31 01:03:41 +0000191#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
192
193
194/*
Brian Paul353479f2000-04-19 01:40:00 +0000195 * 47. GLX_EXT_import_context
196 */
197#define GLX_SHARE_CONTEXT_EXT 0x800A
198#define GLX_VISUAL_ID_EXT 0x800B
199#define GLX_SCREEN_EXT 0x800C
200
201
202/*
jtgafb833d1999-08-19 00:55:39 +0000203 * Compile-time extension tests
204 */
jtgafb833d1999-08-19 00:55:39 +0000205#define GLX_EXT_visual_info 1
Brian Paulbd2055c2000-03-31 01:03:41 +0000206#define GLX_EXT_visual_rating 1
Brian Paul353479f2000-04-19 01:40:00 +0000207#define GLX_EXT_import_context 1
jtgafb833d1999-08-19 00:55:39 +0000208#define GLX_MESA_pixmap_colormap 1
209#define GLX_MESA_release_buffers 1
210#define GLX_MESA_copy_sub_buffer 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000211#define GLX_MESA_set_3dfx_mode 1
jtgafb833d1999-08-19 00:55:39 +0000212#define GLX_SGI_video_sync 1
Brian Paulff06c831999-12-11 09:54:33 +0000213#define GLX_ARB_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000214
215
216
217#ifdef MESA
218 typedef XMesaContext GLXContext;
219 typedef Pixmap GLXPixmap;
220 typedef Drawable GLXDrawable;
221#else
222 typedef void * GLXContext;
223 typedef XID GLXPixmap;
224 typedef XID GLXDrawable;
Brian Paul664a1f81999-11-23 19:54:53 +0000225 /* GLX 1.3 and later */
226 typedef XID GLXFBConfigID;
227 typedef XID GLXPfuffer;
228 typedef XID GLXWindow;
229 typedef XID GLXPbuffer;
230 typedef XID GLXFBConfig;
jtgafb833d1999-08-19 00:55:39 +0000231#endif
232typedef XID GLXContextID;
233
234
235
236extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
237 int *attribList );
238
239extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
240 GLXContext shareList, Bool direct );
241
242extern void glXDestroyContext( Display *dpy, GLXContext ctx );
243
244extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
245 GLXContext ctx);
246
247extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
Brian Paul3994b772000-02-27 18:26:54 +0000248 unsigned long mask );
jtgafb833d1999-08-19 00:55:39 +0000249
250extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
251
252extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
253 Pixmap pixmap );
254
255extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
256
257extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
258
259extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
260
261extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
262
263extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
264 int attrib, int *value );
265
266extern GLXContext glXGetCurrentContext( void );
267
268extern GLXDrawable glXGetCurrentDrawable( void );
269
270extern void glXWaitGL( void );
271
272extern void glXWaitX( void );
273
274extern void glXUseXFont( Font font, int first, int count, int list );
275
276
277
278/* GLX 1.1 and later */
279extern const char *glXQueryExtensionsString( Display *dpy, int screen );
280
281extern const char *glXQueryServerString( Display *dpy, int screen, int name );
282
283extern const char *glXGetClientString( Display *dpy, int name );
284
285
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000286/* GLX 1.2 and later */
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000287extern Display *glXGetCurrentDisplay( void );
288
289
Brian Paul664a1f81999-11-23 19:54:53 +0000290/* GLX 1.3 and later */
Brian Paul47e719f2000-04-10 21:12:20 +0000291extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
292 const int *attribList, int *nitems );
Brian Paul664a1f81999-11-23 19:54:53 +0000293
294extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
295 int attribute, int *value );
296
Brian Paul47e719f2000-04-10 21:12:20 +0000297extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
298 int *nelements );
299
Brian Paul664a1f81999-11-23 19:54:53 +0000300extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
301 GLXFBConfig config );
302
303extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
304 Window win, const int *attribList );
305
306extern void glXDestroyWindow( Display *dpy, GLXWindow window );
307
308extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
309 Pixmap pixmap, const int *attribList );
310
311extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
312
313extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
314 const int *attribList );
315
316extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
317
318extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
319 unsigned int *value );
320
321extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
322 int renderType, GLXContext shareList,
323 Bool direct );
324
325extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
326 GLXDrawable read, GLXContext ctx );
327
328extern GLXDrawable glXGetCurrentReadDrawable( void );
329
330extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
331 int *value );
332
333extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
334 unsigned long mask );
335
336extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
337 unsigned long *mask );
338
339
Brian Paul43c9c2c1999-09-16 15:52:51 +0000340
Brian Paul43c9c2c1999-09-16 15:52:51 +0000341/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000342extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
343 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000344
Brian Paul43c9c2c1999-09-16 15:52:51 +0000345
346/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000347extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000348
Brian Paul43c9c2c1999-09-16 15:52:51 +0000349
350/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000351extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
352 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000353
Brian Paul43c9c2c1999-09-16 15:52:51 +0000354
355/* GLX_MESA_set_3dfx_mode */
356extern GLboolean glXSet3DfxModeMESA( GLint mode );
357
358
359/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000360extern int glXGetVideoSyncSGI(unsigned int *count);
361extern int glXWaitVideoSyncSGI(int divisor, int remainder,
362 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000363
364
Brian Paul353479f2000-04-19 01:40:00 +0000365
366/* GLX_EXT_import_context */
367extern void glXFreeContextEXT(Display *dpy, GLXContext context);
368
369extern GLXContextID glXGetContextIDEXT(const GLXContext context);
370
371extern Display *glXGetCurrentDisplayEXT(void);
372
373extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID);
374
375extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context,
376 int attribute,int *value);
377
378
379
Brian Paulff06c831999-12-11 09:54:33 +0000380/* GLX_ARB_get_proc_address */
381extern void (*glXGetProcAddressARB(const GLubyte *procName))();
382
383
jtgafb833d1999-08-19 00:55:39 +0000384
385#ifdef __cplusplus
386}
387#endif
388
389#endif