5 ** License Applicability. Except to the extent portions of this file are
6 ** made subject to an alternative license as permitted in the SGI Free
7 ** Software License B, Version 1.1 (the "License"), the contents of this
8 ** file are subject only to the provisions of the License. You may not use
9 ** this file except in compliance with the License. You may obtain a copy
10 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
11 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
13 ** http://oss.sgi.com/projects/FreeB
15 ** Note that, as provided in the License, the Software is distributed on an
16 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
17 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
18 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
21 ** Original Code. The Original Code is: OpenGL Sample Implementation,
22 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
23 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
24 ** Copyright in any portions created by third parties is as indicated
25 ** elsewhere herein. All Rights Reserved.
27 ** Additional Notice Provisions: The application programming interfaces
28 ** established by SGI in conjunction with the Original Code are The
29 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
30 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
31 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
32 ** Window System(R) (Version 1.3), released October 19, 1998. This software
33 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
34 ** published by SGI, but has not been independently verified as being
35 ** compliant with the OpenGL(R) version 1.2.1 Specification.
39 #include <X11/Xutil.h>
46 #define GLX_VERSION_1_1 1
47 #define GLX_VERSION_1_2 1
48 #define GLX_VERSION_1_3 1
51 ** Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib)
53 #define GLX_USE_GL 1 /* support GLX rendering */
54 #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */
55 #define GLX_LEVEL 3 /* level in plane stacking */
56 #define GLX_RGBA 4 /* true if RGBA mode */
57 #define GLX_DOUBLEBUFFER 5 /* double buffering supported */
58 #define GLX_STEREO 6 /* stereo buffering supported */
59 #define GLX_AUX_BUFFERS 7 /* number of aux buffers */
60 #define GLX_RED_SIZE 8 /* number of red component bits */
61 #define GLX_GREEN_SIZE 9 /* number of green component bits */
62 #define GLX_BLUE_SIZE 10 /* number of blue component bits */
63 #define GLX_ALPHA_SIZE 11 /* number of alpha component bits */
64 #define GLX_DEPTH_SIZE 12 /* number of depth bits */
65 #define GLX_STENCIL_SIZE 13 /* number of stencil bits */
66 #define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */
67 #define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */
68 #define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */
69 #define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */
71 ** FBConfig-specific attributes
73 #define GLX_X_VISUAL_TYPE 0x22
74 #define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT_EXT */
75 #define GLX_TRANSPARENT_TYPE 0x23
76 #define GLX_TRANSPARENT_INDEX_VALUE 0x24
77 #define GLX_TRANSPARENT_RED_VALUE 0x25
78 #define GLX_TRANSPARENT_GREEN_VALUE 0x26
79 #define GLX_TRANSPARENT_BLUE_VALUE 0x27
80 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28
81 #define GLX_DRAWABLE_TYPE 0x8010
82 #define GLX_RENDER_TYPE 0x8011
83 #define GLX_X_RENDERABLE 0x8012
84 #define GLX_FBCONFIG_ID 0x8013
85 #define GLX_MAX_PBUFFER_WIDTH 0x8016
86 #define GLX_MAX_PBUFFER_HEIGHT 0x8017
87 #define GLX_MAX_PBUFFER_PIXELS 0x8018
88 #define GLX_VISUAL_ID 0x800B
91 ** Error return values from glXGetConfig. Success is indicated by
94 #define GLX_BAD_SCREEN 1 /* screen # is bad */
95 #define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */
96 #define GLX_NO_EXTENSION 3 /* no glx extension on server */
97 #define GLX_BAD_VISUAL 4 /* visual # not known by GLX */
98 #define GLX_BAD_CONTEXT 5 /* returned only by import_context EXT? */
99 #define GLX_BAD_VALUE 6 /* returned only by glXSwapIntervalSGI? */
100 #define GLX_BAD_ENUM 7 /* unused? */
102 /* FBConfig attribute values */
105 ** Generic "don't care" value for glX ChooseFBConfig attributes (except
108 #define GLX_DONT_CARE 0xFFFFFFFF
110 /* GLX_RENDER_TYPE bits */
111 #define GLX_RGBA_BIT 0x00000001
112 #define GLX_COLOR_INDEX_BIT 0x00000002
114 /* GLX_DRAWABLE_TYPE bits */
115 #define GLX_WINDOW_BIT 0x00000001
116 #define GLX_PIXMAP_BIT 0x00000002
117 #define GLX_PBUFFER_BIT 0x00000004
119 /* GLX_CONFIG_CAVEAT attribute values */
120 #define GLX_NONE 0x8000
121 #define GLX_SLOW_CONFIG 0x8001
122 #define GLX_NON_CONFORMANT_CONFIG 0x800D
124 /* GLX_X_VISUAL_TYPE attribute values */
125 #define GLX_TRUE_COLOR 0x8002
126 #define GLX_DIRECT_COLOR 0x8003
127 #define GLX_PSEUDO_COLOR 0x8004
128 #define GLX_STATIC_COLOR 0x8005
129 #define GLX_GRAY_SCALE 0x8006
130 #define GLX_STATIC_GRAY 0x8007
132 /* GLX_TRANSPARENT_TYPE attribute values */
133 /* #define GLX_NONE 0x8000 */
134 #define GLX_TRANSPARENT_RGB 0x8008
135 #define GLX_TRANSPARENT_INDEX 0x8009
137 /* glXCreateGLXPbuffer attributes */
138 #define GLX_PRESERVED_CONTENTS 0x801B
139 #define GLX_LARGEST_PBUFFER 0x801C
140 #define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */
141 #define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */
143 /* glXQueryGLXPBuffer attributes */
144 #define GLX_WIDTH 0x801D
145 #define GLX_HEIGHT 0x801E
146 #define GLX_EVENT_MASK 0x801F
148 /* glXCreateNewContext render_type attribute values */
149 #define GLX_RGBA_TYPE 0x8014
150 #define GLX_COLOR_INDEX_TYPE 0x8015
152 /* glXQueryContext attributes */
153 /* #define GLX_FBCONFIG_ID 0x8013 */
154 /* #define GLX_RENDER_TYPE 0x8011 */
155 #define GLX_SCREEN 0x800C
157 /* glXSelectEvent event mask bits */
158 #define GLX_PBUFFER_CLOBBER_MASK 0x08000000
160 /* GLXPbufferClobberEvent event_type values */
161 #define GLX_DAMAGED 0x8020
162 #define GLX_SAVED 0x8021
164 /* GLXPbufferClobberEvent draw_type values */
165 #define GLX_WINDOW 0x8022
166 #define GLX_PBUFFER 0x8023
168 /* GLXPbufferClobberEvent buffer_mask bits */
169 #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
170 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
171 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
172 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
173 #define GLX_AUX_BUFFERS_BIT 0x00000010
174 #define GLX_DEPTH_BUFFER_BIT 0x00000020
175 #define GLX_STENCIL_BUFFER_BIT 0x00000040
176 #define GLX_ACCUM_BUFFER_BIT 0x00000080
179 ** Extension return values from glXGetConfig. These are also
180 ** accepted as parameter values for glXChooseVisual.
183 #define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */
184 #define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */
185 #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */
186 #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */
187 #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */
188 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */
189 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */
191 /* Property values for visual_type */
192 #define GLX_TRUE_COLOR_EXT 0x8002
193 #define GLX_DIRECT_COLOR_EXT 0x8003
194 #define GLX_PSEUDO_COLOR_EXT 0x8004
195 #define GLX_STATIC_COLOR_EXT 0x8005
196 #define GLX_GRAY_SCALE_EXT 0x8006
197 #define GLX_STATIC_GRAY_EXT 0x8007
199 /* Property values for transparent pixel */
200 #define GLX_NONE_EXT 0x8000
201 #define GLX_TRANSPARENT_RGB_EXT 0x8008
202 #define GLX_TRANSPARENT_INDEX_EXT 0x8009
204 /* Property values for visual_rating */
205 #define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */
206 #define GLX_SLOW_VISUAL_EXT 0x8001
207 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
210 ** Names for attributes to glXGetClientString.
212 #define GLX_VENDOR 0x1
213 #define GLX_VERSION 0x2
214 #define GLX_EXTENSIONS 0x3
217 ** Names for attributes to glXQueryContextInfoEXT.
219 #define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */
220 #define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */
221 #define GLX_SCREEN_EXT 0x800C /* screen number */
223 /* GLX Extension Strings */
224 #define GLX_EXT_import_context 1
225 #define GLX_EXT_visual_info 1
226 #define GLX_EXT_visual_rating 1
231 typedef XID GLXContextID;
232 typedef XID GLXPixmap;
233 typedef XID GLXDrawable;
234 typedef XID GLXPbuffer;
235 typedef XID GLXWindow;
236 typedef XID GLXFBConfigID;
239 ** GLXContext is a pointer to opaque data.
241 typedef struct __GLXcontextRec *GLXContext;
244 ** GLXFBConfig is a pointer to opaque data.
246 typedef struct __GLXFBConfigRec *GLXFBConfig;
248 /************************************************************************/
250 extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);
251 extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
252 extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
253 extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);
254 extern void glXDestroyContext (Display *dpy, GLXContext ctx);
255 extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);
256 extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);
257 extern GLXContext glXGetCurrentContext (void);
258 extern GLXDrawable glXGetCurrentDrawable (void);
259 extern Bool glXIsDirect (Display *dpy, GLXContext ctx);
260 extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);
261 extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);
262 extern Bool glXQueryVersion (Display *dpy, int *major, int *minor);
263 extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);
264 extern void glXUseXFont (Font font, int first, int count, int listBase);
265 extern void glXWaitGL (void);
266 extern void glXWaitX (void);
267 extern const char * glXGetClientString (Display *dpy, int name );
268 extern const char * glXQueryServerString (Display *dpy, int screen, int name );
269 extern const char * glXQueryExtensionsString (Display *dpy, int screen );
271 /* New for GLX 1.3 */
272 extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements);
273 extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
274 extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
275 extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
276 extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
277 extern void glXDestroyWindow (Display *dpy, GLXWindow win);
278 extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
279 extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
280 extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
281 extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
282 extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
283 extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
284 extern Bool glXMakeContextCurrent (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
285 extern GLXDrawable glXGetCurrentReadDrawable (void);
286 extern Display * glXGetCurrentDisplay (void);
287 extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
288 extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
289 extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
291 /*** SGI GLX extensions */
292 extern GLXContextID glXGetContextIDEXT (const GLXContext ctx);
293 extern GLXDrawable glXGetCurrentDrawableEXT (void);
294 extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
295 extern void glXFreeContextEXT (Display *dpy, GLXContext ctx);
296 extern int glXQueryContextInfoEXT (Display *dpy, GLXContext ctx, int attribute, int *value);
298 /*** Should these go here, or in another header? */
303 int event_type; /* GLX_DAMAGED or GLX_SAVED */
304 int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
305 unsigned long serial; /* # of last request processed by server */
306 Bool send_event; /* true if this came for SendEvent request */
307 Display *display; /* display the event was read from */
308 GLXDrawable drawable; /* XID of Drawable */
309 unsigned int buffer_mask; /* mask indicating which buffers are affected */
310 unsigned int aux_buffer; /* which aux buffer was affected */
313 int count; /* if nonzero, at least this many more */
314 } GLXPbufferClobberEvent;
316 typedef union __GLXEvent {
317 GLXPbufferClobberEvent glxpbufferclobber;
325 #endif /* !__glx_h__ */