removed test for MESA symbol
[mesa.git] / include / GL / glx.h
1 /* $Id: glx.h,v 1.16 2000/03/20 21:31:15 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
8 *
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
28
29 #ifndef GLX_H
30 #define GLX_H
31
32
33 #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
40 #include <X11/Xlib.h>
41 #include <X11/Xutil.h>
42 #ifdef __VMS
43 # ifdef __cplusplus
44 #pragma message enable nosimpint
45 #endif
46 #endif
47 #include "GL/gl.h"
48
49
50 #if defined(USE_MGL_NAMESPACE)
51 #include "glx_mangle.h"
52 #endif
53
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59
60 #define GLX_VERSION_1_1 1
61 #define GLX_VERSION_1_2 1
62
63 #define GLX_EXTENSION_NAME "GLX"
64
65
66
67 /*
68 * Tokens for glXChooseVisual and glXGetConfig:
69 */
70 #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
87
88
89 /*
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 /*
110 * 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 */
114 #define GLX_CONFIG_CAVEAT ?
115 #define GLX_DONT_CARE ?
116 #define GLX_SLOW_CONFIG ?
117 #define GLX_NON_CONFORMANT_CONFIG ?
118 #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
125 #define GLX_MAX_PBUFFER_WIDTH ?
126 #define GLX_MAX_PBUFFER_HEIGHT ?
127 #define GLX_MAX_PBUFFER_PIXELS ?
128 #define GLX_PRESERVED_CONTENTS ?
129 #define GLX_LARGEST_BUFFER ?
130 #define GLX_DRAWABLE_TYPE ?
131 #define GLX_FBCONFIG_ID ?
132 #define GLX_VISUAL_ID ?
133 #define GLX_WINDOW_BIT ?
134 #define GLX_PIXMAP_BIT ?
135 #define GLX_PBUFFER_BIT ?
136 #define GLX_AUX_BUFFERS_BIT ?
137 #define GLX_FRONT_LEFT_BUFFER_BIT ?
138 #define GLX_FRONT_RIGHT_BUFFER_BIT ?
139 #define GLX_BACK_LEFT_BUFFER_BIT ?
140 #define GLX_BACK_RIGHT_BUFFER_BIT ?
141 #define GLX_AUX_BUFFERS_BIT ?
142 #define GLX_DEPTH_BUFFER_BIT ?
143 #define GLX_STENCIL_BUFFER_BIT ?
144 #define GLX_ACCUM_BUFFER_BIT ?
145 #define GLX_RENDER_TYPE ?
146 #define GLX_DRAWABLE_TYPE ?
147 #define GLX_X_RENDERABLE ?
148 #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
156 #define GLX_COLOR_INDEX_TYPE ?
157 #define GLX_COLOR_INDEX_BIT ?
158 #define GLX_SCREEN ?
159 #define GLX_PBUFFER_CLOBBER_MASK ?
160 #define GLX_DAMAGED ?
161 #define GLX_SAVED ?
162 #define GLX_WINDOW ?
163 #define GLX_PBUFFER ?
164
165
166 /*
167 * GLX_EXT_visual_info extension
168 */
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
176
177
178 /*
179 * GLX_visual_info extension
180 */
181 #define GLX_TRUE_COLOR_EXT 0x8002
182 #define GLX_DIRECT_COLOR_EXT 0x8003
183 #define GLX_PSEUDO_COLOR_EXT 0x8004
184 #define GLX_STATIC_COLOR_EXT 0x8005
185 #define GLX_GRAY_SCALE_EXT 0x8006
186 #define GLX_STATIC_GRAY_EXT 0x8007
187 #define GLX_NONE_EXT 0x8000
188 #define GLX_TRANSPARENT_RGB_EXT 0x8008
189 #define GLX_TRANSPARENT_INDEX_EXT 0x8009
190
191
192 /*
193 * Compile-time extension tests
194 */
195 #define GLX_EXT_visual_info 1
196 #define GLX_MESA_pixmap_colormap 1
197 #define GLX_MESA_release_buffers 1
198 #define GLX_MESA_copy_sub_buffer 1
199 #define GLX_MESA_set_3dfx_mode 1
200 #define GLX_SGI_video_sync 1
201 #define GLX_ARB_get_proc_address 1
202
203
204
205 #ifdef MESA
206 typedef XMesaContext GLXContext;
207 typedef Pixmap GLXPixmap;
208 typedef Drawable GLXDrawable;
209 #else
210 typedef void * GLXContext;
211 typedef XID GLXPixmap;
212 typedef XID GLXDrawable;
213 /* GLX 1.3 and later */
214 typedef XID GLXFBConfigID;
215 typedef XID GLXPfuffer;
216 typedef XID GLXWindow;
217 typedef XID GLXPbuffer;
218 typedef XID GLXFBConfig;
219 #endif
220 typedef XID GLXContextID;
221
222
223
224 extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
225 int *attribList );
226
227 extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
228 GLXContext shareList, Bool direct );
229
230 extern void glXDestroyContext( Display *dpy, GLXContext ctx );
231
232 extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
233 GLXContext ctx);
234
235 extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
236 unsigned long mask );
237
238 extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
239
240 extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
241 Pixmap pixmap );
242
243 extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
244
245 extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
246
247 extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
248
249 extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
250
251 extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
252 int attrib, int *value );
253
254 extern GLXContext glXGetCurrentContext( void );
255
256 extern GLXDrawable glXGetCurrentDrawable( void );
257
258 extern void glXWaitGL( void );
259
260 extern void glXWaitX( void );
261
262 extern void glXUseXFont( Font font, int first, int count, int list );
263
264
265
266 /* GLX 1.1 and later */
267 extern const char *glXQueryExtensionsString( Display *dpy, int screen );
268
269 extern const char *glXQueryServerString( Display *dpy, int screen, int name );
270
271 extern const char *glXGetClientString( Display *dpy, int name );
272
273
274 /* GLX 1.2 and later */
275 extern Display *glXGetCurrentDisplay( void );
276
277
278 /* GLX 1.3 and later */
279 extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen,
280 const int *attribList, int *nitems );
281
282 extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
283 int attribute, int *value );
284
285 extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
286 GLXFBConfig config );
287
288 extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
289 Window win, const int *attribList );
290
291 extern void glXDestroyWindow( Display *dpy, GLXWindow window );
292
293 extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
294 Pixmap pixmap, const int *attribList );
295
296 extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
297
298 extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
299 const int *attribList );
300
301 extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
302
303 extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
304 unsigned int *value );
305
306 extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
307 int renderType, GLXContext shareList,
308 Bool direct );
309
310 extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
311 GLXDrawable read, GLXContext ctx );
312
313 extern GLXDrawable glXGetCurrentReadDrawable( void );
314
315 extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
316 int *value );
317
318 extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
319 unsigned long mask );
320
321 extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
322 unsigned long *mask );
323
324
325
326 /* GLX_MESA_pixmap_colormap */
327 extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
328 Pixmap pixmap, Colormap cmap );
329
330
331 /* GLX_MESA_release_buffers */
332 extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
333
334
335 /* GLX_MESA_copy_sub_buffer */
336 extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
337 int x, int y, int width, int height );
338
339
340 /* GLX_MESA_set_3dfx_mode */
341 extern GLboolean glXSet3DfxModeMESA( GLint mode );
342
343
344 /* GLX_SGI_video_sync */
345 extern int glXGetVideoSyncSGI(unsigned int *count);
346 extern int glXWaitVideoSyncSGI(int divisor, int remainder,
347 unsigned int *count);
348
349
350 /* GLX_ARB_get_proc_address */
351 extern void (*glXGetProcAddressARB(const GLubyte *procName))();
352
353
354
355 #ifdef __cplusplus
356 }
357 #endif
358
359 #endif