import NVIDIA-FreeBSD-x86-190.42
[nvidia.git] / doc / glx.h
CommitLineData
8b1b599b
SS
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.
cfb7e7a6
SS
21**
22** $Header: //sw/main/drivers/OpenGL/win/glx/include/glx.h#21 $
8b1b599b
SS
23*/
24
25#include <X11/Xlib.h>
26#include <X11/Xutil.h>
8b1b599b 27#include <GL/gl.h>
8b1b599b
SS
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
cfb7e7a6
SS
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
138typedef void (*__GLXextFuncPtr)(void);
139#endif
140
8b1b599b
SS
141/*
142 * GLX resources.
143 */
144typedef XID GLXContextID;
145typedef XID GLXPixmap;
146typedef XID GLXDrawable;
147typedef XID GLXPbuffer;
148typedef XID GLXWindow;
149typedef XID GLXFBConfigID;
150
151/*
152 * GLXContext is a pointer to opaque data.
153 */
154typedef struct __GLXcontextRec *GLXContext;
155
156/*
157 * GLXFBConfig is a pointer to opaque data.
158 */
159typedef struct __GLXFBConfigRec *GLXFBConfig;
8b1b599b
SS
160
161
162/**********************************************************************/
163
164/*
165 * GLX 1.0 functions.
166 */
167extern XVisualInfo* glXChooseVisual(Display *dpy, int screen,
168 int *attrib_list);
169
170extern void glXCopyContext(Display *dpy, GLXContext src,
171 GLXContext dst, unsigned long mask);
172
173extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
174 GLXContext share_list, Bool direct);
175
176extern GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,
177 Pixmap pixmap);
178
179extern void glXDestroyContext(Display *dpy, GLXContext ctx);
180
181extern void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix);
182
183extern int glXGetConfig(Display *dpy, XVisualInfo *vis,
184 int attrib, int *value);
185
186extern GLXContext glXGetCurrentContext(void);
187
188extern GLXDrawable glXGetCurrentDrawable(void);
189
190extern Bool glXIsDirect(Display *dpy, GLXContext ctx);
191
192extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable,
193 GLXContext ctx);
194
195extern Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base);
196
197extern Bool glXQueryVersion(Display *dpy, int *major, int *minor);
198
199extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable);
200
201extern void glXUseXFont(Font font, int first, int count, int list_base);
202
203extern void glXWaitGL(void);
204
205extern void glXWaitX(void);
206
207
cfb7e7a6
SS
208#ifndef GLX_VERSION_1_1
209#define GLX_VERSION_1_1 1
8b1b599b
SS
210/*
211 * GLX 1.1 functions.
212 */
213extern const char *glXGetClientString(Display *dpy, int name);
214
215extern const char *glXQueryServerString(Display *dpy, int screen, int name);
216
217extern const char *glXQueryExtensionsString(Display *dpy, int screen);
cfb7e7a6 218#endif
8b1b599b
SS
219
220
cfb7e7a6
SS
221#ifndef GLX_VERSION_1_2
222#define GLX_VERSION_1_2 1
8b1b599b
SS
223/*
224 * GLX 1.2 functions.
225 */
226extern Display *glXGetCurrentDisplay(void);
cfb7e7a6 227#endif
8b1b599b 228
cfb7e7a6
SS
229#ifndef GLX_VERSION_1_3
230#define GLX_VERSION_1_3 1
8b1b599b
SS
231/*
232 * GLX 1.3 functions.
233 */
234extern GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen,
235 const int *attrib_list, int *nelements);
236
237extern GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config,
238 int render_type, GLXContext share_list,
239 Bool direct);
240
241extern GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config,
242 const int *attrib_list);
243
244extern GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config,
245 Pixmap pixmap, const int *attrib_list);
246
247extern GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config,
248 Window win, const int *attrib_list);
249
250extern void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf);
251
252extern void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap);
253
254extern void glXDestroyWindow(Display *dpy, GLXWindow win);
255
256extern GLXDrawable glXGetCurrentReadDrawable(void);
257
258extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config,
259 int attribute, int *value);
260
261extern GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements);
262
263extern void glXGetSelectedEvent(Display *dpy, GLXDrawable draw,
264 unsigned long *event_mask);
265
266extern XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config);
267
268extern Bool glXMakeContextCurrent(Display *display, GLXDrawable draw,
269 GLXDrawable read, GLXContext ctx);
270
271extern int glXQueryContext(Display *dpy, GLXContext ctx,
272 int attribute, int *value);
273
274extern void glXQueryDrawable(Display *dpy, GLXDrawable draw,
275 int attribute, unsigned int *value);
276
277extern void glXSelectEvent(Display *dpy, GLXDrawable draw,
278 unsigned long event_mask);
279
cfb7e7a6
SS
280typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
281typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
282typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
283typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
284typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
285typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
286typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
287typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
288typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
289typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
290typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
291typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
292typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
293typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
294typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
295typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
296typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
297typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
298#endif
8b1b599b 299
05d5f840 300
cfb7e7a6
SS
301#ifndef GLX_VERSION_1_4
302#define GLX_VERSION_1_4 1
8b1b599b 303/*
cfb7e7a6 304 * GLX 1.4 functions and typedefs.
8b1b599b 305 */
cfb7e7a6
SS
306extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *);
307typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
308#endif
8b1b599b 309
8b1b599b 310
8b1b599b 311
cfb7e7a6 312/**********************************************************************/
8b1b599b 313
05d5f840 314/*
cfb7e7a6 315 * ARB_get_proc_address
05d5f840 316 */
cfb7e7a6
SS
317#ifndef GLX_ARB_get_proc_address
318#define GLX_ARB_get_proc_address 1
319/* Don't wrap this in GLX_GLXEXT_PROTOTYPES! */
320extern void (*glXGetProcAddressARB(const GLubyte *procName))(void);
321typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
322#endif
05d5f840 323
8b1b599b
SS
324/**********************************************************************/
325
326/*** Should these go here, or in another header? */
327/*
328 * GLX Events
329 */
330typedef 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
344typedef union __GLXEvent {
345 GLXPbufferClobberEvent glxpbufferclobber;
346 long pad[24];
347} GLXEvent;
348
cfb7e7a6
SS
349#ifndef GLX_GLXEXT_LEGACY
350#include <GL/glxext.h>
351#endif
352
8b1b599b
SS
353#ifdef __cplusplus
354}
355#endif
356
357#endif /* !__glx_h__ */