blob: 4163fe2857909f5335cab9e55c34d2594a5f8ef9 [file] [log] [blame]
Brian Paul89a42b71999-09-11 11:33:45 +00001/* $Id: glx.h,v 1.2 1999/09/11 11:33:45 brianp Exp $ */
jtgafb833d1999-08-19 00:55:39 +00002
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 Paul89a42b71999-09-11 11:33:45 +000030 * Revision 1.2 1999/09/11 11:33:45 brianp
31 * added GLX_EXT_get_proc_address
32 *
33 * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
34 * Imported sources
jtgafb833d1999-08-19 00:55:39 +000035 *
36 * Revision 3.3 1999/02/14 03:39:09 brianp
37 * new copyright
38 *
39 * Revision 3.2 1998/06/18 03:44:00 brianp
40 * replaced "uint" with "unsigned int"
41 *
42 * Revision 3.1 1998/06/01 00:00:17 brianp
43 * added GLX_SGI_video_sync extension
44 *
45 * Revision 3.0 1998/02/20 05:06:01 brianp
46 * initial rev
47 *
48 */
49
50
51#ifndef GLX_H
52#define GLX_H
53
54
55/*
56 * A pseudo-GLX implementation to allow GLX-based OpenGL programs to
57 * work with Mesa.
58 *
59 * Notes:
60 * 1. If the visual passed to glXGetConfig was not one returned by
61 * glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
62 * will always return True and the GLX_DEPTH_SIZE query will always
63 * return non-zero.
64 * 2. The glXIsDirect() function always returns True.
65 */
66
67
68
69#include <X11/Xlib.h>
70#include <X11/Xutil.h>
71#include "GL/gl.h"
72#ifdef MESA
73#include "GL/xmesa.h"
74#endif
75
76
77#if defined(USE_MGL_NAMESPACE)
78#include "glx_mangle.h"
79#endif
80
81
82#ifdef __cplusplus
83extern "C" {
84#endif
85
86
87#define GLX_VERSION_1_1 1
88
89
90/*
91 * Tokens for glXChooseVisual and glXGetConfig:
92 */
93enum _GLX_CONFIGS {
94 GLX_USE_GL = 1,
95 GLX_BUFFER_SIZE = 2,
96 GLX_LEVEL = 3,
97 GLX_RGBA = 4,
98 GLX_DOUBLEBUFFER = 5,
99 GLX_STEREO = 6,
100 GLX_AUX_BUFFERS = 7,
101 GLX_RED_SIZE = 8,
102 GLX_GREEN_SIZE = 9,
103 GLX_BLUE_SIZE = 10,
104 GLX_ALPHA_SIZE = 11,
105 GLX_DEPTH_SIZE = 12,
106 GLX_STENCIL_SIZE = 13,
107 GLX_ACCUM_RED_SIZE = 14,
108 GLX_ACCUM_GREEN_SIZE = 15,
109 GLX_ACCUM_BLUE_SIZE = 16,
110 GLX_ACCUM_ALPHA_SIZE = 17,
111
112 /* GLX_EXT_visual_info extension */
113 GLX_X_VISUAL_TYPE_EXT = 0x22,
114 GLX_TRANSPARENT_TYPE_EXT = 0x23,
115 GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24,
116 GLX_TRANSPARENT_RED_VALUE_EXT = 0x25,
117 GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26,
118 GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27,
119 GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28
120};
121
122
123/*
124 * Error codes returned by glXGetConfig:
125 */
126#define GLX_BAD_SCREEN 1
127#define GLX_BAD_ATTRIBUTE 2
128#define GLX_NO_EXTENSION 3
129#define GLX_BAD_VISUAL 4
130#define GLX_BAD_CONTEXT 5
131#define GLX_BAD_VALUE 6
132#define GLX_BAD_ENUM 7
133
134
135/*
136 * GLX 1.1 and later:
137 */
138#define GLX_VENDOR 1
139#define GLX_VERSION 2
140#define GLX_EXTENSIONS 3
141
142
143/*
144 * GLX_visual_info extension
145 */
146#define GLX_TRUE_COLOR_EXT 0x8002
147#define GLX_DIRECT_COLOR_EXT 0x8003
148#define GLX_PSEUDO_COLOR_EXT 0x8004
149#define GLX_STATIC_COLOR_EXT 0x8005
150#define GLX_GRAY_SCALE_EXT 0x8006
151#define GLX_STATIC_GRAY_EXT 0x8007
152#define GLX_NONE_EXT 0x8000
153#define GLX_TRANSPARENT_RGB_EXT 0x8008
154#define GLX_TRANSPARENT_INDEX_EXT 0x8009
155
156
157/*
158 * Compile-time extension tests
159 */
jtgafb833d1999-08-19 00:55:39 +0000160#define GLX_EXT_visual_info 1
161#define GLX_MESA_pixmap_colormap 1
162#define GLX_MESA_release_buffers 1
163#define GLX_MESA_copy_sub_buffer 1
164#define GLX_SGI_video_sync 1
Brian Paul89a42b71999-09-11 11:33:45 +0000165#define GLX_EXT_get_proc_address 1
jtgafb833d1999-08-19 00:55:39 +0000166
167
168
169#ifdef MESA
170 typedef XMesaContext GLXContext;
171 typedef Pixmap GLXPixmap;
172 typedef Drawable GLXDrawable;
173#else
174 typedef void * GLXContext;
175 typedef XID GLXPixmap;
176 typedef XID GLXDrawable;
177#endif
178typedef XID GLXContextID;
179
180
181
182extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
183 int *attribList );
184
185extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
186 GLXContext shareList, Bool direct );
187
188extern void glXDestroyContext( Display *dpy, GLXContext ctx );
189
190extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
191 GLXContext ctx);
192
193extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
194 GLuint mask );
195
196extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
197
198extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
199 Pixmap pixmap );
200
201extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
202
203extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
204
205extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
206
207extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
208
209extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
210 int attrib, int *value );
211
212extern GLXContext glXGetCurrentContext( void );
213
214extern GLXDrawable glXGetCurrentDrawable( void );
215
216extern void glXWaitGL( void );
217
218extern void glXWaitX( void );
219
220extern void glXUseXFont( Font font, int first, int count, int list );
221
222
223
224/* GLX 1.1 and later */
225extern const char *glXQueryExtensionsString( Display *dpy, int screen );
226
227extern const char *glXQueryServerString( Display *dpy, int screen, int name );
228
229extern const char *glXGetClientString( Display *dpy, int name );
230
231
Brian Paul89a42b71999-09-11 11:33:45 +0000232/* GLX_EXT_get_proc_address */
233extern GLfunction glXGetProcAddressEXT(const GLubyte *procName);
234
jtgafb833d1999-08-19 00:55:39 +0000235
236/*
237 * Mesa GLX Extensions
238 */
239
240#ifdef GLX_MESA_pixmap_colormap
241extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
242 Pixmap pixmap, Colormap cmap );
243#endif
244
245#ifdef GLX_MESA_release_buffers
246extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
247#endif
248
249#ifdef GLX_MESA_copy_sub_buffer
250extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
251 int x, int y, int width, int height );
252#endif
253
254#ifdef GLX_SGI_video_sync
255extern int glXGetVideoSyncSGI(unsigned int *count);
256extern int glXWaitVideoSyncSGI(int divisor, int remainder,
257 unsigned int *count);
258#endif
259
260
261
262#ifdef __cplusplus
263}
264#endif
265
266#endif