Brian Paul | bf3f9bd | 1999-11-22 21:51:53 +0000 | [diff] [blame^] | 1 | /* $Id: glx.h,v 1.7 1999/11/22 21:51:53 brianp Exp $ */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * Mesa 3-D graphics library |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 5 | * Version: 3.3 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 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 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 28 | |
| 29 | #ifndef GLX_H |
| 30 | #define GLX_H |
| 31 | |
| 32 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 33 | #include <X11/Xlib.h> |
| 34 | #include <X11/Xutil.h> |
| 35 | #include "GL/gl.h" |
| 36 | #ifdef MESA |
| 37 | #include "GL/xmesa.h" |
| 38 | #endif |
| 39 | |
| 40 | |
| 41 | #if defined(USE_MGL_NAMESPACE) |
| 42 | #include "glx_mangle.h" |
| 43 | #endif |
| 44 | |
| 45 | |
| 46 | #ifdef __cplusplus |
| 47 | extern "C" { |
| 48 | #endif |
| 49 | |
| 50 | |
| 51 | #define GLX_VERSION_1_1 1 |
Brian Paul | bf3f9bd | 1999-11-22 21:51:53 +0000 | [diff] [blame^] | 52 | #define GLX_VERSION_1_2 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 53 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 54 | #define GLX_EXTENSION_NAME "GLX" |
| 55 | |
| 56 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 57 | |
| 58 | /* |
| 59 | * Tokens for glXChooseVisual and glXGetConfig: |
| 60 | */ |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 61 | #define GLX_USE_GL 1 |
| 62 | #define GLX_BUFFER_SIZE 2 |
| 63 | #define GLX_LEVEL 3 |
| 64 | #define GLX_RGBA 4 |
| 65 | #define GLX_DOUBLEBUFFER 5 |
| 66 | #define GLX_STEREO 6 |
| 67 | #define GLX_AUX_BUFFERS 7 |
| 68 | #define GLX_RED_SIZE 8 |
| 69 | #define GLX_GREEN_SIZE 9 |
| 70 | #define GLX_BLUE_SIZE 10 |
| 71 | #define GLX_ALPHA_SIZE 11 |
| 72 | #define GLX_DEPTH_SIZE 12 |
| 73 | #define GLX_STENCIL_SIZE 13 |
| 74 | #define GLX_ACCUM_RED_SIZE 14 |
| 75 | #define GLX_ACCUM_GREEN_SIZE 15 |
| 76 | #define GLX_ACCUM_BLUE_SIZE 16 |
| 77 | #define GLX_ACCUM_ALPHA_SIZE 17 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 78 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 79 | |
| 80 | /* GLX_EXT_visual_info extension */ |
| 81 | #define GLX_X_VISUAL_TYPE_EXT 0x22 |
| 82 | #define GLX_TRANSPARENT_TYPE_EXT 0x23 |
| 83 | #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 |
| 84 | #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 |
| 85 | #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 |
| 86 | #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 |
| 87 | #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 |
| 88 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 89 | |
| 90 | |
| 91 | /* |
| 92 | * Error codes returned by glXGetConfig: |
| 93 | */ |
| 94 | #define GLX_BAD_SCREEN 1 |
| 95 | #define GLX_BAD_ATTRIBUTE 2 |
| 96 | #define GLX_NO_EXTENSION 3 |
| 97 | #define GLX_BAD_VISUAL 4 |
| 98 | #define GLX_BAD_CONTEXT 5 |
| 99 | #define GLX_BAD_VALUE 6 |
| 100 | #define GLX_BAD_ENUM 7 |
| 101 | |
| 102 | |
| 103 | /* |
| 104 | * GLX 1.1 and later: |
| 105 | */ |
| 106 | #define GLX_VENDOR 1 |
| 107 | #define GLX_VERSION 2 |
| 108 | #define GLX_EXTENSIONS 3 |
| 109 | |
| 110 | |
| 111 | /* |
| 112 | * GLX_visual_info extension |
| 113 | */ |
| 114 | #define GLX_TRUE_COLOR_EXT 0x8002 |
| 115 | #define GLX_DIRECT_COLOR_EXT 0x8003 |
| 116 | #define GLX_PSEUDO_COLOR_EXT 0x8004 |
| 117 | #define GLX_STATIC_COLOR_EXT 0x8005 |
| 118 | #define GLX_GRAY_SCALE_EXT 0x8006 |
| 119 | #define GLX_STATIC_GRAY_EXT 0x8007 |
| 120 | #define GLX_NONE_EXT 0x8000 |
| 121 | #define GLX_TRANSPARENT_RGB_EXT 0x8008 |
| 122 | #define GLX_TRANSPARENT_INDEX_EXT 0x8009 |
| 123 | |
| 124 | |
| 125 | /* |
| 126 | * Compile-time extension tests |
| 127 | */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 128 | #define GLX_EXT_visual_info 1 |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 129 | #define GLX_EXT_get_proc_address 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 130 | #define GLX_MESA_pixmap_colormap 1 |
| 131 | #define GLX_MESA_release_buffers 1 |
| 132 | #define GLX_MESA_copy_sub_buffer 1 |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 133 | #define GLX_MESA_set_3dfx_mode 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 134 | #define GLX_SGI_video_sync 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 135 | |
| 136 | |
| 137 | |
| 138 | #ifdef MESA |
| 139 | typedef XMesaContext GLXContext; |
| 140 | typedef Pixmap GLXPixmap; |
| 141 | typedef Drawable GLXDrawable; |
| 142 | #else |
| 143 | typedef void * GLXContext; |
| 144 | typedef XID GLXPixmap; |
| 145 | typedef XID GLXDrawable; |
| 146 | #endif |
| 147 | typedef XID GLXContextID; |
| 148 | |
| 149 | |
| 150 | |
| 151 | extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, |
| 152 | int *attribList ); |
| 153 | |
| 154 | extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, |
| 155 | GLXContext shareList, Bool direct ); |
| 156 | |
| 157 | extern void glXDestroyContext( Display *dpy, GLXContext ctx ); |
| 158 | |
| 159 | extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, |
| 160 | GLXContext ctx); |
| 161 | |
| 162 | extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, |
| 163 | GLuint mask ); |
| 164 | |
| 165 | extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); |
| 166 | |
| 167 | extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, |
| 168 | Pixmap pixmap ); |
| 169 | |
| 170 | extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); |
| 171 | |
| 172 | extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); |
| 173 | |
| 174 | extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); |
| 175 | |
| 176 | extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); |
| 177 | |
| 178 | extern int glXGetConfig( Display *dpy, XVisualInfo *visual, |
| 179 | int attrib, int *value ); |
| 180 | |
| 181 | extern GLXContext glXGetCurrentContext( void ); |
| 182 | |
| 183 | extern GLXDrawable glXGetCurrentDrawable( void ); |
| 184 | |
| 185 | extern void glXWaitGL( void ); |
| 186 | |
| 187 | extern void glXWaitX( void ); |
| 188 | |
| 189 | extern void glXUseXFont( Font font, int first, int count, int list ); |
| 190 | |
| 191 | |
| 192 | |
| 193 | /* GLX 1.1 and later */ |
| 194 | extern const char *glXQueryExtensionsString( Display *dpy, int screen ); |
| 195 | |
| 196 | extern const char *glXQueryServerString( Display *dpy, int screen, int name ); |
| 197 | |
| 198 | extern const char *glXGetClientString( Display *dpy, int name ); |
| 199 | |
| 200 | |
Brian Paul | bf3f9bd | 1999-11-22 21:51:53 +0000 | [diff] [blame^] | 201 | /* GLX 1.2 and later */ |
| 202 | |
| 203 | extern Display *glXGetCurrentDisplay( void ); |
| 204 | |
| 205 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 206 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 207 | /* GLX_MESA_pixmap_colormap */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 208 | extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, |
| 209 | Pixmap pixmap, Colormap cmap ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 210 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 211 | |
| 212 | /* GLX_MESA_release_buffers */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 213 | extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 214 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 215 | |
| 216 | /* GLX_MESA_copy_sub_buffer */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 217 | extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, |
| 218 | int x, int y, int width, int height ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 219 | |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 220 | |
| 221 | /* GLX_MESA_set_3dfx_mode */ |
| 222 | extern GLboolean glXSet3DfxModeMESA( GLint mode ); |
| 223 | |
| 224 | |
| 225 | /* GLX_SGI_video_sync */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 226 | extern int glXGetVideoSyncSGI(unsigned int *count); |
| 227 | extern int glXWaitVideoSyncSGI(int divisor, int remainder, |
| 228 | unsigned int *count); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 229 | |
| 230 | |
| 231 | |
| 232 | #ifdef __cplusplus |
| 233 | } |
| 234 | #endif |
| 235 | |
| 236 | #endif |