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.
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.
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.
22 ** $Header: //sw/main/drivers/OpenGL/win/glx/include/glx.h#21 $
26 #include <X11/Xutil.h>
34 * Names for attributes to glXGetConfig.
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 */
55 * Error return values from glXGetConfig. Success is indicated by
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
67 * Names for attributes to glXGetClientString.
69 #define GLX_VENDOR 0x1
70 #define GLX_VERSION 0x2
71 #define GLX_EXTENSIONS 0x3
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
132 #ifndef GLX_VERSION_1_4
133 #define GLX_SAMPLE_BUFFERS 0x186a0
134 #define GLX_SAMPLES 0x186a1
137 #ifndef GLX_ARB_get_proc_address
138 typedef void (*__GLXextFuncPtr
)(void);
144 typedef XID GLXContextID
;
145 typedef XID GLXPixmap
;
146 typedef XID GLXDrawable
;
147 typedef XID GLXPbuffer
;
148 typedef XID GLXWindow
;
149 typedef XID GLXFBConfigID
;
152 * GLXContext is a pointer to opaque data.
154 typedef struct __GLXcontextRec
*GLXContext
;
157 * GLXFBConfig is a pointer to opaque data.
159 typedef struct __GLXFBConfigRec
*GLXFBConfig
;
162 /**********************************************************************/
167 extern XVisualInfo
* glXChooseVisual(Display
*dpy
, int screen
,
170 extern void glXCopyContext(Display
*dpy
, GLXContext src
,
171 GLXContext dst
, unsigned long mask
);
173 extern GLXContext
glXCreateContext(Display
*dpy
, XVisualInfo
*vis
,
174 GLXContext share_list
, Bool direct
);
176 extern GLXPixmap
glXCreateGLXPixmap(Display
*dpy
, XVisualInfo
*vis
,
179 extern void glXDestroyContext(Display
*dpy
, GLXContext ctx
);
181 extern void glXDestroyGLXPixmap(Display
*dpy
, GLXPixmap pix
);
183 extern int glXGetConfig(Display
*dpy
, XVisualInfo
*vis
,
184 int attrib
, int *value
);
186 extern GLXContext
glXGetCurrentContext(void);
188 extern GLXDrawable
glXGetCurrentDrawable(void);
190 extern Bool
glXIsDirect(Display
*dpy
, GLXContext ctx
);
192 extern Bool
glXMakeCurrent(Display
*dpy
, GLXDrawable drawable
,
195 extern Bool
glXQueryExtension(Display
*dpy
, int *error_base
, int *event_base
);
197 extern Bool
glXQueryVersion(Display
*dpy
, int *major
, int *minor
);
199 extern void glXSwapBuffers(Display
*dpy
, GLXDrawable drawable
);
201 extern void glXUseXFont(Font font
, int first
, int count
, int list_base
);
203 extern void glXWaitGL(void);
205 extern void glXWaitX(void);
208 #ifndef GLX_VERSION_1_1
209 #define GLX_VERSION_1_1 1
213 extern const char *glXGetClientString(Display
*dpy
, int name
);
215 extern const char *glXQueryServerString(Display
*dpy
, int screen
, int name
);
217 extern const char *glXQueryExtensionsString(Display
*dpy
, int screen
);
221 #ifndef GLX_VERSION_1_2
222 #define GLX_VERSION_1_2 1
226 extern Display
*glXGetCurrentDisplay(void);
229 #ifndef GLX_VERSION_1_3
230 #define GLX_VERSION_1_3 1
234 extern GLXFBConfig
*glXChooseFBConfig(Display
*dpy
, int screen
,
235 const int *attrib_list
, int *nelements
);
237 extern GLXContext
glXCreateNewContext(Display
*dpy
, GLXFBConfig config
,
238 int render_type
, GLXContext share_list
,
241 extern GLXPbuffer
glXCreatePbuffer(Display
*dpy
, GLXFBConfig config
,
242 const int *attrib_list
);
244 extern GLXPixmap
glXCreatePixmap(Display
*dpy
, GLXFBConfig config
,
245 Pixmap pixmap
, const int *attrib_list
);
247 extern GLXWindow
glXCreateWindow(Display
*dpy
, GLXFBConfig config
,
248 Window win
, const int *attrib_list
);
250 extern void glXDestroyPbuffer(Display
*dpy
, GLXPbuffer pbuf
);
252 extern void glXDestroyPixmap(Display
*dpy
, GLXPixmap pixmap
);
254 extern void glXDestroyWindow(Display
*dpy
, GLXWindow win
);
256 extern GLXDrawable
glXGetCurrentReadDrawable(void);
258 extern int glXGetFBConfigAttrib(Display
*dpy
, GLXFBConfig config
,
259 int attribute
, int *value
);
261 extern GLXFBConfig
*glXGetFBConfigs(Display
*dpy
, int screen
, int *nelements
);
263 extern void glXGetSelectedEvent(Display
*dpy
, GLXDrawable draw
,
264 unsigned long *event_mask
);
266 extern XVisualInfo
*glXGetVisualFromFBConfig(Display
*dpy
, GLXFBConfig config
);
268 extern Bool
glXMakeContextCurrent(Display
*display
, GLXDrawable draw
,
269 GLXDrawable read
, GLXContext ctx
);
271 extern int glXQueryContext(Display
*dpy
, GLXContext ctx
,
272 int attribute
, int *value
);
274 extern void glXQueryDrawable(Display
*dpy
, GLXDrawable draw
,
275 int attribute
, unsigned int *value
);
277 extern void glXSelectEvent(Display
*dpy
, GLXDrawable draw
,
278 unsigned long event_mask
);
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
);
301 #ifndef GLX_VERSION_1_4
302 #define GLX_VERSION_1_4 1
304 * GLX 1.4 functions and typedefs.
306 extern __GLXextFuncPtr
glXGetProcAddress (const GLubyte
*);
307 typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC
) (const GLubyte
*procName
);
312 /**********************************************************************/
315 * ARB_get_proc_address
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
);
324 /**********************************************************************/
326 /*** Should these go here, or in another header? */
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 */
341 int count
; /* if nonzero, at least this many more */
342 } GLXPbufferClobberEvent
;
344 typedef union __GLXEvent
{
345 GLXPbufferClobberEvent glxpbufferclobber
;
349 #ifndef GLX_GLXEXT_LEGACY
350 #include <GL3/glxext3.h>
357 #endif /* !__glx_h__ */