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