521
|
1 |
#ifndef __glx_h__
|
|
2 |
#define __glx_h__
|
|
3 |
|
|
4 |
/*
|
|
5 |
** The contents of this file are subject to the GLX Public License Version 1.0
|
|
6 |
** (the "License"). You may not use this file except in compliance with the
|
|
7 |
** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
|
|
8 |
** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
|
|
9 |
** or at http://www.sgi.com/software/opensource/glx/license.html.
|
|
10 |
**
|
|
11 |
** Software distributed under the License is distributed on an "AS IS"
|
|
12 |
** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
|
|
13 |
** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
|
14 |
** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
|
|
15 |
** language governing rights and limitations under the License.
|
|
16 |
**
|
|
17 |
** The Original Software is GLX version 1.2 source code, released February,
|
|
18 |
** 1999. The developer of the Original Software is Silicon Graphics, Inc.
|
|
19 |
** Those portions of the Subject Software created by Silicon Graphics, Inc.
|
|
20 |
** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
|
|
21 |
**
|
|
22 |
** $Header: //sw/main/drivers/OpenGL/win/glx/include/glx.h#21 $
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include <X11/Xlib.h>
|
|
26 |
#include <X11/Xutil.h>
|
|
27 |
#include <GL/gl.h>
|
|
28 |
|
|
29 |
#ifdef __cplusplus
|
|
30 |
extern "C" {
|
|
31 |
#endif
|
|
32 |
|
|
33 |
/*
|
|
34 |
* Names for attributes to glXGetConfig.
|
|
35 |
*/
|
|
36 |
#define GLX_USE_GL 1 /* support GLX rendering */
|
|
37 |
#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */
|
|
38 |
#define GLX_LEVEL 3 /* level in plane stacking */
|
|
39 |
#define GLX_RGBA 4 /* true if RGBA mode */
|
|
40 |
#define GLX_DOUBLEBUFFER 5 /* double buffering supported */
|
|
41 |
#define GLX_STEREO 6 /* stereo buffering supported */
|
|
42 |
#define GLX_AUX_BUFFERS 7 /* number of aux buffers */
|
|
43 |
#define GLX_RED_SIZE 8 /* number of red component bits */
|
|
44 |
#define GLX_GREEN_SIZE 9 /* number of green component bits */
|
|
45 |
#define GLX_BLUE_SIZE 10 /* number of blue component bits */
|
|
46 |
#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */
|
|
47 |
#define GLX_DEPTH_SIZE 12 /* number of depth bits */
|
|
48 |
#define GLX_STENCIL_SIZE 13 /* number of stencil bits */
|
|
49 |
#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */
|
|
50 |
#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */
|
|
51 |
#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */
|
|
52 |
#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */
|
|
53 |
|
|
54 |
/*
|
|
55 |
* Error return values from glXGetConfig. Success is indicated by
|
|
56 |
* a value of 0.
|
|
57 |
*/
|
|
58 |
#define GLX_BAD_SCREEN 1 /* screen # is bad */
|
|
59 |
#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */
|
|
60 |
#define GLX_NO_EXTENSION 3 /* no glx extension on server */
|
|
61 |
#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */
|
|
62 |
#define GLX_BAD_CONTEXT 5
|
|
63 |
#define GLX_BAD_VALUE 6
|
|
64 |
#define GLX_BAD_ENUM 7
|
|
65 |
|
|
66 |
/*
|
|
67 |
* Names for attributes to glXGetClientString.
|
|
68 |
*/
|
|
69 |
#define GLX_VENDOR 0x1
|
|
70 |
#define GLX_VERSION 0x2
|
|
71 |
#define GLX_EXTENSIONS 0x3
|
|
72 |
|
|
73 |
#ifndef GLX_VERSION_1_3
|
|
74 |
#define GLX_WINDOW_BIT 0x00000001
|
|
75 |
#define GLX_PIXMAP_BIT 0x00000002
|
|
76 |
#define GLX_PBUFFER_BIT 0x00000004
|
|
77 |
#define GLX_RGBA_BIT 0x00000001
|
|
78 |
#define GLX_COLOR_INDEX_BIT 0x00000002
|
|
79 |
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
|
80 |
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
|
81 |
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
|
82 |
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
|
83 |
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
|
84 |
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
|
85 |
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
|
86 |
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
|
87 |
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
|
88 |
#define GLX_CONFIG_CAVEAT 0x20
|
|
89 |
#define GLX_X_VISUAL_TYPE 0x22
|
|
90 |
#define GLX_TRANSPARENT_TYPE 0x23
|
|
91 |
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
|
|
92 |
#define GLX_TRANSPARENT_RED_VALUE 0x25
|
|
93 |
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
|
|
94 |
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
|
|
95 |
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
|
96 |
#define GLX_DONT_CARE 0xFFFFFFFF
|
|
97 |
#define GLX_NONE 0x8000
|
|
98 |
#define GLX_SLOW_CONFIG 0x8001
|
|
99 |
#define GLX_TRUE_COLOR 0x8002
|
|
100 |
#define GLX_DIRECT_COLOR 0x8003
|
|
101 |
#define GLX_PSEUDO_COLOR 0x8004
|
|
102 |
#define GLX_STATIC_COLOR 0x8005
|
|
103 |
#define GLX_GRAY_SCALE 0x8006
|
|
104 |
#define GLX_STATIC_GRAY 0x8007
|
|
105 |
#define GLX_TRANSPARENT_RGB 0x8008
|
|
106 |
#define GLX_TRANSPARENT_INDEX 0x8009
|
|
107 |
#define GLX_VISUAL_ID 0x800B
|
|
108 |
#define GLX_SCREEN 0x800C
|
|
109 |
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
|
110 |
#define GLX_DRAWABLE_TYPE 0x8010
|
|
111 |
#define GLX_RENDER_TYPE 0x8011
|
|
112 |
#define GLX_X_RENDERABLE 0x8012
|
|
113 |
#define GLX_FBCONFIG_ID 0x8013
|
|
114 |
#define GLX_RGBA_TYPE 0x8014
|
|
115 |
#define GLX_COLOR_INDEX_TYPE 0x8015
|
|
116 |
#define GLX_MAX_PBUFFER_WIDTH 0x8016
|
|
117 |
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
|
118 |
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
|
119 |
#define GLX_PRESERVED_CONTENTS 0x801B
|
|
120 |
#define GLX_LARGEST_PBUFFER 0x801C
|
|
121 |
#define GLX_WIDTH 0x801D
|
|
122 |
#define GLX_HEIGHT 0x801E
|
|
123 |
#define GLX_EVENT_MASK 0x801F
|
|
124 |
#define GLX_DAMAGED 0x8020
|
|
125 |
#define GLX_SAVED 0x8021
|
|
126 |
#define GLX_WINDOW 0x8022
|
|
127 |
#define GLX_PBUFFER 0x8023
|
|
128 |
#define GLX_PBUFFER_HEIGHT 0x8040
|
|
129 |
#define GLX_PBUFFER_WIDTH 0x8041
|
|
130 |
#endif
|
|
131 |
|
|
132 |
#ifndef GLX_VERSION_1_4
|
|
133 |
#define GLX_SAMPLE_BUFFERS 0x186a0
|
|
134 |
#define GLX_SAMPLES 0x186a1
|
|
135 |
#endif
|
|
136 |
|
|
137 |
#ifndef GLX_ARB_get_proc_address
|
|
138 |
typedef void (*__GLXextFuncPtr)(void);
|
|
139 |
#endif
|
|
140 |
|
|
141 |
/*
|
|
142 |
* GLX resources.
|
|
143 |
*/
|
|
144 |
typedef XID GLXContextID;
|
|
145 |
typedef XID GLXPixmap;
|
|
146 |
typedef XID GLXDrawable;
|
|
147 |
typedef XID GLXPbuffer;
|
|
148 |
typedef XID GLXWindow;
|
|
149 |
typedef XID GLXFBConfigID;
|
|
150 |
|
|
151 |
/*
|
|
152 |
* GLXContext is a pointer to opaque data.
|
|
153 |
*/
|
|
154 |
typedef struct __GLXcontextRec *GLXContext;
|
|
155 |
|
|
156 |
/*
|
|
157 |
* GLXFBConfig is a pointer to opaque data.
|
|
158 |
*/
|
|
159 |
typedef struct __GLXFBConfigRec *GLXFBConfig;
|
|
160 |
|
|
161 |
|
|
162 |
/**********************************************************************/
|
|
163 |
|
|
164 |
/*
|
|
165 |
* GLX 1.0 functions.
|
|
166 |
*/
|
|
167 |
extern XVisualInfo* glXChooseVisual(Display *dpy, int screen,
|
|
168 |
int *attrib_list);
|
|
169 |
|
|
170 |
extern void glXCopyContext(Display *dpy, GLXContext src,
|
|
171 |
GLXContext dst, unsigned long mask);
|
|
172 |
|
|
173 |
extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
|
|
174 |
GLXContext share_list, Bool direct);
|
|
175 |
|
|
176 |
extern GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,
|
|
177 |
Pixmap pixmap);
|
|
178 |
|
|
179 |
extern void glXDestroyContext(Display *dpy, GLXContext ctx);
|
|
180 |
|
|
181 |
extern void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix);
|
|
182 |
|
|
183 |
extern int glXGetConfig(Display *dpy, XVisualInfo *vis,
|
|
184 |
int attrib, int *value);
|
|
185 |
|
|
186 |
extern GLXContext glXGetCurrentContext(void);
|
|
187 |
|
|
188 |
extern GLXDrawable glXGetCurrentDrawable(void);
|
|
189 |
|
|
190 |
extern Bool glXIsDirect(Display *dpy, GLXContext ctx);
|
|
191 |
|
|
192 |
extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable,
|
|
193 |
GLXContext ctx);
|
|
194 |
|
|
195 |
extern Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base);
|
|
196 |
|
|
197 |
extern Bool glXQueryVersion(Display *dpy, int *major, int *minor);
|
|
198 |
|
|
199 |
extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable);
|
|
200 |
|
|
201 |
extern void glXUseXFont(Font font, int first, int count, int list_base);
|
|
202 |
|
|
203 |
extern void glXWaitGL(void);
|
|
204 |
|
|
205 |
extern void glXWaitX(void);
|
|
206 |
|
|
207 |
|
|
208 |
#ifndef GLX_VERSION_1_1
|
|
209 |
#define GLX_VERSION_1_1 1
|
|
210 |
/*
|
|
211 |
* GLX 1.1 functions.
|
|
212 |
*/
|
|
213 |
extern const char *glXGetClientString(Display *dpy, int name);
|
|
214 |
|
|
215 |
extern const char *glXQueryServerString(Display *dpy, int screen, int name);
|
|
216 |
|
|
217 |
extern const char *glXQueryExtensionsString(Display *dpy, int screen);
|
|
218 |
#endif
|
|
219 |
|
|
220 |
|
|
221 |
#ifndef GLX_VERSION_1_2
|
|
222 |
#define GLX_VERSION_1_2 1
|
|
223 |
/*
|
|
224 |
* GLX 1.2 functions.
|
|
225 |
*/
|
|
226 |
extern Display *glXGetCurrentDisplay(void);
|
|
227 |
#endif
|
|
228 |
|
|
229 |
#ifndef GLX_VERSION_1_3
|
|
230 |
#define GLX_VERSION_1_3 1
|
|
231 |
/*
|
|
232 |
* GLX 1.3 functions.
|
|
233 |
*/
|
|
234 |
extern GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen,
|
|
235 |
const int *attrib_list, int *nelements);
|
|
236 |
|
|
237 |
extern GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config,
|
|
238 |
int render_type, GLXContext share_list,
|
|
239 |
Bool direct);
|
|
240 |
|
|
241 |
extern GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config,
|
|
242 |
const int *attrib_list);
|
|
243 |
|
|
244 |
extern GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config,
|
|
245 |
Pixmap pixmap, const int *attrib_list);
|
|
246 |
|
|
247 |
extern GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config,
|
|
248 |
Window win, const int *attrib_list);
|
|
249 |
|
|
250 |
extern void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf);
|
|
251 |
|
|
252 |
extern void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap);
|
|
253 |
|
|
254 |
extern void glXDestroyWindow(Display *dpy, GLXWindow win);
|
|
255 |
|
|
256 |
extern GLXDrawable glXGetCurrentReadDrawable(void);
|
|
257 |
|
|
258 |
extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config,
|
|
259 |
int attribute, int *value);
|
|
260 |
|
|
261 |
extern GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements);
|
|
262 |
|
|
263 |
extern void glXGetSelectedEvent(Display *dpy, GLXDrawable draw,
|
|
264 |
unsigned long *event_mask);
|
|
265 |
|
|
266 |
extern XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config);
|
|
267 |
|
|
268 |
extern Bool glXMakeContextCurrent(Display *display, GLXDrawable draw,
|
|
269 |
GLXDrawable read, GLXContext ctx);
|
|
270 |
|
|
271 |
extern int glXQueryContext(Display *dpy, GLXContext ctx,
|
|
272 |
int attribute, int *value);
|
|
273 |
|
|
274 |
extern void glXQueryDrawable(Display *dpy, GLXDrawable draw,
|
|
275 |
int attribute, unsigned int *value);
|
|
276 |
|
|
277 |
extern void glXSelectEvent(Display *dpy, GLXDrawable draw,
|
|
278 |
unsigned long event_mask);
|
|
279 |
|
|
280 |
typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
|
|
281 |
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
|
282 |
typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
|
|
283 |
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
|
284 |
typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
|
285 |
typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
|
|
286 |
typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
|
287 |
typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
|
|
288 |
typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
|
|
289 |
typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
|
|
290 |
typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
|
291 |
typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
|
292 |
typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
|
293 |
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
|
|
294 |
typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
|
|
295 |
typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
|
|
296 |
typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
|
297 |
typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
|
298 |
#endif
|
|
299 |
|
|
300 |
|
|
301 |
#ifndef GLX_VERSION_1_4
|
|
302 |
#define GLX_VERSION_1_4 1
|
|
303 |
/*
|
|
304 |
* GLX 1.4 functions and typedefs.
|
|
305 |
*/
|
|
306 |
extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *);
|
|
307 |
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
|
|
308 |
#endif
|
|
309 |
|
|
310 |
|
|
311 |
|
|
312 |
/**********************************************************************/
|
|
313 |
|
|
314 |
/*
|
|
315 |
* ARB_get_proc_address
|
|
316 |
*/
|
|
317 |
#ifndef GLX_ARB_get_proc_address
|
|
318 |
#define GLX_ARB_get_proc_address 1
|
|
319 |
/* Don't wrap this in GLX_GLXEXT_PROTOTYPES! */
|
|
320 |
extern void (*glXGetProcAddressARB(const GLubyte *procName))(void);
|
|
321 |
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
|
|
322 |
#endif
|
|
323 |
|
|
324 |
/**********************************************************************/
|
|
325 |
|
|
326 |
/*** Should these go here, or in another header? */
|
|
327 |
/*
|
|
328 |
* GLX Events
|
|
329 |
*/
|
|
330 |
typedef struct {
|
|
331 |
int event_type; /* GLX_DAMAGED or GLX_SAVED */
|
|
332 |
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
|
|
333 |
unsigned long serial; /* # of last request processed by server */
|
|
334 |
Bool send_event; /* true if this came for SendEvent request */
|
|
335 |
Display *display; /* display the event was read from */
|
|
336 |
GLXDrawable drawable; /* XID of Drawable */
|
|
337 |
unsigned int buffer_mask; /* mask indicating which buffers are affected */
|
|
338 |
unsigned int aux_buffer; /* which aux buffer was affected */
|
|
339 |
int x, y;
|
|
340 |
int width, height;
|
|
341 |
int count; /* if nonzero, at least this many more */
|
|
342 |
} GLXPbufferClobberEvent;
|
|
343 |
|
|
344 |
typedef union __GLXEvent {
|
|
345 |
GLXPbufferClobberEvent glxpbufferclobber;
|
|
346 |
long pad[24];
|
|
347 |
} GLXEvent;
|
|
348 |
|
|
349 |
#ifndef GLX_GLXEXT_LEGACY
|
|
350 |
#include <GL/glxext.h>
|
|
351 |
#endif
|
|
352 |
|
|
353 |
#ifdef __cplusplus
|
|
354 |
}
|
|
355 |
#endif
|
|
356 |
|
|
357 |
#endif /* !__glx_h__ */
|