Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 1 | /* $Id: glx.h,v 1.3 1999/09/16 15:52:51 brianp Exp $ */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * Mesa 3-D graphics library |
| 5 | * Version: 3.1 |
| 6 | * |
| 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 | |
| 28 | /* |
| 29 | * $Log: glx.h,v $ |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 30 | * Revision 1.3 1999/09/16 15:52:51 brianp |
| 31 | * added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress |
| 32 | * |
Brian Paul | 89a42b7 | 1999-09-11 11:33:45 +0000 | [diff] [blame] | 33 | * Revision 1.2 1999/09/11 11:33:45 brianp |
| 34 | * added GLX_EXT_get_proc_address |
| 35 | * |
| 36 | * Revision 1.1.1.1 1999/08/19 00:55:40 jtg |
| 37 | * Imported sources |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 38 | * |
| 39 | * Revision 3.3 1999/02/14 03:39:09 brianp |
| 40 | * new copyright |
| 41 | * |
| 42 | * Revision 3.2 1998/06/18 03:44:00 brianp |
| 43 | * replaced "uint" with "unsigned int" |
| 44 | * |
| 45 | * Revision 3.1 1998/06/01 00:00:17 brianp |
| 46 | * added GLX_SGI_video_sync extension |
| 47 | * |
| 48 | * Revision 3.0 1998/02/20 05:06:01 brianp |
| 49 | * initial rev |
| 50 | * |
| 51 | */ |
| 52 | |
| 53 | |
| 54 | #ifndef GLX_H |
| 55 | #define GLX_H |
| 56 | |
| 57 | |
| 58 | /* |
| 59 | * A pseudo-GLX implementation to allow GLX-based OpenGL programs to |
| 60 | * work with Mesa. |
| 61 | * |
| 62 | * Notes: |
| 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 |
| 66 | * return non-zero. |
| 67 | * 2. The glXIsDirect() function always returns True. |
| 68 | */ |
| 69 | |
| 70 | |
| 71 | |
| 72 | #include <X11/Xlib.h> |
| 73 | #include <X11/Xutil.h> |
| 74 | #include "GL/gl.h" |
| 75 | #ifdef MESA |
| 76 | #include "GL/xmesa.h" |
| 77 | #endif |
| 78 | |
| 79 | |
| 80 | #if defined(USE_MGL_NAMESPACE) |
| 81 | #include "glx_mangle.h" |
| 82 | #endif |
| 83 | |
| 84 | |
| 85 | #ifdef __cplusplus |
| 86 | extern "C" { |
| 87 | #endif |
| 88 | |
| 89 | |
| 90 | #define GLX_VERSION_1_1 1 |
| 91 | |
| 92 | |
| 93 | /* |
| 94 | * Tokens for glXChooseVisual and glXGetConfig: |
| 95 | */ |
| 96 | enum _GLX_CONFIGS { |
| 97 | GLX_USE_GL = 1, |
| 98 | GLX_BUFFER_SIZE = 2, |
| 99 | GLX_LEVEL = 3, |
| 100 | GLX_RGBA = 4, |
| 101 | GLX_DOUBLEBUFFER = 5, |
| 102 | GLX_STEREO = 6, |
| 103 | GLX_AUX_BUFFERS = 7, |
| 104 | GLX_RED_SIZE = 8, |
| 105 | GLX_GREEN_SIZE = 9, |
| 106 | GLX_BLUE_SIZE = 10, |
| 107 | GLX_ALPHA_SIZE = 11, |
| 108 | GLX_DEPTH_SIZE = 12, |
| 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, |
| 114 | |
| 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 |
| 123 | }; |
| 124 | |
| 125 | |
| 126 | /* |
| 127 | * Error codes returned by glXGetConfig: |
| 128 | */ |
| 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 |
| 136 | |
| 137 | |
| 138 | /* |
| 139 | * GLX 1.1 and later: |
| 140 | */ |
| 141 | #define GLX_VENDOR 1 |
| 142 | #define GLX_VERSION 2 |
| 143 | #define GLX_EXTENSIONS 3 |
| 144 | |
| 145 | |
| 146 | /* |
| 147 | * GLX_visual_info extension |
| 148 | */ |
| 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 |
| 158 | |
| 159 | |
| 160 | /* |
| 161 | * Compile-time extension tests |
| 162 | */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 163 | #define GLX_EXT_visual_info 1 |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 164 | #define GLX_EXT_get_proc_address 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 165 | #define GLX_MESA_pixmap_colormap 1 |
| 166 | #define GLX_MESA_release_buffers 1 |
| 167 | #define GLX_MESA_copy_sub_buffer 1 |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 168 | #define GLX_MESA_set_3dfx_mode 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 169 | #define GLX_SGI_video_sync 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 170 | |
| 171 | |
| 172 | |
| 173 | #ifdef MESA |
| 174 | typedef XMesaContext GLXContext; |
| 175 | typedef Pixmap GLXPixmap; |
| 176 | typedef Drawable GLXDrawable; |
| 177 | #else |
| 178 | typedef void * GLXContext; |
| 179 | typedef XID GLXPixmap; |
| 180 | typedef XID GLXDrawable; |
| 181 | #endif |
| 182 | typedef XID GLXContextID; |
| 183 | |
| 184 | |
| 185 | |
| 186 | extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, |
| 187 | int *attribList ); |
| 188 | |
| 189 | extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, |
| 190 | GLXContext shareList, Bool direct ); |
| 191 | |
| 192 | extern void glXDestroyContext( Display *dpy, GLXContext ctx ); |
| 193 | |
| 194 | extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, |
| 195 | GLXContext ctx); |
| 196 | |
| 197 | extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, |
| 198 | GLuint mask ); |
| 199 | |
| 200 | extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); |
| 201 | |
| 202 | extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, |
| 203 | Pixmap pixmap ); |
| 204 | |
| 205 | extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); |
| 206 | |
| 207 | extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); |
| 208 | |
| 209 | extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); |
| 210 | |
| 211 | extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); |
| 212 | |
| 213 | extern int glXGetConfig( Display *dpy, XVisualInfo *visual, |
| 214 | int attrib, int *value ); |
| 215 | |
| 216 | extern GLXContext glXGetCurrentContext( void ); |
| 217 | |
| 218 | extern GLXDrawable glXGetCurrentDrawable( void ); |
| 219 | |
| 220 | extern void glXWaitGL( void ); |
| 221 | |
| 222 | extern void glXWaitX( void ); |
| 223 | |
| 224 | extern void glXUseXFont( Font font, int first, int count, int list ); |
| 225 | |
| 226 | |
| 227 | |
| 228 | /* GLX 1.1 and later */ |
| 229 | extern const char *glXQueryExtensionsString( Display *dpy, int screen ); |
| 230 | |
| 231 | extern const char *glXQueryServerString( Display *dpy, int screen, int name ); |
| 232 | |
| 233 | extern const char *glXGetClientString( Display *dpy, int name ); |
| 234 | |
| 235 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 236 | |
Brian Paul | 89a42b7 | 1999-09-11 11:33:45 +0000 | [diff] [blame] | 237 | /* GLX_EXT_get_proc_address */ |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 238 | /* WARNING: this extension is not finalized yet! Do not release code |
| 239 | * which uses this extension yet! It may change! |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 240 | */ |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 241 | extern void (*glXGetProcAddressEXT(const GLubyte *procName))(); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 242 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 243 | |
| 244 | /* GLX_MESA_pixmap_colormap */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 245 | extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, |
| 246 | Pixmap pixmap, Colormap cmap ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 247 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 248 | |
| 249 | /* GLX_MESA_release_buffers */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 250 | extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 251 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 252 | |
| 253 | /* GLX_MESA_copy_sub_buffer */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 254 | extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, |
| 255 | int x, int y, int width, int height ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 256 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame^] | 257 | |
| 258 | /* GLX_MESA_set_3dfx_mode */ |
| 259 | extern GLboolean glXSet3DfxModeMESA( GLint mode ); |
| 260 | |
| 261 | |
| 262 | /* GLX_SGI_video_sync */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 263 | extern int glXGetVideoSyncSGI(unsigned int *count); |
| 264 | extern int glXWaitVideoSyncSGI(int divisor, int remainder, |
| 265 | unsigned int *count); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 266 | |
| 267 | |
| 268 | |
| 269 | #ifdef __cplusplus |
| 270 | } |
| 271 | #endif |
| 272 | |
| 273 | #endif |