blob: 9d4c2023f8e1f6de24c31bac9f6916eee773b7db [file] [log] [blame]
Brian Paulfbd8f211999-11-11 01:22:25 +00001/* $Id: glx.h,v 1.6 1999/11/11 01:27:17 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
52
Brian Paulfbd8f211999-11-11 01:22:25 +000053#define GLX_EXTENSION_NAME "GLX"
54
55
jtgafb833d1999-08-19 00:55:39 +000056
57/*
58 * Tokens for glXChooseVisual and glXGetConfig:
59 */
Brian Paulfbd8f211999-11-11 01:22:25 +000060#define GLX_USE_GL 1
61#define GLX_BUFFER_SIZE 2
62#define GLX_LEVEL 3
63#define GLX_RGBA 4
64#define GLX_DOUBLEBUFFER 5
65#define GLX_STEREO 6
66#define GLX_AUX_BUFFERS 7
67#define GLX_RED_SIZE 8
68#define GLX_GREEN_SIZE 9
69#define GLX_BLUE_SIZE 10
70#define GLX_ALPHA_SIZE 11
71#define GLX_DEPTH_SIZE 12
72#define GLX_STENCIL_SIZE 13
73#define GLX_ACCUM_RED_SIZE 14
74#define GLX_ACCUM_GREEN_SIZE 15
75#define GLX_ACCUM_BLUE_SIZE 16
76#define GLX_ACCUM_ALPHA_SIZE 17
jtgafb833d1999-08-19 00:55:39 +000077
Brian Paulfbd8f211999-11-11 01:22:25 +000078
79/* GLX_EXT_visual_info extension */
80#define GLX_X_VISUAL_TYPE_EXT 0x22
81#define GLX_TRANSPARENT_TYPE_EXT 0x23
82#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
83#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
84#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
85#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
86#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
87
jtgafb833d1999-08-19 00:55:39 +000088
89
90/*
91 * Error codes returned by glXGetConfig:
92 */
93#define GLX_BAD_SCREEN 1
94#define GLX_BAD_ATTRIBUTE 2
95#define GLX_NO_EXTENSION 3
96#define GLX_BAD_VISUAL 4
97#define GLX_BAD_CONTEXT 5
98#define GLX_BAD_VALUE 6
99#define GLX_BAD_ENUM 7
100
101
102/*
103 * GLX 1.1 and later:
104 */
105#define GLX_VENDOR 1
106#define GLX_VERSION 2
107#define GLX_EXTENSIONS 3
108
109
110/*
111 * GLX_visual_info extension
112 */
113#define GLX_TRUE_COLOR_EXT 0x8002
114#define GLX_DIRECT_COLOR_EXT 0x8003
115#define GLX_PSEUDO_COLOR_EXT 0x8004
116#define GLX_STATIC_COLOR_EXT 0x8005
117#define GLX_GRAY_SCALE_EXT 0x8006
118#define GLX_STATIC_GRAY_EXT 0x8007
119#define GLX_NONE_EXT 0x8000
120#define GLX_TRANSPARENT_RGB_EXT 0x8008
121#define GLX_TRANSPARENT_INDEX_EXT 0x8009
122
123
124/*
125 * Compile-time extension tests
126 */
jtgafb833d1999-08-19 00:55:39 +0000127#define GLX_EXT_visual_info 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000128#define GLX_EXT_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000129#define GLX_MESA_pixmap_colormap 1
130#define GLX_MESA_release_buffers 1
131#define GLX_MESA_copy_sub_buffer 1
Brian Paul43c9c2c1999-09-16 15:52:51 +0000132#define GLX_MESA_set_3dfx_mode 1
jtgafb833d1999-08-19 00:55:39 +0000133#define GLX_SGI_video_sync 1
jtgafb833d1999-08-19 00:55:39 +0000134
135
136
137#ifdef MESA
138 typedef XMesaContext GLXContext;
139 typedef Pixmap GLXPixmap;
140 typedef Drawable GLXDrawable;
141#else
142 typedef void * GLXContext;
143 typedef XID GLXPixmap;
144 typedef XID GLXDrawable;
145#endif
146typedef XID GLXContextID;
147
148
149
150extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
151 int *attribList );
152
153extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
154 GLXContext shareList, Bool direct );
155
156extern void glXDestroyContext( Display *dpy, GLXContext ctx );
157
158extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
159 GLXContext ctx);
160
161extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
162 GLuint mask );
163
164extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
165
166extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
167 Pixmap pixmap );
168
169extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
170
171extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
172
173extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
174
175extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
176
177extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
178 int attrib, int *value );
179
180extern GLXContext glXGetCurrentContext( void );
181
182extern GLXDrawable glXGetCurrentDrawable( void );
183
184extern void glXWaitGL( void );
185
186extern void glXWaitX( void );
187
188extern void glXUseXFont( Font font, int first, int count, int list );
189
190
191
192/* GLX 1.1 and later */
193extern const char *glXQueryExtensionsString( Display *dpy, int screen );
194
195extern const char *glXQueryServerString( Display *dpy, int screen, int name );
196
197extern const char *glXGetClientString( Display *dpy, int name );
198
199
Brian Paul43c9c2c1999-09-16 15:52:51 +0000200
Brian Paul43c9c2c1999-09-16 15:52:51 +0000201/* GLX_MESA_pixmap_colormap */
jtgafb833d1999-08-19 00:55:39 +0000202extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
203 Pixmap pixmap, Colormap cmap );
jtgafb833d1999-08-19 00:55:39 +0000204
Brian Paul43c9c2c1999-09-16 15:52:51 +0000205
206/* GLX_MESA_release_buffers */
jtgafb833d1999-08-19 00:55:39 +0000207extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
jtgafb833d1999-08-19 00:55:39 +0000208
Brian Paul43c9c2c1999-09-16 15:52:51 +0000209
210/* GLX_MESA_copy_sub_buffer */
jtgafb833d1999-08-19 00:55:39 +0000211extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
212 int x, int y, int width, int height );
jtgafb833d1999-08-19 00:55:39 +0000213
Brian Paul43c9c2c1999-09-16 15:52:51 +0000214
215/* GLX_MESA_set_3dfx_mode */
216extern GLboolean glXSet3DfxModeMESA( GLint mode );
217
218
219/* GLX_SGI_video_sync */
jtgafb833d1999-08-19 00:55:39 +0000220extern int glXGetVideoSyncSGI(unsigned int *count);
221extern int glXWaitVideoSyncSGI(int divisor, int remainder,
222 unsigned int *count);
jtgafb833d1999-08-19 00:55:39 +0000223
224
225
226#ifdef __cplusplus
227}
228#endif
229
230#endif