1 /* $Id: glx.h,v 1.10 1999/12/11 09:54:33 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
34 #include <X11/Xutil.h>
41 #if defined(USE_MGL_NAMESPACE)
42 #include "glx_mangle.h"
51 #define GLX_VERSION_1_1 1
52 #define GLX_VERSION_1_2 1
53 #define GLX_VERSION_1_3 1
55 #define GLX_EXTENSION_NAME "GLX"
60 * Tokens for glXChooseVisual and glXGetConfig:
63 #define GLX_BUFFER_SIZE 2
66 #define GLX_DOUBLEBUFFER 5
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
82 * Error codes returned by glXGetConfig:
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
98 #define GLX_EXTENSIONS 3
103 * XXX don't know the values of some of these enums!
104 * XXX some 1.3 enums may be missing!
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_PIXMAP_BIT ?
127 #define GLX_PBUFFER_BIT ?
128 #define GLX_AUX_BUFFERS_BIT ?
129 #define GLX_FRONT_LEFT_BUFFER_BIT ?
130 #define GLX_FRONT_RIGHT_BUFFER_BIT ?
131 #define GLX_BACK_LEFT_BUFFER_BIT ?
132 #define GLX_BACK_RIGHT_BUFFER_BIT ?
133 #define GLX_AUX_BUFFERS_BIT ?
134 #define GLX_DEPTH_BUFFER_BIT ?
135 #define GLX_STENCIL_BUFFER_BIT ?
136 #define GLX_ACCUM_BUFFER_BIT ?
137 #define GLX_RENDER_TYPE ?
138 #define GLX_DRAWABLE_TYPE ?
139 #define GLX_X_RENDERABLE ?
140 #define GLX_NONE 0x8000
141 #define GLX_TRUE_COLOR 0x8002
142 #define GLX_DIRECT_COLOR 0x8003
143 #define GLX_PSEUDO_COLOR 0x8004
144 #define GLX_STATIC_COLOR 0x8005
145 #define GLX_GRAY_SCALE 0x8006
146 #define GLX_STATIC_GRAY 0x8007
147 #define GLX_TRANSPARENT_INDEX 0x8009
148 #define GLX_COLOR_INDEX_TYPE ?
149 #define GLX_COLOR_INDEX_BIT ?
151 #define GLX_PBUFFER_CLOBBER_MASK ?
152 #define GLX_DAMAGED ?
155 #define GLX_PBUFFER ?
159 * GLX_EXT_visual_info extension
161 #define GLX_X_VISUAL_TYPE_EXT 0x22
162 #define GLX_TRANSPARENT_TYPE_EXT 0x23
163 #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
164 #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
165 #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
166 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
167 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
171 * GLX_visual_info extension
173 #define GLX_TRUE_COLOR_EXT 0x8002
174 #define GLX_DIRECT_COLOR_EXT 0x8003
175 #define GLX_PSEUDO_COLOR_EXT 0x8004
176 #define GLX_STATIC_COLOR_EXT 0x8005
177 #define GLX_GRAY_SCALE_EXT 0x8006
178 #define GLX_STATIC_GRAY_EXT 0x8007
179 #define GLX_NONE_EXT 0x8000
180 #define GLX_TRANSPARENT_RGB_EXT 0x8008
181 #define GLX_TRANSPARENT_INDEX_EXT 0x8009
185 * Compile-time extension tests
187 #define GLX_EXT_visual_info 1
188 #define GLX_MESA_pixmap_colormap 1
189 #define GLX_MESA_release_buffers 1
190 #define GLX_MESA_copy_sub_buffer 1
191 #define GLX_MESA_set_3dfx_mode 1
192 #define GLX_SGI_video_sync 1
193 #define GLX_ARB_get_proc_address 1
198 typedef XMesaContext GLXContext;
199 typedef Pixmap GLXPixmap;
200 typedef Drawable GLXDrawable;
202 typedef void * GLXContext;
203 typedef XID GLXPixmap;
204 typedef XID GLXDrawable;
205 /* GLX 1.3 and later */
206 typedef XID GLXFBConfigID;
207 typedef XID GLXPfuffer;
208 typedef XID GLXWindow;
209 typedef XID GLXPbuffer;
210 typedef XID GLXFBConfig;
212 typedef XID GLXContextID;
216 extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
219 extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
220 GLXContext shareList, Bool direct );
222 extern void glXDestroyContext( Display *dpy, GLXContext ctx );
224 extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
227 extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
230 extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
232 extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
235 extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
237 extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
239 extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
241 extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
243 extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
244 int attrib, int *value );
246 extern GLXContext glXGetCurrentContext( void );
248 extern GLXDrawable glXGetCurrentDrawable( void );
250 extern void glXWaitGL( void );
252 extern void glXWaitX( void );
254 extern void glXUseXFont( Font font, int first, int count, int list );
258 /* GLX 1.1 and later */
259 extern const char *glXQueryExtensionsString( Display *dpy, int screen );
261 extern const char *glXQueryServerString( Display *dpy, int screen, int name );
263 extern const char *glXGetClientString( Display *dpy, int name );
266 /* GLX 1.2 and later */
267 extern Display *glXGetCurrentDisplay( void );
270 /* GLX 1.3 and later */
271 extern GLXFBConfig glXChooseFBConfig( Display *dpy, int screen,
272 const int *attribList, int *nitems );
274 extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
275 int attribute, int *value );
277 extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
278 GLXFBConfig config );
280 extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
281 Window win, const int *attribList );
283 extern void glXDestroyWindow( Display *dpy, GLXWindow window );
285 extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
286 Pixmap pixmap, const int *attribList );
288 extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
290 extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
291 const int *attribList );
293 extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
295 extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
296 unsigned int *value );
298 extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
299 int renderType, GLXContext shareList,
302 extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
303 GLXDrawable read, GLXContext ctx );
305 extern GLXDrawable glXGetCurrentReadDrawable( void );
307 extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
310 extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
311 unsigned long mask );
313 extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
314 unsigned long *mask );
318 /* GLX_MESA_pixmap_colormap */
319 extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
320 Pixmap pixmap, Colormap cmap );
323 /* GLX_MESA_release_buffers */
324 extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
327 /* GLX_MESA_copy_sub_buffer */
328 extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
329 int x, int y, int width, int height );
332 /* GLX_MESA_set_3dfx_mode */
333 extern GLboolean glXSet3DfxModeMESA( GLint mode );
336 /* GLX_SGI_video_sync */
337 extern int glXGetVideoSyncSGI(unsigned int *count);
338 extern int glXWaitVideoSyncSGI(int divisor, int remainder,
339 unsigned int *count);
342 /* GLX_ARB_get_proc_address */
343 extern void (*glXGetProcAddressARB(const GLubyte *procName))();