blob: e98f9cb8e7440456bbd494ed7832167c02b984c9 [file] [log] [blame]
Brian Paul664a1f81999-11-23 19:54:53 +00001/* $Id: glx.h,v 1.8 1999/11/23 19:54:53 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 *
7 * Copyright (C) 1999 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
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
Brian Paul664a1f81999-11-23 19:54:53 +000053#define GLX_VERSION_1_3 1
jtgafb833d1999-08-19 00:55:39 +000054
Brian Paulfbd8f211999-11-11 01:22:25 +000055#define GLX_EXTENSION_NAME "GLX"
56
57
jtgafb833d1999-08-19 00:55:39 +000058
59/*
60 * Tokens for glXChooseVisual and glXGetConfig:
61 */
Brian Paulfbd8f211999-11-11 01:22:25 +000062#define GLX_USE_GL 1
63#define GLX_BUFFER_SIZE 2
64#define GLX_LEVEL 3
65#define GLX_RGBA 4
66#define GLX_DOUBLEBUFFER 5
67#define GLX_STEREO 6
68#define GLX_AUX_BUFFERS 7
69#define GLX_RED_SIZE 8
70#define GLX_GREEN_SIZE 9
71#define GLX_BLUE_SIZE 10
72#define GLX_ALPHA_SIZE 11
73#define GLX_DEPTH_SIZE 12
74#define GLX_STENCIL_SIZE 13
75#define GLX_ACCUM_RED_SIZE 14
76#define GLX_ACCUM_GREEN_SIZE 15
77#define GLX_ACCUM_BLUE_SIZE 16
78#define GLX_ACCUM_ALPHA_SIZE 17
jtgafb833d1999-08-19 00:55:39 +000079
Brian Paulfbd8f211999-11-11 01:22:25 +000080
jtgafb833d1999-08-19 00:55:39 +000081/*
82 * Error codes returned by glXGetConfig:
83 */
84#define GLX_BAD_SCREEN 1
85#define GLX_BAD_ATTRIBUTE 2
86#define GLX_NO_EXTENSION 3
87#define GLX_BAD_VISUAL 4
88#define GLX_BAD_CONTEXT 5
89#define GLX_BAD_VALUE 6
90#define GLX_BAD_ENUM 7
91
92
93/*
94 * GLX 1.1 and later:
95 */
96#define GLX_VENDOR 1
97#define GLX_VERSION 2
98#define GLX_EXTENSIONS 3
99
100
101/*
Brian Paul664a1f81999-11-23 19:54:53 +0000102 * GLX 1.3 and later:
103 * XXX don't know the values of some of these enums!
104 * XXX some 1.3 enums may be missing!
105 */
106#define GLX_CONFIG_CAVEAT ?
107#define GLX_DONT_CARE ?
108#define GLX_SLOW_CONFIG ?
109#define GLX_NON_CONFORMANT_CONFIG ?
110#define GLX_X_VISUAL_TYPE 0x22
111#define GLX_TRANSPARENT_TYPE 0x23
112#define GLX_TRANSPARENT_INDEX_VALUE 0x24
113#define GLX_TRANSPARENT_RED_VALUE 0x25
114#define GLX_TRANSPARENT_GREEN_VALUE 0x26
115#define GLX_TRANSPARENT_BLUE_VALUE 0x27
116#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
117#define GLX_MAX_PBUFFER_WIDTH ?
118#define GLX_MAX_PBUFFER_HEIGHT ?
119#define GLX_MAX_PBUFFER_PIXELS ?
120#define GLX_PRESERVED_CONTENTS ?
121#define GLX_LARGEST_BUFFER ?
122#define GLX_DRAWABLE_TYPE ?
123#define GLX_FBCONFIG_ID ?
124#define GLX_VISUAL_ID ?
125#define GLX_WINDOW_BIT ?
126#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 ?
148#define GLX_SCREEN ?
149#define GLX_PBUFFER_CLOBBER_MASK ?
150#define GLX_DAMAGED ?
151#define GLX_SAVED ?
152#define GLX_WINDOW ?
153#define GLX_PBUFFER ?
154
155
156/*
157 * GLX_EXT_visual_info extension
158 */
159#define GLX_X_VISUAL_TYPE_EXT 0x22
160#define GLX_TRANSPARENT_TYPE_EXT 0x23
161#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
162#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
163#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
164#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
165#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
166
167
168/*
jtgafb833d1999-08-19 00:55:39 +0000169 * GLX_visual_info extension
170 */
171#define GLX_TRUE_COLOR_EXT 0x8002
172#define GLX_DIRECT_COLOR_EXT 0x8003
173#define GLX_PSEUDO_COLOR_EXT 0x8004
174#define GLX_STATIC_COLOR_EXT 0x8005
175#define GLX_GRAY_SCALE_EXT 0x8006
176#define GLX_STATIC_GRAY_EXT 0x8007
177#define GLX_NONE_EXT 0x8000
178#define GLX_TRANSPARENT_RGB_EXT 0x8008
179#define GLX_TRANSPARENT_INDEX_EXT 0x8009
180
181
182/*
183 * Compile-time extension tests
184 */
jtgafb833d1999-08-19 00:55:39 +0000185#define GLX_EXT_visual_info 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000186#define GLX_EXT_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000187#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
jtgafb833d1999-08-19 00:55:39 +0000192
193
194
195#ifdef MESA
196 typedef XMesaContext GLXContext;
197 typedef Pixmap GLXPixmap;
198 typedef Drawable GLXDrawable;
199#else
200 typedef void * GLXContext;
201 typedef XID GLXPixmap;
202 typedef XID GLXDrawable;
Brian Paul664a1f81999-11-23 19:54:53 +0000203 /* GLX 1.3 and later */
204 typedef XID GLXFBConfigID;
205 typedef XID GLXPfuffer;
206 typedef XID GLXWindow;
207 typedef XID GLXPbuffer;
208 typedef XID GLXFBConfig;
jtgafb833d1999-08-19 00:55:39 +0000209#endif
210typedef XID GLXContextID;
211
212
213
214extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
215 int *attribList );
216
217extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
218 GLXContext shareList, Bool direct );
219
220extern void glXDestroyContext( Display *dpy, GLXContext ctx );
221
222extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
223 GLXContext ctx);
224
225extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
226 GLuint mask );
227
228extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
229
230extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
231 Pixmap pixmap );
232
233extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
234
235extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
236
237extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
238
239extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
240
241extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
242 int attrib, int *value );
243
244extern GLXContext glXGetCurrentContext( void );
245
246extern GLXDrawable glXGetCurrentDrawable( void );
247
248extern void glXWaitGL( void );
249
250extern void glXWaitX( void );
251
252extern void glXUseXFont( Font font, int first, int count, int list );
253
254
255
256/* GLX 1.1 and later */
257extern const char *glXQueryExtensionsString( Display *dpy, int screen );
258
259extern const char *glXQueryServerString( Display *dpy, int screen, int name );
260
261extern const char *glXGetClientString( Display *dpy, int name );
262
263
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000264/* GLX 1.2 and later */
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000265extern Display *glXGetCurrentDisplay( void );
266
267
Brian Paul664a1f81999-11-23 19:54:53 +0000268/* GLX 1.3 and later */
269extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen,
270 const int *attribList, int *nitems );
271
272extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
273 int attribute, int *value );
274
275extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
276 GLXFBConfig config );
277
278extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
279 Window win, const int *attribList );
280
281extern void glXDestroyWindow( Display *dpy, GLXWindow window );
282
283extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
284 Pixmap pixmap, const int *attribList );
285
286extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
287
288extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
289 const int *attribList );
290
291extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
292
293extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
294 unsigned int *value );
295
296extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
297 int renderType, GLXContext shareList,
298 Bool direct );
299
300extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
301 GLXDrawable read, GLXContext ctx );
302
303extern GLXDrawable glXGetCurrentReadDrawable( void );
304
305extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
306 int *value );
307
308extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
309 unsigned long mask );
310
311extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
312 unsigned long *mask );
313
314
Brian Paul43c9c2c1999-09-16 15:52:51 +0000315
Brian Paul43c9c2c1999-09-16 15:52:51 +0000316/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000317extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
318 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000319
Brian Paul43c9c2c1999-09-16 15:52:51 +0000320
321/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000322extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000323
Brian Paul43c9c2c1999-09-16 15:52:51 +0000324
325/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000326extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
327 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000328
Brian Paul43c9c2c1999-09-16 15:52:51 +0000329
330/* GLX_MESA_set_3dfx_mode */
331extern GLboolean glXSet3DfxModeMESA( GLint mode );
332
333
334/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000335extern int glXGetVideoSyncSGI(unsigned int *count);
336extern int glXWaitVideoSyncSGI(int divisor, int remainder,
337 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000338
339
340
341#ifdef __cplusplus
342}
343#endif
344
345#endif