| 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 | |
| 23 | #include <X11/Xlib.h> |
| 24 | #include <X11/Xutil.h> |
| 25 | #include <X11/Xmd.h> |
| 26 | #include <GL/gl.h> |
| 27 | #include <GL/glxtokens.h> |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | /* |
| 34 | * GLX resources. |
| 35 | */ |
| 36 | typedef XID GLXContextID; |
| 37 | typedef XID GLXPixmap; |
| 38 | typedef XID GLXDrawable; |
| 39 | typedef XID GLXPbuffer; |
| 40 | typedef XID GLXWindow; |
| 41 | typedef XID GLXFBConfigID; |
| 42 | |
| 43 | /* |
| 44 | * GLXContext is a pointer to opaque data. |
| 45 | */ |
| 46 | typedef struct __GLXcontextRec *GLXContext; |
| 47 | |
| 48 | /* |
| 49 | * GLXFBConfig is a pointer to opaque data. |
| 50 | */ |
| 51 | typedef struct __GLXFBConfigRec *GLXFBConfig; |
| 52 | typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; |
| 53 | |
| 54 | |
| 55 | /* |
| 56 | * GLXVideoDeviceNV is an opaque handle to a video device (part of the |
| 57 | * GLX_NV_video_out extension). |
| 58 | */ |
| 59 | typedef unsigned int GLXVideoDeviceNV; |
| 60 | |
| 61 | |
| 62 | /**********************************************************************/ |
| 63 | |
| 64 | /* |
| 65 | * GLX 1.0 functions. |
| 66 | */ |
| 67 | extern XVisualInfo* glXChooseVisual(Display *dpy, int screen, |
| 68 | int *attrib_list); |
| 69 | |
| 70 | extern void glXCopyContext(Display *dpy, GLXContext src, |
| 71 | GLXContext dst, unsigned long mask); |
| 72 | |
| 73 | extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, |
| 74 | GLXContext share_list, Bool direct); |
| 75 | |
| 76 | extern GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, |
| 77 | Pixmap pixmap); |
| 78 | |
| 79 | extern void glXDestroyContext(Display *dpy, GLXContext ctx); |
| 80 | |
| 81 | extern void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix); |
| 82 | |
| 83 | extern int glXGetConfig(Display *dpy, XVisualInfo *vis, |
| 84 | int attrib, int *value); |
| 85 | |
| 86 | extern GLXContext glXGetCurrentContext(void); |
| 87 | |
| 88 | extern GLXDrawable glXGetCurrentDrawable(void); |
| 89 | |
| 90 | extern Bool glXIsDirect(Display *dpy, GLXContext ctx); |
| 91 | |
| 92 | extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, |
| 93 | GLXContext ctx); |
| 94 | |
| 95 | extern Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base); |
| 96 | |
| 97 | extern Bool glXQueryVersion(Display *dpy, int *major, int *minor); |
| 98 | |
| 99 | extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable); |
| 100 | |
| 101 | extern void glXUseXFont(Font font, int first, int count, int list_base); |
| 102 | |
| 103 | extern void glXWaitGL(void); |
| 104 | |
| 105 | extern void glXWaitX(void); |
| 106 | |
| 107 | |
| 108 | /* |
| 109 | * GLX 1.1 functions. |
| 110 | */ |
| 111 | extern const char *glXGetClientString(Display *dpy, int name); |
| 112 | |
| 113 | extern const char *glXQueryServerString(Display *dpy, int screen, int name); |
| 114 | |
| 115 | extern const char *glXQueryExtensionsString(Display *dpy, int screen); |
| 116 | |
| 117 | |
| 118 | /* |
| 119 | * GLX 1.2 functions. |
| 120 | */ |
| 121 | extern Display *glXGetCurrentDisplay(void); |
| 122 | |
| 123 | |
| 124 | /* |
| 125 | * GLX 1.3 functions. |
| 126 | */ |
| 127 | extern GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, |
| 128 | const int *attrib_list, int *nelements); |
| 129 | |
| 130 | extern GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, |
| 131 | int render_type, GLXContext share_list, |
| 132 | Bool direct); |
| 133 | |
| 134 | extern GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, |
| 135 | const int *attrib_list); |
| 136 | |
| 137 | extern GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, |
| 138 | Pixmap pixmap, const int *attrib_list); |
| 139 | |
| 140 | extern GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, |
| 141 | Window win, const int *attrib_list); |
| 142 | |
| 143 | extern void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf); |
| 144 | |
| 145 | extern void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap); |
| 146 | |
| 147 | extern void glXDestroyWindow(Display *dpy, GLXWindow win); |
| 148 | |
| 149 | extern GLXDrawable glXGetCurrentReadDrawable(void); |
| 150 | |
| 151 | extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, |
| 152 | int attribute, int *value); |
| 153 | |
| 154 | extern GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements); |
| 155 | |
| 156 | extern void glXGetSelectedEvent(Display *dpy, GLXDrawable draw, |
| 157 | unsigned long *event_mask); |
| 158 | |
| 159 | extern XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config); |
| 160 | |
| 161 | extern Bool glXMakeContextCurrent(Display *display, GLXDrawable draw, |
| 162 | GLXDrawable read, GLXContext ctx); |
| 163 | |
| 164 | extern int glXQueryContext(Display *dpy, GLXContext ctx, |
| 165 | int attribute, int *value); |
| 166 | |
| 167 | extern void glXQueryDrawable(Display *dpy, GLXDrawable draw, |
| 168 | int attribute, unsigned int *value); |
| 169 | |
| 170 | extern void glXSelectEvent(Display *dpy, GLXDrawable draw, |
| 171 | unsigned long event_mask); |
| 172 | |
| 173 | /* |
| 174 | * GLX 1.4 functions. |
| 175 | */ |
| 176 | extern void (*glXGetProcAddress(const GLubyte *procName))(void); |
| 177 | |
| 178 | |
| 179 | /**********************************************************************/ |
| 180 | |
| 181 | /* |
| 182 | * ARB_get_proc_address |
| 183 | */ |
| 184 | extern void (*glXGetProcAddressARB(const GLubyte *procName))(void); |
| 185 | |
| 186 | /* |
| 187 | * EXT_import_context |
| 188 | */ |
| 189 | extern Display *glXGetCurrentDisplayEXT(void); |
| 190 | |
| 191 | extern void glXFreeContextEXT(Display *dpy, GLXContext ctx); |
| 192 | |
| 193 | extern GLXContextID glXGetContextIDEXT(const GLXContext ctx); |
| 194 | |
| 195 | extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); |
| 196 | |
| 197 | extern int glXQueryContextInfoEXT(Display *dpy, GLXContext ctx, |
| 198 | int attribute, int *value); |
| 199 | |
| 200 | /* |
| 201 | * NV_vertex_array_range |
| 202 | */ |
| 203 | extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, |
| 204 | GLfloat writefreq, GLfloat priority); |
| 205 | |
| 206 | extern void glXFreeMemoryNV(GLvoid *pointer); |
| 207 | |
| 208 | /* |
| 209 | * SGI_video_sync |
| 210 | */ |
| 211 | extern int glXGetVideoSyncSGI(unsigned int *count); |
| 212 | |
| 213 | extern int glXWaitVideoSyncSGI(int divisor, int remainder, |
| 214 | unsigned int *count); |
| 215 | |
| 216 | extern int glXGetRefreshRateSGI(unsigned int *rate); |
| 217 | |
| 218 | /* |
| 219 | * SGI_swap_control |
| 220 | */ |
| 221 | |
| 222 | extern int glXSwapIntervalSGI(int interval); |
| 223 | |
| 224 | /* |
| 225 | * NV_swap_group |
| 226 | */ |
| 227 | |
| 228 | extern Bool glXJoinSwapGroupNV(Display *dpy, GLXDrawable drawable, |
| 229 | GLuint group); |
| 230 | |
| 231 | extern Bool glXBindSwapBarrierNV(Display *dpy, GLuint group, GLuint barrier); |
| 232 | |
| 233 | extern Bool glXQuerySwapGroupNV(Display *dpy, GLXDrawable drawable, |
| 234 | GLuint *group, GLuint *barrier); |
| 235 | |
| 236 | extern Bool glXQueryMaxSwapGroupsNV(Display *dpy, int screen, |
| 237 | GLuint *maxGroups, GLuint *maxBarriers); |
| 238 | |
| 239 | extern Bool glXQueryFrameCountNV(Display *dpy, int screen, GLuint *count); |
| 240 | |
| 241 | extern Bool glXResetFrameCountNV(Display *dpy, int screen); |
| 242 | |
| 243 | |
| 244 | /* |
| 245 | * NV_video_out |
| 246 | */ |
| 247 | |
| 248 | extern int glXGetVideoDeviceNV(Display *dpy, int screen, int numVideoDevices, |
| 249 | GLXVideoDeviceNV *pVideoDevice); |
| 250 | |
| 251 | extern int glXReleaseVideoDeviceNV(Display *dpy, int screen, |
| 252 | GLXVideoDeviceNV VideoDevice); |
| 253 | |
| 254 | extern int glXBindVideoImageNV(Display *dpy, GLXVideoDeviceNV VideoDevice, |
| 255 | GLXPbuffer pbuf, int iVideoBuffer); |
| 256 | |
| 257 | extern int glXReleaseVideoImageNV(Display *dpy, GLXPbuffer pbuf); |
| 258 | |
| 259 | extern int glXSendPbufferToVideoNV(Display *dpy, GLXPbuffer pbuf, |
| 260 | int iBufferType, |
| 261 | unsigned long *pulCounterPbuffer, |
| 262 | GLboolean bBlock); |
| 263 | |
| 264 | extern int glXGetVideoInfoNV(Display *dpy, int screen, |
| 265 | GLXVideoDeviceNV VideoDevice, |
| 266 | unsigned long *pulCounterOutputVideo, |
| 267 | unsigned long *pulCounterOutputPbuffer); |
| 268 | |
| 269 | |
| 270 | /* |
| 271 | * SGIX_fbconfig |
| 272 | */ |
| 273 | |
| 274 | extern int glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, |
| 275 | int attribute, int *value_return); |
| 276 | |
| 277 | extern GLXFBConfigSGIX *glXChooseFBConfigSGIX(Display *dpy, int screen, |
| 278 | const int *attrib_list, |
| 279 | int *nelements); |
| 280 | |
| 281 | extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display *dpy, |
| 282 | GLXFBConfigSGIX config, |
| 283 | Pixmap pixmap); |
| 284 | |
| 285 | extern GLXContext glXCreateContextWithConfigSGIX(Display *dpy, |
| 286 | GLXFBConfigSGIX config, |
| 287 | int render_type, |
| 288 | GLXContext share_list, |
| 289 | Bool direct); |
| 290 | |
| 291 | extern XVisualInfo *glXGetVisualFromFBConfigSGIX(Display *dpy, |
| 292 | GLXFBConfigSGIX config); |
| 293 | |
| 294 | extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX(Display *dpy, |
| 295 | XVisualInfo *vis); |
| 296 | |
| 297 | /* |
| 298 | * SGIX_pbuffer |
| 299 | */ |
| 300 | extern GLXPbuffer glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfig config, |
| 301 | unsigned int width, |
| 302 | unsigned int height, |
| 303 | const int *attrib_list); |
| 304 | |
| 305 | extern void glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf); |
| 306 | |
| 307 | extern void glXQueryGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf, |
| 308 | int attribute, unsigned int *value); |
| 309 | |
| 310 | extern void glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, |
| 311 | unsigned long mask); |
| 312 | |
| 313 | extern void glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, |
| 314 | unsigned long *mask); |
| 315 | |
| 316 | /* |
| 317 | * EXT_texture_from_pixmap |
| 318 | */ |
| 319 | extern void glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, |
| 320 | const int *attrib_list); |
| 321 | extern void glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer); |
| 322 | |
| 323 | /* |
| 324 | * SGIX_video_resize |
| 325 | */ |
| 326 | extern int glXBindChannelToWindowSGIX(Display *display, |
| 327 | int screen, int channel, Window window); |
| 328 | |
| 329 | extern int glXChannelRectSGIX(Display *display, int screen, int channel, |
| 330 | int x, int y, int w, int h); |
| 331 | |
| 332 | extern int glXQueryChannelRectSGIX(Display *display, int screen, int channel, |
| 333 | int *dx, int *dy, int *dw, int *dh); |
| 334 | |
| 335 | extern int glXQueryChannelDeltasSGIX(Display *display, int screen, int channel, |
| 336 | int *x, int *y, int *w, int *h); |
| 337 | |
| 338 | extern int glXChannelRectSyncSGIX(Display *display, int screen, int channel, |
| 339 | GLenum synctype); |
| 340 | |
| 341 | /**********************************************************************/ |
| 342 | |
| 343 | /*** Should these go here, or in another header? */ |
| 344 | /* |
| 345 | * GLX Events |
| 346 | */ |
| 347 | typedef struct { |
| 348 | int event_type; /* GLX_DAMAGED or GLX_SAVED */ |
| 349 | int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ |
| 350 | unsigned long serial; /* # of last request processed by server */ |
| 351 | Bool send_event; /* true if this came for SendEvent request */ |
| 352 | Display *display; /* display the event was read from */ |
| 353 | GLXDrawable drawable; /* XID of Drawable */ |
| 354 | unsigned int buffer_mask; /* mask indicating which buffers are affected */ |
| 355 | unsigned int aux_buffer; /* which aux buffer was affected */ |
| 356 | int x, y; |
| 357 | int width, height; |
| 358 | int count; /* if nonzero, at least this many more */ |
| 359 | } GLXPbufferClobberEvent; |
| 360 | |
| 361 | typedef union __GLXEvent { |
| 362 | GLXPbufferClobberEvent glxpbufferclobber; |
| 363 | long pad[24]; |
| 364 | } GLXEvent; |
| 365 | |
| 366 | #ifdef __cplusplus |
| 367 | } |
| 368 | #endif |
| 369 | |
| 370 | #endif /* !__glx_h__ */ |