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