added GLX_EXT_visual_rating
[mesa.git] / include / GL / glx.h
1 /* $Id: glx.h,v 1.17 2000/03/31 01:03:41 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 * 28. 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 #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 /*
188 * 42. GLX_EXT_visual_rating
189 */
190 #define GLX_VISUAL_CAVEAT_EXT 0x20
191 /*#define GLX_NONE_EXT 0x8000*/
192 #define GLX_SLOW_VISUALEXT 0x8001
193 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
194
195
196 /*
197 * Compile-time extension tests
198 */
199 #define GLX_EXT_visual_info 1
200 #define GLX_EXT_visual_rating 1
201 #define GLX_MESA_pixmap_colormap 1
202 #define GLX_MESA_release_buffers 1
203 #define GLX_MESA_copy_sub_buffer 1
204 #define GLX_MESA_set_3dfx_mode 1
205 #define GLX_SGI_video_sync 1
206 #define GLX_ARB_get_proc_address 1
207
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;
218 /* 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;
224 #endif
225 typedef XID GLXContextID;
226
227
228
229 extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
230 int *attribList );
231
232 extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
233 GLXContext shareList, Bool direct );
234
235 extern void glXDestroyContext( Display *dpy, GLXContext ctx );
236
237 extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
238 GLXContext ctx);
239
240 extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
241 unsigned long mask );
242
243 extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
244
245 extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
246 Pixmap pixmap );
247
248 extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
249
250 extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
251
252 extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
253
254 extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
255
256 extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
257 int attrib, int *value );
258
259 extern GLXContext glXGetCurrentContext( void );
260
261 extern GLXDrawable glXGetCurrentDrawable( void );
262
263 extern void glXWaitGL( void );
264
265 extern void glXWaitX( void );
266
267 extern void glXUseXFont( Font font, int first, int count, int list );
268
269
270
271 /* GLX 1.1 and later */
272 extern const char *glXQueryExtensionsString( Display *dpy, int screen );
273
274 extern const char *glXQueryServerString( Display *dpy, int screen, int name );
275
276 extern const char *glXGetClientString( Display *dpy, int name );
277
278
279 /* GLX 1.2 and later */
280 extern Display *glXGetCurrentDisplay( void );
281
282
283 /* GLX 1.3 and later */
284 extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen,
285 const int *attribList, int *nitems );
286
287 extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
288 int attribute, int *value );
289
290 extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
291 GLXFBConfig config );
292
293 extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
294 Window win, const int *attribList );
295
296 extern void glXDestroyWindow( Display *dpy, GLXWindow window );
297
298 extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
299 Pixmap pixmap, const int *attribList );
300
301 extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
302
303 extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
304 const int *attribList );
305
306 extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
307
308 extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
309 unsigned int *value );
310
311 extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
312 int renderType, GLXContext shareList,
313 Bool direct );
314
315 extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
316 GLXDrawable read, GLXContext ctx );
317
318 extern GLXDrawable glXGetCurrentReadDrawable( void );
319
320 extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
321 int *value );
322
323 extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
324 unsigned long mask );
325
326 extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
327 unsigned long *mask );
328
329
330
331 /* GLX_MESA_pixmap_colormap */
332 extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
333 Pixmap pixmap, Colormap cmap );
334
335
336 /* GLX_MESA_release_buffers */
337 extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
338
339
340 /* GLX_MESA_copy_sub_buffer */
341 extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
342 int x, int y, int width, int height );
343
344
345 /* GLX_MESA_set_3dfx_mode */
346 extern GLboolean glXSet3DfxModeMESA( GLint mode );
347
348
349 /* GLX_SGI_video_sync */
350 extern int glXGetVideoSyncSGI(unsigned int *count);
351 extern int glXWaitVideoSyncSGI(int divisor, int remainder,
352 unsigned int *count);
353
354
355 /* GLX_ARB_get_proc_address */
356 extern void (*glXGetProcAddressARB(const GLubyte *procName))();
357
358
359
360 #ifdef __cplusplus
361 }
362 #endif
363
364 #endif