change GLXContext and GLXFBConfig typedefs
[mesa.git] / include / GL / glx.h
1 /* $Id: glx.h,v 1.27 2001/05/24 19:07:14 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
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 #ifndef GLX_H
29 #define GLX_H
30
31
32 #ifdef __VMS
33 #include <GL/vms_x_fix.h>
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 <GL/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 #define GLX_VERSION_1_3 1
63
64 #define GLX_EXTENSION_NAME "GLX"
65
66
67
68 /*
69 * Tokens for glXChooseVisual and glXGetConfig:
70 */
71 #define GLX_USE_GL 1
72 #define GLX_BUFFER_SIZE 2
73 #define GLX_LEVEL 3
74 #define GLX_RGBA 4
75 #define GLX_DOUBLEBUFFER 5
76 #define GLX_STEREO 6
77 #define GLX_AUX_BUFFERS 7
78 #define GLX_RED_SIZE 8
79 #define GLX_GREEN_SIZE 9
80 #define GLX_BLUE_SIZE 10
81 #define GLX_ALPHA_SIZE 11
82 #define GLX_DEPTH_SIZE 12
83 #define GLX_STENCIL_SIZE 13
84 #define GLX_ACCUM_RED_SIZE 14
85 #define GLX_ACCUM_GREEN_SIZE 15
86 #define GLX_ACCUM_BLUE_SIZE 16
87 #define GLX_ACCUM_ALPHA_SIZE 17
88
89
90 /*
91 * Error codes returned by glXGetConfig:
92 */
93 #define GLX_BAD_SCREEN 1
94 #define GLX_BAD_ATTRIBUTE 2
95 #define GLX_NO_EXTENSION 3
96 #define GLX_BAD_VISUAL 4
97 #define GLX_BAD_CONTEXT 5
98 #define GLX_BAD_VALUE 6
99 #define GLX_BAD_ENUM 7
100
101
102 /*
103 * GLX 1.1 and later:
104 */
105 #define GLX_VENDOR 1
106 #define GLX_VERSION 2
107 #define GLX_EXTENSIONS 3
108
109
110 /*
111 * GLX 1.3 and later:
112 */
113 #define GLX_CONFIG_CAVEAT 0x20
114 #define GLX_DONT_CARE 0xFFFFFFFF
115 #define GLX_SLOW_CONFIG 0x8001
116 #define GLX_NON_CONFORMANT_CONFIG 0x800D
117 #define GLX_X_VISUAL_TYPE 0x22
118 #define GLX_TRANSPARENT_TYPE 0x23
119 #define GLX_TRANSPARENT_INDEX_VALUE 0x24
120 #define GLX_TRANSPARENT_RED_VALUE 0x25
121 #define GLX_TRANSPARENT_GREEN_VALUE 0x26
122 #define GLX_TRANSPARENT_BLUE_VALUE 0x27
123 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28
124 #define GLX_MAX_PBUFFER_WIDTH 0x8016
125 #define GLX_MAX_PBUFFER_HEIGHT 0x8017
126 #define GLX_MAX_PBUFFER_PIXELS 0x8018
127 #define GLX_PRESERVED_CONTENTS 0x801B
128 #define GLX_LARGEST_BUFFER 0x801C
129 #define GLX_DRAWABLE_TYPE 0x8010
130 #define GLX_FBCONFIG_ID 0x8013
131 #define GLX_VISUAL_ID 0x800B
132 #define GLX_WINDOW_BIT 0x00000001
133 #define GLX_PIXMAP_BIT 0x00000002
134 #define GLX_PBUFFER_BIT 0x00000004
135 #define GLX_AUX_BUFFERS_BIT 0x00000010
136 #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
137 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
138 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
139 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
140 #define GLX_AUX_BUFFERS_BIT 0x00000010
141 #define GLX_DEPTH_BUFFER_BIT 0x00000020
142 #define GLX_STENCIL_BUFFER_BIT 0x00000040
143 #define GLX_ACCUM_BUFFER_BIT 0x00000080
144 #define GLX_DRAWABLE_TYPE 0x8010
145 #define GLX_RENDER_TYPE 0x8011
146 #define GLX_X_RENDERABLE 0x8012
147 #define GLX_NONE 0x8000
148 #define GLX_TRUE_COLOR 0x8002
149 #define GLX_DIRECT_COLOR 0x8003
150 #define GLX_PSEUDO_COLOR 0x8004
151 #define GLX_STATIC_COLOR 0x8005
152 #define GLX_GRAY_SCALE 0x8006
153 #define GLX_STATIC_GRAY 0x8007
154 #define GLX_TRANSPARENT_INDEX 0x8009
155 #define GLX_COLOR_INDEX_TYPE 0x8015
156 #define GLX_COLOR_INDEX_BIT 0x00000002
157 #define GLX_SCREEN 0x800C
158 #define GLX_PBUFFER_CLOBBER_MASK 0x08000000
159 #define GLX_DAMAGED 0x8020
160 #define GLX_SAVED 0x8021
161 #define GLX_WINDOW 0x8022
162 #define GLX_PBUFFER 0x8023
163
164
165
166 typedef struct __GLXcontextRec *GLXContext;
167 typedef XID GLXPixmap;
168 typedef XID GLXDrawable;
169 /* GLX 1.3 and later */
170 typedef struct __GLXFBConfigRec *GLXFBConfig;
171 typedef XID GLXFBConfigID;
172 typedef XID GLXContextID;
173 typedef XID GLXWindow;
174 typedef XID GLXPbuffer;
175
176
177
178 extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
179 int *attribList );
180
181 extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
182 GLXContext shareList, Bool direct );
183
184 extern void glXDestroyContext( Display *dpy, GLXContext ctx );
185
186 extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
187 GLXContext ctx);
188
189 extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
190 unsigned long mask );
191
192 extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
193
194 extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
195 Pixmap pixmap );
196
197 extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
198
199 extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
200
201 extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
202
203 extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
204
205 extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
206 int attrib, int *value );
207
208 extern GLXContext glXGetCurrentContext( void );
209
210 extern GLXDrawable glXGetCurrentDrawable( void );
211
212 extern void glXWaitGL( void );
213
214 extern void glXWaitX( void );
215
216 extern void glXUseXFont( Font font, int first, int count, int list );
217
218
219
220 /* GLX 1.1 and later */
221 extern const char *glXQueryExtensionsString( Display *dpy, int screen );
222
223 extern const char *glXQueryServerString( Display *dpy, int screen, int name );
224
225 extern const char *glXGetClientString( Display *dpy, int name );
226
227
228 /* GLX 1.2 and later */
229 extern Display *glXGetCurrentDisplay( void );
230
231
232 /* GLX 1.3 and later */
233 extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
234 const int *attribList, int *nitems );
235
236 extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
237 int attribute, int *value );
238
239 extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
240 int *nelements );
241
242 extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
243 GLXFBConfig config );
244
245 extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
246 Window win, const int *attribList );
247
248 extern void glXDestroyWindow( Display *dpy, GLXWindow window );
249
250 extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
251 Pixmap pixmap, const int *attribList );
252
253 extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
254
255 extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
256 const int *attribList );
257
258 extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
259
260 extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
261 unsigned int *value );
262
263 extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
264 int renderType, GLXContext shareList,
265 Bool direct );
266
267 extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
268 GLXDrawable read, GLXContext ctx );
269
270 extern GLXDrawable glXGetCurrentReadDrawable( void );
271
272 extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
273 int *value );
274
275 extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
276 unsigned long mask );
277
278 extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
279 unsigned long *mask );
280
281
282
283 #ifndef GLX_GLXEXT_LEGACY
284
285 #include <GL/glxext.h>
286
287 #else
288
289
290 /*
291 * 28. GLX_EXT_visual_info extension
292 */
293 #ifndef GLX_EXT_visual_info
294 #define GLX_EXT_visual_info 1
295
296 #define GLX_X_VISUAL_TYPE_EXT 0x22
297 #define GLX_TRANSPARENT_TYPE_EXT 0x23
298 #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
299 #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
300 #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
301 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
302 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
303 #define GLX_TRUE_COLOR_EXT 0x8002
304 #define GLX_DIRECT_COLOR_EXT 0x8003
305 #define GLX_PSEUDO_COLOR_EXT 0x8004
306 #define GLX_STATIC_COLOR_EXT 0x8005
307 #define GLX_GRAY_SCALE_EXT 0x8006
308 #define GLX_STATIC_GRAY_EXT 0x8007
309 #define GLX_NONE_EXT 0x8000
310 #define GLX_TRANSPARENT_RGB_EXT 0x8008
311 #define GLX_TRANSPARENT_INDEX_EXT 0x8009
312
313 #endif /* 28. GLX_EXT_visual_info extension */
314
315
316
317 /*
318 * 41. GLX_SGI_video_sync
319 */
320 #ifndef GLX_SGI_video_sync
321 #define GLX_SGI_video_sync 1
322
323 extern int glXGetVideoSyncSGI(unsigned int *count);
324 extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count);
325
326 #endif /* GLX_SGI_video_sync */
327
328
329
330 /*
331 * 42. GLX_EXT_visual_rating
332 */
333 #ifndef GLX_EXT_visual_rating
334 #define GLX_EXT_visual_rating 1
335
336 #define GLX_VISUAL_CAVEAT_EXT 0x20
337 /*#define GLX_NONE_EXT 0x8000*/
338 #define GLX_SLOW_VISUAL_EXT 0x8001
339 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
340
341 #endif /* GLX_EXT_visual_rating */
342
343
344
345 /*
346 * 47. GLX_EXT_import_context
347 */
348 #ifndef GLX_EXT_import_context
349 #define GLX_EXT_import_context 1
350
351 #define GLX_SHARE_CONTEXT_EXT 0x800A
352 #define GLX_VISUAL_ID_EXT 0x800B
353 #define GLX_SCREEN_EXT 0x800C
354
355 extern void glXFreeContextEXT(Display *dpy, GLXContext context);
356
357 extern GLXContextID glXGetContextIDEXT(const GLXContext context);
358
359 extern Display *glXGetCurrentDisplayEXT(void);
360
361 extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID);
362
363 extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context,
364 int attribute,int *value);
365
366 #endif /* GLX_EXT_import_context */
367
368
369
370 /*
371 * 215. GLX_MESA_copy_sub_buffer
372 */
373 #ifndef GLX_MESA_copy_sub_buffer
374 #define GLX_MESA_copy_sub_buffer 1
375
376 extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
377 int x, int y, int width, int height );
378
379 #endif
380
381
382
383 /*
384 * 216. GLX_MESA_pixmap_colormap
385 */
386 #ifndef GLX_MESA_pixmap_colormap
387 #define GLX_MESA_pixmap_colormap 1
388
389 extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
390 Pixmap pixmap, Colormap cmap );
391
392 #endif /* GLX_MESA_pixmap_colormap */
393
394
395
396 /*
397 * 217. GLX_MESA_release_buffers
398 */
399 #ifndef GLX_MESA_release_buffers
400 #define GLX_MESA_release_buffers 1
401
402 extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
403
404 #endif /* GLX_MESA_release_buffers */
405
406
407
408 /*
409 * 218. GLX_MESA_set_3dfx_mode
410 */
411 #ifndef GLX_MESA_set_3dfx_mode
412 #define GLX_MESA_set_3dfx_mode 1
413
414 #define GLX_3DFX_WINDOW_MODE_MESA 0x1
415 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
416
417 extern Bool glXSet3DfxModeMESA( int mode );
418
419 #endif /* GLX_MESA_set_3dfx_mode */
420
421
422
423 /*
424 * ARB 2. GLX_ARB_get_proc_address
425 */
426 #ifndef GLX_ARB_get_proc_address
427 #define GLX_ARB_get_proc_address 1
428
429 extern void (*glXGetProcAddressARB(const GLubyte *procName))();
430
431 #endif /* GLX_ARB_get_proc_address */
432
433
434
435 #endif /* GLX_GLXEXT_LEGACY */
436
437
438
439 #ifdef __cplusplus
440 }
441 #endif
442
443 #endif