1 /* $Id: glx.h,v 1.3 1999/09/16 15:52:51 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.
30 * Revision 1.3 1999/09/16 15:52:51 brianp
31 * added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress
33 * Revision 1.2 1999/09/11 11:33:45 brianp
34 * added GLX_EXT_get_proc_address
36 * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
39 * Revision 3.3 1999/02/14 03:39:09 brianp
42 * Revision 3.2 1998/06/18 03:44:00 brianp
43 * replaced "uint" with "unsigned int"
45 * Revision 3.1 1998/06/01 00:00:17 brianp
46 * added GLX_SGI_video_sync extension
48 * Revision 3.0 1998/02/20 05:06:01 brianp
59 * A pseudo-GLX implementation to allow GLX-based OpenGL programs to
63 * 1. If the visual passed to glXGetConfig was not one returned by
64 * glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
65 * will always return True and the GLX_DEPTH_SIZE query will always
67 * 2. The glXIsDirect() function always returns True.
73 #include <X11/Xutil.h>
80 #if defined(USE_MGL_NAMESPACE)
81 #include "glx_mangle.h"
90 #define GLX_VERSION_1_1 1
94 * Tokens for glXChooseVisual and glXGetConfig:
101 GLX_DOUBLEBUFFER
= 5,
109 GLX_STENCIL_SIZE
= 13,
110 GLX_ACCUM_RED_SIZE
= 14,
111 GLX_ACCUM_GREEN_SIZE
= 15,
112 GLX_ACCUM_BLUE_SIZE
= 16,
113 GLX_ACCUM_ALPHA_SIZE
= 17,
115 /* GLX_EXT_visual_info extension */
116 GLX_X_VISUAL_TYPE_EXT
= 0x22,
117 GLX_TRANSPARENT_TYPE_EXT
= 0x23,
118 GLX_TRANSPARENT_INDEX_VALUE_EXT
= 0x24,
119 GLX_TRANSPARENT_RED_VALUE_EXT
= 0x25,
120 GLX_TRANSPARENT_GREEN_VALUE_EXT
= 0x26,
121 GLX_TRANSPARENT_BLUE_VALUE_EXT
= 0x27,
122 GLX_TRANSPARENT_ALPHA_VALUE_EXT
= 0x28
127 * Error codes returned by glXGetConfig:
129 #define GLX_BAD_SCREEN 1
130 #define GLX_BAD_ATTRIBUTE 2
131 #define GLX_NO_EXTENSION 3
132 #define GLX_BAD_VISUAL 4
133 #define GLX_BAD_CONTEXT 5
134 #define GLX_BAD_VALUE 6
135 #define GLX_BAD_ENUM 7
142 #define GLX_VERSION 2
143 #define GLX_EXTENSIONS 3
147 * GLX_visual_info extension
149 #define GLX_TRUE_COLOR_EXT 0x8002
150 #define GLX_DIRECT_COLOR_EXT 0x8003
151 #define GLX_PSEUDO_COLOR_EXT 0x8004
152 #define GLX_STATIC_COLOR_EXT 0x8005
153 #define GLX_GRAY_SCALE_EXT 0x8006
154 #define GLX_STATIC_GRAY_EXT 0x8007
155 #define GLX_NONE_EXT 0x8000
156 #define GLX_TRANSPARENT_RGB_EXT 0x8008
157 #define GLX_TRANSPARENT_INDEX_EXT 0x8009
161 * Compile-time extension tests
163 #define GLX_EXT_visual_info 1
164 #define GLX_EXT_get_proc_address 1
165 #define GLX_MESA_pixmap_colormap 1
166 #define GLX_MESA_release_buffers 1
167 #define GLX_MESA_copy_sub_buffer 1
168 #define GLX_MESA_set_3dfx_mode 1
169 #define GLX_SGI_video_sync 1
174 typedef XMesaContext GLXContext
;
175 typedef Pixmap GLXPixmap
;
176 typedef Drawable GLXDrawable
;
178 typedef void * GLXContext
;
179 typedef XID GLXPixmap
;
180 typedef XID GLXDrawable
;
182 typedef XID GLXContextID
;
186 extern XVisualInfo
* glXChooseVisual( Display
*dpy
, int screen
,
189 extern GLXContext
glXCreateContext( Display
*dpy
, XVisualInfo
*vis
,
190 GLXContext shareList
, Bool direct
);
192 extern void glXDestroyContext( Display
*dpy
, GLXContext ctx
);
194 extern Bool
glXMakeCurrent( Display
*dpy
, GLXDrawable drawable
,
197 extern void glXCopyContext( Display
*dpy
, GLXContext src
, GLXContext dst
,
200 extern void glXSwapBuffers( Display
*dpy
, GLXDrawable drawable
);
202 extern GLXPixmap
glXCreateGLXPixmap( Display
*dpy
, XVisualInfo
*visual
,
205 extern void glXDestroyGLXPixmap( Display
*dpy
, GLXPixmap pixmap
);
207 extern Bool
glXQueryExtension( Display
*dpy
, int *errorb
, int *event
);
209 extern Bool
glXQueryVersion( Display
*dpy
, int *maj
, int *min
);
211 extern Bool
glXIsDirect( Display
*dpy
, GLXContext ctx
);
213 extern int glXGetConfig( Display
*dpy
, XVisualInfo
*visual
,
214 int attrib
, int *value
);
216 extern GLXContext
glXGetCurrentContext( void );
218 extern GLXDrawable
glXGetCurrentDrawable( void );
220 extern void glXWaitGL( void );
222 extern void glXWaitX( void );
224 extern void glXUseXFont( Font font
, int first
, int count
, int list
);
228 /* GLX 1.1 and later */
229 extern const char *glXQueryExtensionsString( Display
*dpy
, int screen
);
231 extern const char *glXQueryServerString( Display
*dpy
, int screen
, int name
);
233 extern const char *glXGetClientString( Display
*dpy
, int name
);
237 /* GLX_EXT_get_proc_address */
238 /* WARNING: this extension is not finalized yet! Do not release code
239 * which uses this extension yet! It may change!
241 extern void (*glXGetProcAddressEXT(const GLubyte
*procName
))();
244 /* GLX_MESA_pixmap_colormap */
245 extern GLXPixmap
glXCreateGLXPixmapMESA( Display
*dpy
, XVisualInfo
*visual
,
246 Pixmap pixmap
, Colormap cmap
);
249 /* GLX_MESA_release_buffers */
250 extern Bool
glXReleaseBuffersMESA( Display
*dpy
, GLXDrawable d
);
253 /* GLX_MESA_copy_sub_buffer */
254 extern void glXCopySubBufferMESA( Display
*dpy
, GLXDrawable drawable
,
255 int x
, int y
, int width
, int height
);
258 /* GLX_MESA_set_3dfx_mode */
259 extern GLboolean
glXSet3DfxModeMESA( GLint mode
);
262 /* GLX_SGI_video_sync */
263 extern int glXGetVideoSyncSGI(unsigned int *count
);
264 extern int glXWaitVideoSyncSGI(int divisor
, int remainder
,
265 unsigned int *count
);