blob: c4a0325d77a2164dbe4a8bfc2665a456c3aca142 [file] [log] [blame]
Brian Paulbf3f9bd1999-11-22 21:51:53 +00001/* $Id: glx.h,v 1.7 1999/11/22 21:51:53 brianp Exp $ */
jtgafb833d1999-08-19 00:55:39 +00002
3/*
4 * Mesa 3-D graphics library
Brian Paulfbd8f211999-11-11 01:22:25 +00005 * Version: 3.3
jtgafb833d1999-08-19 00:55:39 +00006 *
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
jtgafb833d1999-08-19 00:55:39 +000028
29#ifndef GLX_H
30#define GLX_H
31
32
jtgafb833d1999-08-19 00:55:39 +000033#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
47extern "C" {
48#endif
49
50
51#define GLX_VERSION_1_1 1
Brian Paulbf3f9bd1999-11-22 21:51:53 +000052#define GLX_VERSION_1_2 1
jtgafb833d1999-08-19 00:55:39 +000053
Brian Paulfbd8f211999-11-11 01:22:25 +000054#define GLX_EXTENSION_NAME "GLX"
55
56
jtgafb833d1999-08-19 00:55:39 +000057
58/*
59 * Tokens for glXChooseVisual and glXGetConfig:
60 */
Brian Paulfbd8f211999-11-11 01:22:25 +000061#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
jtgafb833d1999-08-19 00:55:39 +000078
Brian Paulfbd8f211999-11-11 01:22:25 +000079
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
jtgafb833d1999-08-19 00:55:39 +000089
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 */
jtgafb833d1999-08-19 00:55:39 +0000128#define GLX_EXT_visual_info 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000129#define GLX_EXT_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000130#define GLX_MESA_pixmap_colormap 1
131#define GLX_MESA_release_buffers 1
132#define GLX_MESA_copy_sub_buffer 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000133#define GLX_MESA_set_3dfx_mode 1
jtgafb833d1999-08-19 00:55:39 +0000134#define GLX_SGI_video_sync 1
jtgafb833d1999-08-19 00:55:39 +0000135
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
147typedef XID GLXContextID;
148
149
150
151extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
152 int *attribList );
153
154extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
155 GLXContext shareList, Bool direct );
156
157extern void glXDestroyContext( Display *dpy, GLXContext ctx );
158
159extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
160 GLXContext ctx);
161
162extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
163 GLuint mask );
164
165extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
166
167extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
168 Pixmap pixmap );
169
170extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
171
172extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
173
174extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
175
176extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
177
178extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
179 int attrib, int *value );
180
181extern GLXContext glXGetCurrentContext( void );
182
183extern GLXDrawable glXGetCurrentDrawable( void );
184
185extern void glXWaitGL( void );
186
187extern void glXWaitX( void );
188
189extern void glXUseXFont( Font font, int first, int count, int list );
190
191
192
193/* GLX 1.1 and later */
194extern const char *glXQueryExtensionsString( Display *dpy, int screen );
195
196extern const char *glXQueryServerString( Display *dpy, int screen, int name );
197
198extern const char *glXGetClientString( Display *dpy, int name );
199
200
Brian Paulbf3f9bd1999-11-22 21:51:53 +0000201/* GLX 1.2 and later */
202
203extern Display *glXGetCurrentDisplay( void );
204
205
Brian Paul43c9c2c1999-09-16 15:52:51 +0000206
Brian Paul43c9c2c1999-09-16 15:52:51 +0000207/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000208extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
209 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000210
Brian Paul43c9c2c1999-09-16 15:52:51 +0000211
212/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000213extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000214
Brian Paul43c9c2c1999-09-16 15:52:51 +0000215
216/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000217extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
218 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000219
Brian Paul43c9c2c1999-09-16 15:52:51 +0000220
221/* GLX_MESA_set_3dfx_mode */
222extern GLboolean glXSet3DfxModeMESA( GLint mode );
223
224
225/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000226extern int glXGetVideoSyncSGI(unsigned int *count);
227extern int glXWaitVideoSyncSGI(int divisor, int remainder,
228 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000229
230
231
232#ifdef __cplusplus
233}
234#endif
235
236#endif