blob: e9f8cbf50f58fe2ec95079fafb98282c69072041 [file] [log] [blame]
Brian Paul47e719f2000-04-10 21:12:20 +00001/* $Id: glx.h,v 1.19 2000/04/10 21:12:20 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:
111 * XXX don't know the values of some of these enums!
112 * XXX some 1.3 enums may be missing!
113 */
Brian Paul47e719f2000-04-10 21:12:20 +0000114#define GLX_CONFIG_CAVEAT 0x20
115#define GLX_DONT_CARE 0xFFFFFFFF
116#define GLX_SLOW_CONFIG 0x8001
117#define GLX_NON_CONFORMANT_CONFIG 0x800D
Brian Paul664a1f81999-11-23 19:54:53 +0000118#define GLX_X_VISUAL_TYPE 0x22
119#define GLX_TRANSPARENT_TYPE 0x23
120#define GLX_TRANSPARENT_INDEX_VALUE 0x24
121#define GLX_TRANSPARENT_RED_VALUE 0x25
122#define GLX_TRANSPARENT_GREEN_VALUE 0x26
123#define GLX_TRANSPARENT_BLUE_VALUE 0x27
124#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
Brian Paul47e719f2000-04-10 21:12:20 +0000125#define GLX_MAX_PBUFFER_WIDTH 0x8016
126#define GLX_MAX_PBUFFER_HEIGHT 0x8017
127#define GLX_MAX_PBUFFER_PIXELS 0x8018
128#define GLX_PRESERVED_CONTENTS 0x801B
129#define GLX_LARGEST_BUFFER 0x801C
130#define GLX_DRAWABLE_TYPE 0x8010
131#define GLX_FBCONFIG_ID 0x8013
132#define GLX_VISUAL_ID 0x800B
133#define GLX_WINDOW_BIT 0x00000001
134#define GLX_PIXMAP_BIT 0x00000002
135#define GLX_PBUFFER_BIT 0x00000004
136#define GLX_AUX_BUFFERS_BIT 0x00000010
137#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
138#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
139#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
140#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
141#define GLX_AUX_BUFFERS_BIT 0x00000010
142#define GLX_DEPTH_BUFFER_BIT 0x00000020
143#define GLX_STENCIL_BUFFER_BIT 0x00000040
144#define GLX_ACCUM_BUFFER_BIT 0x00000080
145#define GLX_DRAWABLE_TYPE 0x8010
146#define GLX_RENDER_TYPE 0x8011
147#define GLX_X_RENDERABLE 0x8012
Brian Paul664a1f81999-11-23 19:54:53 +0000148#define GLX_NONE 0x8000
149#define GLX_TRUE_COLOR 0x8002
150#define GLX_DIRECT_COLOR 0x8003
151#define GLX_PSEUDO_COLOR 0x8004
152#define GLX_STATIC_COLOR 0x8005
153#define GLX_GRAY_SCALE 0x8006
154#define GLX_STATIC_GRAY 0x8007
155#define GLX_TRANSPARENT_INDEX 0x8009
Brian Paul47e719f2000-04-10 21:12:20 +0000156#define GLX_COLOR_INDEX_TYPE 0x8015
157#define GLX_COLOR_INDEX_BIT 0x00000002
158#define GLX_SCREEN 0x800C
159#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
160#define GLX_DAMAGED 0x8020
161#define GLX_SAVED 0x8021
162#define GLX_WINDOW 0x8022
163#define GLX_PBUFFER 0x8033
Brian Paul664a1f81999-11-23 19:54:53 +0000164
165
166/*
Brian Paulbd2055c2000-03-31 01:03:41 +0000167 * 28. GLX_EXT_visual_info extension
Brian Paul664a1f81999-11-23 19:54:53 +0000168 */
169#define GLX_X_VISUAL_TYPE_EXT 0x22
170#define GLX_TRANSPARENT_TYPE_EXT 0x23
171#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
172#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
173#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
174#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
175#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
jtgafb833d1999-08-19 00:55:39 +0000176#define GLX_TRUE_COLOR_EXT 0x8002
177#define GLX_DIRECT_COLOR_EXT 0x8003
178#define GLX_PSEUDO_COLOR_EXT 0x8004
179#define GLX_STATIC_COLOR_EXT 0x8005
180#define GLX_GRAY_SCALE_EXT 0x8006
181#define GLX_STATIC_GRAY_EXT 0x8007
182#define GLX_NONE_EXT 0x8000
183#define GLX_TRANSPARENT_RGB_EXT 0x8008
184#define GLX_TRANSPARENT_INDEX_EXT 0x8009
185
186
187/*
Brian Paulbd2055c2000-03-31 01:03:41 +0000188 * 42. GLX_EXT_visual_rating
189 */
190#define GLX_VISUAL_CAVEAT_EXT 0x20
191/*#define GLX_NONE_EXT 0x8000*/
Brian Paul37d34bc2000-03-31 14:48:28 +0000192#define GLX_SLOW_VISUAL_EXT 0x8001
Brian Paulbd2055c2000-03-31 01:03:41 +0000193#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
194
195
196/*
jtgafb833d1999-08-19 00:55:39 +0000197 * Compile-time extension tests
198 */
jtgafb833d1999-08-19 00:55:39 +0000199#define GLX_EXT_visual_info 1
Brian Paulbd2055c2000-03-31 01:03:41 +0000200#define GLX_EXT_visual_rating 1
jtgafb833d1999-08-19 00:55:39 +0000201#define GLX_MESA_pixmap_colormap 1
202#define GLX_MESA_release_buffers 1
203#define GLX_MESA_copy_sub_buffer 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000204#define GLX_MESA_set_3dfx_mode 1
jtgafb833d1999-08-19 00:55:39 +0000205#define GLX_SGI_video_sync 1
Brian Paulff06c831999-12-11 09:54:33 +0000206#define GLX_ARB_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000207
208
209
210#ifdef MESA
211 typedef XMesaContext GLXContext;
212 typedef Pixmap GLXPixmap;
213 typedef Drawable GLXDrawable;
214#else
215 typedef void * GLXContext;
216 typedef XID GLXPixmap;
217 typedef XID GLXDrawable;
Brian Paul664a1f81999-11-23 19:54:53 +0000218 /* GLX 1.3 and later */
219 typedef XID GLXFBConfigID;
220 typedef XID GLXPfuffer;
221 typedef XID GLXWindow;
222 typedef XID GLXPbuffer;
223 typedef XID GLXFBConfig;
jtgafb833d1999-08-19 00:55:39 +0000224#endif
225typedef XID GLXContextID;
226
227
228
229extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
230 int *attribList );
231
232extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
233 GLXContext shareList, Bool direct );
234
235extern void glXDestroyContext( Display *dpy, GLXContext ctx );
236
237extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
238 GLXContext ctx);
239
240extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
Brian Paul3994b772000-02-27 18:26:54 +0000241 unsigned long mask );
jtgafb833d1999-08-19 00:55:39 +0000242
243extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
244
245extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
246 Pixmap pixmap );
247
248extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
249
250extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
251
252extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
253
254extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
255
256extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
257 int attrib, int *value );
258
259extern GLXContext glXGetCurrentContext( void );
260
261extern GLXDrawable glXGetCurrentDrawable( void );
262
263extern void glXWaitGL( void );
264
265extern void glXWaitX( void );
266
267extern void glXUseXFont( Font font, int first, int count, int list );
268
269
270
271/* GLX 1.1 and later */
272extern const char *glXQueryExtensionsString( Display *dpy, int screen );
273
274extern const char *glXQueryServerString( Display *dpy, int screen, int name );
275
276extern const char *glXGetClientString( Display *dpy, int name );
277
278
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000279/* GLX 1.2 and later */
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000280extern Display *glXGetCurrentDisplay( void );
281
282
Brian Paul664a1f81999-11-23 19:54:53 +0000283/* GLX 1.3 and later */
Brian Paul47e719f2000-04-10 21:12:20 +0000284extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
285 const int *attribList, int *nitems );
Brian Paul664a1f81999-11-23 19:54:53 +0000286
287extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
288 int attribute, int *value );
289
Brian Paul47e719f2000-04-10 21:12:20 +0000290extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
291 int *nelements );
292
Brian Paul664a1f81999-11-23 19:54:53 +0000293extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
294 GLXFBConfig config );
295
296extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
297 Window win, const int *attribList );
298
299extern void glXDestroyWindow( Display *dpy, GLXWindow window );
300
301extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
302 Pixmap pixmap, const int *attribList );
303
304extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
305
306extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
307 const int *attribList );
308
309extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
310
311extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
312 unsigned int *value );
313
314extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
315 int renderType, GLXContext shareList,
316 Bool direct );
317
318extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
319 GLXDrawable read, GLXContext ctx );
320
321extern GLXDrawable glXGetCurrentReadDrawable( void );
322
323extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
324 int *value );
325
326extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
327 unsigned long mask );
328
329extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
330 unsigned long *mask );
331
332
Brian Paul43c9c2c1999-09-16 15:52:51 +0000333
Brian Paul43c9c2c1999-09-16 15:52:51 +0000334/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000335extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
336 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000337
Brian Paul43c9c2c1999-09-16 15:52:51 +0000338
339/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000340extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000341
Brian Paul43c9c2c1999-09-16 15:52:51 +0000342
343/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000344extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
345 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000346
Brian Paul43c9c2c1999-09-16 15:52:51 +0000347
348/* GLX_MESA_set_3dfx_mode */
349extern GLboolean glXSet3DfxModeMESA( GLint mode );
350
351
352/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000353extern int glXGetVideoSyncSGI(unsigned int *count);
354extern int glXWaitVideoSyncSGI(int divisor, int remainder,
355 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000356
357
Brian Paulff06c831999-12-11 09:54:33 +0000358/* GLX_ARB_get_proc_address */
359extern void (*glXGetProcAddressARB(const GLubyte *procName))();
360
361
jtgafb833d1999-08-19 00:55:39 +0000362
363#ifdef __cplusplus
364}
365#endif
366
367#endif