blob: e3a580bc814599af0e00c4358189ecc6f08d3931 [file] [log] [blame]
Brian Paul54ec0cb2000-03-03 15:35:51 +00001/* $Id: glx.h,v 1.14 2000/03/03 15:35:51 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
jtgafb833d1999-08-19 00:55:39 +000033#include <X11/Xlib.h>
34#include <X11/Xutil.h>
35#include "GL/gl.h"
36#ifdef MESA
37#include "GL/xmesa.h"
38#endif
39
40
41#if defined(USE_MGL_NAMESPACE)
42#include "glx_mangle.h"
43#endif
44
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50
51#define GLX_VERSION_1_1 1
Brian Paulbf3f9bd1999-11-22 21:51:53 +000052#define GLX_VERSION_1_2 1
jtgafb833d1999-08-19 00:55:39 +000053
Brian Paulfbd8f211999-11-11 01:22:25 +000054#define GLX_EXTENSION_NAME "GLX"
55
56
jtgafb833d1999-08-19 00:55:39 +000057
58/*
59 * Tokens for glXChooseVisual and glXGetConfig:
60 */
Brian Paulfbd8f211999-11-11 01:22:25 +000061#define GLX_USE_GL 1
62#define GLX_BUFFER_SIZE 2
63#define GLX_LEVEL 3
64#define GLX_RGBA 4
65#define GLX_DOUBLEBUFFER 5
66#define GLX_STEREO 6
67#define GLX_AUX_BUFFERS 7
68#define GLX_RED_SIZE 8
69#define GLX_GREEN_SIZE 9
70#define GLX_BLUE_SIZE 10
71#define GLX_ALPHA_SIZE 11
72#define GLX_DEPTH_SIZE 12
73#define GLX_STENCIL_SIZE 13
74#define GLX_ACCUM_RED_SIZE 14
75#define GLX_ACCUM_GREEN_SIZE 15
76#define GLX_ACCUM_BLUE_SIZE 16
77#define GLX_ACCUM_ALPHA_SIZE 17
jtgafb833d1999-08-19 00:55:39 +000078
Brian Paulfbd8f211999-11-11 01:22:25 +000079
jtgafb833d1999-08-19 00:55:39 +000080/*
81 * Error codes returned by glXGetConfig:
82 */
83#define GLX_BAD_SCREEN 1
84#define GLX_BAD_ATTRIBUTE 2
85#define GLX_NO_EXTENSION 3
86#define GLX_BAD_VISUAL 4
87#define GLX_BAD_CONTEXT 5
88#define GLX_BAD_VALUE 6
89#define GLX_BAD_ENUM 7
90
91
92/*
93 * GLX 1.1 and later:
94 */
95#define GLX_VENDOR 1
96#define GLX_VERSION 2
97#define GLX_EXTENSIONS 3
98
99
100/*
Brian Paul664a1f81999-11-23 19:54:53 +0000101 * GLX 1.3 and later:
102 * XXX don't know the values of some of these enums!
103 * XXX some 1.3 enums may be missing!
104 */
105#define GLX_CONFIG_CAVEAT ?
106#define GLX_DONT_CARE ?
107#define GLX_SLOW_CONFIG ?
108#define GLX_NON_CONFORMANT_CONFIG ?
109#define GLX_X_VISUAL_TYPE 0x22
110#define GLX_TRANSPARENT_TYPE 0x23
111#define GLX_TRANSPARENT_INDEX_VALUE 0x24
112#define GLX_TRANSPARENT_RED_VALUE 0x25
113#define GLX_TRANSPARENT_GREEN_VALUE 0x26
114#define GLX_TRANSPARENT_BLUE_VALUE 0x27
115#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
116#define GLX_MAX_PBUFFER_WIDTH ?
117#define GLX_MAX_PBUFFER_HEIGHT ?
118#define GLX_MAX_PBUFFER_PIXELS ?
119#define GLX_PRESERVED_CONTENTS ?
120#define GLX_LARGEST_BUFFER ?
121#define GLX_DRAWABLE_TYPE ?
122#define GLX_FBCONFIG_ID ?
123#define GLX_VISUAL_ID ?
124#define GLX_WINDOW_BIT ?
Brian Paulb314d1d1999-11-24 17:04:46 +0000125#define GLX_PIXMAP_BIT ?
Brian Paul664a1f81999-11-23 19:54:53 +0000126#define GLX_PBUFFER_BIT ?
127#define GLX_AUX_BUFFERS_BIT ?
128#define GLX_FRONT_LEFT_BUFFER_BIT ?
129#define GLX_FRONT_RIGHT_BUFFER_BIT ?
130#define GLX_BACK_LEFT_BUFFER_BIT ?
131#define GLX_BACK_RIGHT_BUFFER_BIT ?
132#define GLX_AUX_BUFFERS_BIT ?
133#define GLX_DEPTH_BUFFER_BIT ?
134#define GLX_STENCIL_BUFFER_BIT ?
135#define GLX_ACCUM_BUFFER_BIT ?
136#define GLX_RENDER_TYPE ?
137#define GLX_DRAWABLE_TYPE ?
138#define GLX_X_RENDERABLE ?
139#define GLX_NONE 0x8000
140#define GLX_TRUE_COLOR 0x8002
141#define GLX_DIRECT_COLOR 0x8003
142#define GLX_PSEUDO_COLOR 0x8004
143#define GLX_STATIC_COLOR 0x8005
144#define GLX_GRAY_SCALE 0x8006
145#define GLX_STATIC_GRAY 0x8007
146#define GLX_TRANSPARENT_INDEX 0x8009
147#define GLX_COLOR_INDEX_TYPE ?
Brian Paulb314d1d1999-11-24 17:04:46 +0000148#define GLX_COLOR_INDEX_BIT ?
Brian Paul664a1f81999-11-23 19:54:53 +0000149#define GLX_SCREEN ?
150#define GLX_PBUFFER_CLOBBER_MASK ?
151#define GLX_DAMAGED ?
152#define GLX_SAVED ?
153#define GLX_WINDOW ?
154#define GLX_PBUFFER ?
155
156
157/*
158 * GLX_EXT_visual_info extension
159 */
160#define GLX_X_VISUAL_TYPE_EXT 0x22
161#define GLX_TRANSPARENT_TYPE_EXT 0x23
162#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
163#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
164#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
165#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
166#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
167
168
169/*
jtgafb833d1999-08-19 00:55:39 +0000170 * GLX_visual_info extension
171 */
172#define GLX_TRUE_COLOR_EXT 0x8002
173#define GLX_DIRECT_COLOR_EXT 0x8003
174#define GLX_PSEUDO_COLOR_EXT 0x8004
175#define GLX_STATIC_COLOR_EXT 0x8005
176#define GLX_GRAY_SCALE_EXT 0x8006
177#define GLX_STATIC_GRAY_EXT 0x8007
178#define GLX_NONE_EXT 0x8000
179#define GLX_TRANSPARENT_RGB_EXT 0x8008
180#define GLX_TRANSPARENT_INDEX_EXT 0x8009
181
182
183/*
184 * Compile-time extension tests
185 */
jtgafb833d1999-08-19 00:55:39 +0000186#define GLX_EXT_visual_info 1
187#define GLX_MESA_pixmap_colormap 1
188#define GLX_MESA_release_buffers 1
189#define GLX_MESA_copy_sub_buffer 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000190#define GLX_MESA_set_3dfx_mode 1
jtgafb833d1999-08-19 00:55:39 +0000191#define GLX_SGI_video_sync 1
Brian Paulff06c831999-12-11 09:54:33 +0000192#define GLX_ARB_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000193
194
195
196#ifdef MESA
197 typedef XMesaContext GLXContext;
198 typedef Pixmap GLXPixmap;
199 typedef Drawable GLXDrawable;
200#else
201 typedef void * GLXContext;
202 typedef XID GLXPixmap;
203 typedef XID GLXDrawable;
Brian Paul664a1f81999-11-23 19:54:53 +0000204 /* GLX 1.3 and later */
205 typedef XID GLXFBConfigID;
206 typedef XID GLXPfuffer;
207 typedef XID GLXWindow;
208 typedef XID GLXPbuffer;
209 typedef XID GLXFBConfig;
jtgafb833d1999-08-19 00:55:39 +0000210#endif
211typedef XID GLXContextID;
212
213
214
215extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
216 int *attribList );
217
218extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
219 GLXContext shareList, Bool direct );
220
221extern void glXDestroyContext( Display *dpy, GLXContext ctx );
222
223extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
224 GLXContext ctx);
225
226extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
Brian Paul3994b772000-02-27 18:26:54 +0000227 unsigned long mask );
jtgafb833d1999-08-19 00:55:39 +0000228
229extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
230
231extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
232 Pixmap pixmap );
233
234extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
235
236extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
237
238extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
239
240extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
241
242extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
243 int attrib, int *value );
244
245extern GLXContext glXGetCurrentContext( void );
246
247extern GLXDrawable glXGetCurrentDrawable( void );
248
249extern void glXWaitGL( void );
250
251extern void glXWaitX( void );
252
253extern void glXUseXFont( Font font, int first, int count, int list );
254
255
256
257/* GLX 1.1 and later */
258extern const char *glXQueryExtensionsString( Display *dpy, int screen );
259
260extern const char *glXQueryServerString( Display *dpy, int screen, int name );
261
262extern const char *glXGetClientString( Display *dpy, int name );
263
264
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000265/* GLX 1.2 and later */
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000266extern Display *glXGetCurrentDisplay( void );
267
268
Brian Paul664a1f81999-11-23 19:54:53 +0000269/* GLX 1.3 and later */
270extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen,
271 const int *attribList, int *nitems );
272
273extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
274 int attribute, int *value );
275
276extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
277 GLXFBConfig config );
278
279extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
280 Window win, const int *attribList );
281
282extern void glXDestroyWindow( Display *dpy, GLXWindow window );
283
284extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
285 Pixmap pixmap, const int *attribList );
286
287extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
288
289extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
290 const int *attribList );
291
292extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
293
294extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
295 unsigned int *value );
296
297extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
298 int renderType, GLXContext shareList,
299 Bool direct );
300
301extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
302 GLXDrawable read, GLXContext ctx );
303
304extern GLXDrawable glXGetCurrentReadDrawable( void );
305
306extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
307 int *value );
308
309extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
310 unsigned long mask );
311
312extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
313 unsigned long *mask );
314
315
Brian Paul43c9c2c1999-09-16 15:52:51 +0000316
Brian Paul43c9c2c1999-09-16 15:52:51 +0000317/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000318extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
319 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000320
Brian Paul43c9c2c1999-09-16 15:52:51 +0000321
322/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000323extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000324
Brian Paul43c9c2c1999-09-16 15:52:51 +0000325
326/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000327extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
328 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000329
Brian Paul43c9c2c1999-09-16 15:52:51 +0000330
331/* GLX_MESA_set_3dfx_mode */
332extern GLboolean glXSet3DfxModeMESA( GLint mode );
333
334
335/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000336extern int glXGetVideoSyncSGI(unsigned int *count);
337extern int glXWaitVideoSyncSGI(int divisor, int remainder,
338 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000339
340
Brian Paulff06c831999-12-11 09:54:33 +0000341/* GLX_ARB_get_proc_address */
342extern void (*glXGetProcAddressARB(const GLubyte *procName))();
343
344
jtgafb833d1999-08-19 00:55:39 +0000345
346#ifdef __cplusplus
347}
348#endif
349
350#endif