blob: fcea293f9b9eb08628cbc801411471d3dd00c2c9 [file] [log] [blame]
Jouk Jansen3f600e42000-03-06 12:59:24 +00001/* $Id: glx.h,v 1.15 2000/03/06 12:59:24 joukj 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
Jouk Jansen3f600e42000-03-06 12:59:24 +000033#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
jtgafb833d1999-08-19 00:55:39 +000040#include <X11/Xlib.h>
41#include <X11/Xutil.h>
Jouk Jansen3f600e42000-03-06 12:59:24 +000042#ifdef __VMS
43# ifdef __cplusplus
44#pragma message enable nosimpint
45#endif
46#endif
jtgafb833d1999-08-19 00:55:39 +000047#include "GL/gl.h"
48#ifdef MESA
49#include "GL/xmesa.h"
50#endif
51
52
53#if defined(USE_MGL_NAMESPACE)
54#include "glx_mangle.h"
55#endif
56
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62
63#define GLX_VERSION_1_1 1
Brian Paulbf3f9bd1999-11-22 21:51:53 +000064#define GLX_VERSION_1_2 1
jtgafb833d1999-08-19 00:55:39 +000065
Brian Paulfbd8f211999-11-11 01:22:25 +000066#define GLX_EXTENSION_NAME "GLX"
67
68
jtgafb833d1999-08-19 00:55:39 +000069
70/*
71 * Tokens for glXChooseVisual and glXGetConfig:
72 */
Brian Paulfbd8f211999-11-11 01:22:25 +000073#define GLX_USE_GL 1
74#define GLX_BUFFER_SIZE 2
75#define GLX_LEVEL 3
76#define GLX_RGBA 4
77#define GLX_DOUBLEBUFFER 5
78#define GLX_STEREO 6
79#define GLX_AUX_BUFFERS 7
80#define GLX_RED_SIZE 8
81#define GLX_GREEN_SIZE 9
82#define GLX_BLUE_SIZE 10
83#define GLX_ALPHA_SIZE 11
84#define GLX_DEPTH_SIZE 12
85#define GLX_STENCIL_SIZE 13
86#define GLX_ACCUM_RED_SIZE 14
87#define GLX_ACCUM_GREEN_SIZE 15
88#define GLX_ACCUM_BLUE_SIZE 16
89#define GLX_ACCUM_ALPHA_SIZE 17
jtgafb833d1999-08-19 00:55:39 +000090
Brian Paulfbd8f211999-11-11 01:22:25 +000091
jtgafb833d1999-08-19 00:55:39 +000092/*
93 * Error codes returned by glXGetConfig:
94 */
95#define GLX_BAD_SCREEN 1
96#define GLX_BAD_ATTRIBUTE 2
97#define GLX_NO_EXTENSION 3
98#define GLX_BAD_VISUAL 4
99#define GLX_BAD_CONTEXT 5
100#define GLX_BAD_VALUE 6
101#define GLX_BAD_ENUM 7
102
103
104/*
105 * GLX 1.1 and later:
106 */
107#define GLX_VENDOR 1
108#define GLX_VERSION 2
109#define GLX_EXTENSIONS 3
110
111
112/*
Brian Paul664a1f81999-11-23 19:54:53 +0000113 * GLX 1.3 and later:
114 * XXX don't know the values of some of these enums!
115 * XXX some 1.3 enums may be missing!
116 */
117#define GLX_CONFIG_CAVEAT ?
118#define GLX_DONT_CARE ?
119#define GLX_SLOW_CONFIG ?
120#define GLX_NON_CONFORMANT_CONFIG ?
121#define GLX_X_VISUAL_TYPE 0x22
122#define GLX_TRANSPARENT_TYPE 0x23
123#define GLX_TRANSPARENT_INDEX_VALUE 0x24
124#define GLX_TRANSPARENT_RED_VALUE 0x25
125#define GLX_TRANSPARENT_GREEN_VALUE 0x26
126#define GLX_TRANSPARENT_BLUE_VALUE 0x27
127#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
128#define GLX_MAX_PBUFFER_WIDTH ?
129#define GLX_MAX_PBUFFER_HEIGHT ?
130#define GLX_MAX_PBUFFER_PIXELS ?
131#define GLX_PRESERVED_CONTENTS ?
132#define GLX_LARGEST_BUFFER ?
133#define GLX_DRAWABLE_TYPE ?
134#define GLX_FBCONFIG_ID ?
135#define GLX_VISUAL_ID ?
136#define GLX_WINDOW_BIT ?
Brian Paulb314d1d1999-11-24 17:04:46 +0000137#define GLX_PIXMAP_BIT ?
Brian Paul664a1f81999-11-23 19:54:53 +0000138#define GLX_PBUFFER_BIT ?
139#define GLX_AUX_BUFFERS_BIT ?
140#define GLX_FRONT_LEFT_BUFFER_BIT ?
141#define GLX_FRONT_RIGHT_BUFFER_BIT ?
142#define GLX_BACK_LEFT_BUFFER_BIT ?
143#define GLX_BACK_RIGHT_BUFFER_BIT ?
144#define GLX_AUX_BUFFERS_BIT ?
145#define GLX_DEPTH_BUFFER_BIT ?
146#define GLX_STENCIL_BUFFER_BIT ?
147#define GLX_ACCUM_BUFFER_BIT ?
148#define GLX_RENDER_TYPE ?
149#define GLX_DRAWABLE_TYPE ?
150#define GLX_X_RENDERABLE ?
151#define GLX_NONE 0x8000
152#define GLX_TRUE_COLOR 0x8002
153#define GLX_DIRECT_COLOR 0x8003
154#define GLX_PSEUDO_COLOR 0x8004
155#define GLX_STATIC_COLOR 0x8005
156#define GLX_GRAY_SCALE 0x8006
157#define GLX_STATIC_GRAY 0x8007
158#define GLX_TRANSPARENT_INDEX 0x8009
159#define GLX_COLOR_INDEX_TYPE ?
Brian Paulb314d1d1999-11-24 17:04:46 +0000160#define GLX_COLOR_INDEX_BIT ?
Brian Paul664a1f81999-11-23 19:54:53 +0000161#define GLX_SCREEN ?
162#define GLX_PBUFFER_CLOBBER_MASK ?
163#define GLX_DAMAGED ?
164#define GLX_SAVED ?
165#define GLX_WINDOW ?
166#define GLX_PBUFFER ?
167
168
169/*
170 * GLX_EXT_visual_info extension
171 */
172#define GLX_X_VISUAL_TYPE_EXT 0x22
173#define GLX_TRANSPARENT_TYPE_EXT 0x23
174#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
175#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
176#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
177#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
178#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
179
180
181/*
jtgafb833d1999-08-19 00:55:39 +0000182 * GLX_visual_info extension
183 */
184#define GLX_TRUE_COLOR_EXT 0x8002
185#define GLX_DIRECT_COLOR_EXT 0x8003
186#define GLX_PSEUDO_COLOR_EXT 0x8004
187#define GLX_STATIC_COLOR_EXT 0x8005
188#define GLX_GRAY_SCALE_EXT 0x8006
189#define GLX_STATIC_GRAY_EXT 0x8007
190#define GLX_NONE_EXT 0x8000
191#define GLX_TRANSPARENT_RGB_EXT 0x8008
192#define GLX_TRANSPARENT_INDEX_EXT 0x8009
193
194
195/*
196 * Compile-time extension tests
197 */
jtgafb833d1999-08-19 00:55:39 +0000198#define GLX_EXT_visual_info 1
199#define GLX_MESA_pixmap_colormap 1
200#define GLX_MESA_release_buffers 1
201#define GLX_MESA_copy_sub_buffer 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000202#define GLX_MESA_set_3dfx_mode 1
jtgafb833d1999-08-19 00:55:39 +0000203#define GLX_SGI_video_sync 1
Brian Paulff06c831999-12-11 09:54:33 +0000204#define GLX_ARB_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000205
206
207
208#ifdef MESA
209 typedef XMesaContext GLXContext;
210 typedef Pixmap GLXPixmap;
211 typedef Drawable GLXDrawable;
212#else
213 typedef void * GLXContext;
214 typedef XID GLXPixmap;
215 typedef XID GLXDrawable;
Brian Paul664a1f81999-11-23 19:54:53 +0000216 /* GLX 1.3 and later */
217 typedef XID GLXFBConfigID;
218 typedef XID GLXPfuffer;
219 typedef XID GLXWindow;
220 typedef XID GLXPbuffer;
221 typedef XID GLXFBConfig;
jtgafb833d1999-08-19 00:55:39 +0000222#endif
223typedef XID GLXContextID;
224
225
226
227extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
228 int *attribList );
229
230extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
231 GLXContext shareList, Bool direct );
232
233extern void glXDestroyContext( Display *dpy, GLXContext ctx );
234
235extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
236 GLXContext ctx);
237
238extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
Brian Paul3994b772000-02-27 18:26:54 +0000239 unsigned long mask );
jtgafb833d1999-08-19 00:55:39 +0000240
241extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
242
243extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
244 Pixmap pixmap );
245
246extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
247
248extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
249
250extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
251
252extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
253
254extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
255 int attrib, int *value );
256
257extern GLXContext glXGetCurrentContext( void );
258
259extern GLXDrawable glXGetCurrentDrawable( void );
260
261extern void glXWaitGL( void );
262
263extern void glXWaitX( void );
264
265extern void glXUseXFont( Font font, int first, int count, int list );
266
267
268
269/* GLX 1.1 and later */
270extern const char *glXQueryExtensionsString( Display *dpy, int screen );
271
272extern const char *glXQueryServerString( Display *dpy, int screen, int name );
273
274extern const char *glXGetClientString( Display *dpy, int name );
275
276
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000277/* GLX 1.2 and later */
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000278extern Display *glXGetCurrentDisplay( void );
279
280
Brian Paul664a1f81999-11-23 19:54:53 +0000281/* GLX 1.3 and later */
282extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen,
283 const int *attribList, int *nitems );
284
285extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
286 int attribute, int *value );
287
288extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
289 GLXFBConfig config );
290
291extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
292 Window win, const int *attribList );
293
294extern void glXDestroyWindow( Display *dpy, GLXWindow window );
295
296extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
297 Pixmap pixmap, const int *attribList );
298
299extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
300
301extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
302 const int *attribList );
303
304extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
305
306extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
307 unsigned int *value );
308
309extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
310 int renderType, GLXContext shareList,
311 Bool direct );
312
313extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
314 GLXDrawable read, GLXContext ctx );
315
316extern GLXDrawable glXGetCurrentReadDrawable( void );
317
318extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
319 int *value );
320
321extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
322 unsigned long mask );
323
324extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
325 unsigned long *mask );
326
327
Brian Paul43c9c2c1999-09-16 15:52:51 +0000328
Brian Paul43c9c2c1999-09-16 15:52:51 +0000329/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000330extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
331 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000332
Brian Paul43c9c2c1999-09-16 15:52:51 +0000333
334/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000335extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000336
Brian Paul43c9c2c1999-09-16 15:52:51 +0000337
338/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000339extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
340 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000341
Brian Paul43c9c2c1999-09-16 15:52:51 +0000342
343/* GLX_MESA_set_3dfx_mode */
344extern GLboolean glXSet3DfxModeMESA( GLint mode );
345
346
347/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000348extern int glXGetVideoSyncSGI(unsigned int *count);
349extern int glXWaitVideoSyncSGI(int divisor, int remainder,
350 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000351
352
Brian Paulff06c831999-12-11 09:54:33 +0000353/* GLX_ARB_get_proc_address */
354extern void (*glXGetProcAddressARB(const GLubyte *procName))();
355
356
jtgafb833d1999-08-19 00:55:39 +0000357
358#ifdef __cplusplus
359}
360#endif
361
362#endif