1 /* $Id: glx.h,v 1.1 1999/08/19 00:55:40 jtg 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.1 1999/08/19 00:55:40 jtg
33 * Revision 3.3 1999/02/14 03:39:09 brianp
36 * Revision 3.2 1998/06/18 03:44:00 brianp
37 * replaced "uint" with "unsigned int"
39 * Revision 3.1 1998/06/01 00:00:17 brianp
40 * added GLX_SGI_video_sync extension
42 * Revision 3.0 1998/02/20 05:06:01 brianp
53 * A pseudo-GLX implementation to allow GLX-based OpenGL programs to
57 * 1. If the visual passed to glXGetConfig was not one returned by
58 * glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
59 * will always return True and the GLX_DEPTH_SIZE query will always
61 * 2. The glXIsDirect() function always returns True.
67 #include <X11/Xutil.h>
74 #if defined(USE_MGL_NAMESPACE)
75 #include "glx_mangle.h"
84 #define GLX_VERSION_1_1 1
88 * Tokens for glXChooseVisual and glXGetConfig:
103 GLX_STENCIL_SIZE
= 13,
104 GLX_ACCUM_RED_SIZE
= 14,
105 GLX_ACCUM_GREEN_SIZE
= 15,
106 GLX_ACCUM_BLUE_SIZE
= 16,
107 GLX_ACCUM_ALPHA_SIZE
= 17,
109 /* GLX_EXT_visual_info extension */
110 GLX_X_VISUAL_TYPE_EXT
= 0x22,
111 GLX_TRANSPARENT_TYPE_EXT
= 0x23,
112 GLX_TRANSPARENT_INDEX_VALUE_EXT
= 0x24,
113 GLX_TRANSPARENT_RED_VALUE_EXT
= 0x25,
114 GLX_TRANSPARENT_GREEN_VALUE_EXT
= 0x26,
115 GLX_TRANSPARENT_BLUE_VALUE_EXT
= 0x27,
116 GLX_TRANSPARENT_ALPHA_VALUE_EXT
= 0x28
121 * Error codes returned by glXGetConfig:
123 #define GLX_BAD_SCREEN 1
124 #define GLX_BAD_ATTRIBUTE 2
125 #define GLX_NO_EXTENSION 3
126 #define GLX_BAD_VISUAL 4
127 #define GLX_BAD_CONTEXT 5
128 #define GLX_BAD_VALUE 6
129 #define GLX_BAD_ENUM 7
136 #define GLX_VERSION 2
137 #define GLX_EXTENSIONS 3
141 * GLX_visual_info extension
143 #define GLX_TRUE_COLOR_EXT 0x8002
144 #define GLX_DIRECT_COLOR_EXT 0x8003
145 #define GLX_PSEUDO_COLOR_EXT 0x8004
146 #define GLX_STATIC_COLOR_EXT 0x8005
147 #define GLX_GRAY_SCALE_EXT 0x8006
148 #define GLX_STATIC_GRAY_EXT 0x8007
149 #define GLX_NONE_EXT 0x8000
150 #define GLX_TRANSPARENT_RGB_EXT 0x8008
151 #define GLX_TRANSPARENT_INDEX_EXT 0x8009
155 * Compile-time extension tests
158 #define GLX_EXT_visual_info 1
159 #define GLX_MESA_pixmap_colormap 1
160 #define GLX_MESA_release_buffers 1
161 #define GLX_MESA_copy_sub_buffer 1
162 #define GLX_SGI_video_sync 1
168 typedef XMesaContext GLXContext
;
169 typedef Pixmap GLXPixmap
;
170 typedef Drawable GLXDrawable
;
172 typedef void * GLXContext
;
173 typedef XID GLXPixmap
;
174 typedef XID GLXDrawable
;
176 typedef XID GLXContextID
;
180 extern XVisualInfo
* glXChooseVisual( Display
*dpy
, int screen
,
183 extern GLXContext
glXCreateContext( Display
*dpy
, XVisualInfo
*vis
,
184 GLXContext shareList
, Bool direct
);
186 extern void glXDestroyContext( Display
*dpy
, GLXContext ctx
);
188 extern Bool
glXMakeCurrent( Display
*dpy
, GLXDrawable drawable
,
191 extern void glXCopyContext( Display
*dpy
, GLXContext src
, GLXContext dst
,
194 extern void glXSwapBuffers( Display
*dpy
, GLXDrawable drawable
);
196 extern GLXPixmap
glXCreateGLXPixmap( Display
*dpy
, XVisualInfo
*visual
,
199 extern void glXDestroyGLXPixmap( Display
*dpy
, GLXPixmap pixmap
);
201 extern Bool
glXQueryExtension( Display
*dpy
, int *errorb
, int *event
);
203 extern Bool
glXQueryVersion( Display
*dpy
, int *maj
, int *min
);
205 extern Bool
glXIsDirect( Display
*dpy
, GLXContext ctx
);
207 extern int glXGetConfig( Display
*dpy
, XVisualInfo
*visual
,
208 int attrib
, int *value
);
210 extern GLXContext
glXGetCurrentContext( void );
212 extern GLXDrawable
glXGetCurrentDrawable( void );
214 extern void glXWaitGL( void );
216 extern void glXWaitX( void );
218 extern void glXUseXFont( Font font
, int first
, int count
, int list
);
222 /* GLX 1.1 and later */
223 extern const char *glXQueryExtensionsString( Display
*dpy
, int screen
);
225 extern const char *glXQueryServerString( Display
*dpy
, int screen
, int name
);
227 extern const char *glXGetClientString( Display
*dpy
, int name
);
232 * Mesa GLX Extensions
235 #ifdef GLX_MESA_pixmap_colormap
236 extern GLXPixmap
glXCreateGLXPixmapMESA( Display
*dpy
, XVisualInfo
*visual
,
237 Pixmap pixmap
, Colormap cmap
);
240 #ifdef GLX_MESA_release_buffers
241 extern Bool
glXReleaseBuffersMESA( Display
*dpy
, GLXDrawable d
);
244 #ifdef GLX_MESA_copy_sub_buffer
245 extern void glXCopySubBufferMESA( Display
*dpy
, GLXDrawable drawable
,
246 int x
, int y
, int width
, int height
);
249 #ifdef GLX_SGI_video_sync
250 extern int glXGetVideoSyncSGI(unsigned int *count
);
251 extern int glXWaitVideoSyncSGI(int divisor
, int remainder
,
252 unsigned int *count
);