1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /* $Id: glx.h,v 1.38 2002/10/14 13:52:27 brianp Exp $ */ 26 27 /* 28 * This file is available under and governed by the GNU General Public 29 * License version 2 only, as published by the Free Software Foundation. 30 * However, the following notice accompanied the original version of this 31 * file: 32 * 33 * Mesa 3-D graphics library 34 * Version: 4.1 35 * 36 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. 37 * 38 * Permission is hereby granted, free of charge, to any person obtaining a 39 * copy of this software and associated documentation files (the "Software"), 40 * to deal in the Software without restriction, including without limitation 41 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 42 * and/or sell copies of the Software, and to permit persons to whom the 43 * Software is furnished to do so, subject to the following conditions: 44 * 45 * The above copyright notice and this permission notice shall be included 46 * in all copies or substantial portions of the Software. 47 * 48 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 49 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 50 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 51 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 52 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 53 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 54 */ 55 56 57 #ifndef GLX_H 58 #define GLX_H 59 60 61 #ifdef __VMS 62 #include <GL/vms_x_fix.h> 63 # ifdef __cplusplus 64 /* VMS Xlib.h gives problems with C++. 65 * this avoids a bunch of trivial warnings */ 66 #pragma message disable nosimpint 67 #endif 68 #endif 69 #include <X11/Xlib.h> 70 #include <X11/Xutil.h> 71 #ifdef __VMS 72 # ifdef __cplusplus 73 #pragma message enable nosimpint 74 #endif 75 #endif 76 77 /* modified for inclusion in Java 2D source tree */ 78 /* #include <GL/gl.h> */ 79 #include "J2D_GL/gl.h" 80 81 /* 82 #if defined(USE_MGL_NAMESPACE) 83 #include <GL/glx_mangle.h> 84 #endif 85 */ 86 87 88 #ifdef __cplusplus 89 extern "C" { 90 #endif 91 92 93 #define GLX_VERSION_1_1 1 94 #define GLX_VERSION_1_2 1 95 #define GLX_VERSION_1_3 1 96 #define GLX_VERSION_1_4 1 97 98 #define GLX_EXTENSION_NAME "GLX" 99 100 101 102 /* 103 * Tokens for glXChooseVisual and glXGetConfig: 104 */ 105 #define GLX_USE_GL 1 106 #define GLX_BUFFER_SIZE 2 107 #define GLX_LEVEL 3 108 #define GLX_RGBA 4 109 #define GLX_DOUBLEBUFFER 5 110 #define GLX_STEREO 6 111 #define GLX_AUX_BUFFERS 7 112 #define GLX_RED_SIZE 8 113 #define GLX_GREEN_SIZE 9 114 #define GLX_BLUE_SIZE 10 115 #define GLX_ALPHA_SIZE 11 116 #define GLX_DEPTH_SIZE 12 117 #define GLX_STENCIL_SIZE 13 118 #define GLX_ACCUM_RED_SIZE 14 119 #define GLX_ACCUM_GREEN_SIZE 15 120 #define GLX_ACCUM_BLUE_SIZE 16 121 #define GLX_ACCUM_ALPHA_SIZE 17 122 123 124 /* 125 * Error codes returned by glXGetConfig: 126 */ 127 #define GLX_BAD_SCREEN 1 128 #define GLX_BAD_ATTRIBUTE 2 129 #define GLX_NO_EXTENSION 3 130 #define GLX_BAD_VISUAL 4 131 #define GLX_BAD_CONTEXT 5 132 #define GLX_BAD_VALUE 6 133 #define GLX_BAD_ENUM 7 134 135 136 /* 137 * GLX 1.1 and later: 138 */ 139 #define GLX_VENDOR 1 140 #define GLX_VERSION 2 141 #define GLX_EXTENSIONS 3 142 143 144 /* 145 * GLX 1.3 and later: 146 */ 147 #define GLX_CONFIG_CAVEAT 0x20 148 #define GLX_DONT_CARE 0xFFFFFFFF 149 #define GLX_SLOW_CONFIG 0x8001 150 #define GLX_NON_CONFORMANT_CONFIG 0x800D 151 #define GLX_X_VISUAL_TYPE 0x22 152 #define GLX_TRANSPARENT_TYPE 0x23 153 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 154 #define GLX_TRANSPARENT_RED_VALUE 0x25 155 #define GLX_TRANSPARENT_GREEN_VALUE 0x26 156 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 157 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 158 #define GLX_MAX_PBUFFER_WIDTH 0x8016 159 #define GLX_MAX_PBUFFER_HEIGHT 0x8017 160 #define GLX_MAX_PBUFFER_PIXELS 0x8018 161 #define GLX_PRESERVED_CONTENTS 0x801B 162 #define GLX_LARGEST_PBUFFER 0x801C 163 #define GLX_WIDTH 0x801D 164 #define GLX_HEIGHT 0x801E 165 #define GLX_EVENT_MASK 0x801F 166 #define GLX_DRAWABLE_TYPE 0x8010 167 #define GLX_FBCONFIG_ID 0x8013 168 #define GLX_VISUAL_ID 0x800B 169 #define GLX_WINDOW_BIT 0x00000001 170 #define GLX_PIXMAP_BIT 0x00000002 171 #define GLX_PBUFFER_BIT 0x00000004 172 #define GLX_AUX_BUFFERS_BIT 0x00000010 173 #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 174 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 175 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 176 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 177 #define GLX_DEPTH_BUFFER_BIT 0x00000020 178 #define GLX_STENCIL_BUFFER_BIT 0x00000040 179 #define GLX_ACCUM_BUFFER_BIT 0x00000080 180 #define GLX_DRAWABLE_TYPE 0x8010 181 #define GLX_RENDER_TYPE 0x8011 182 #define GLX_X_RENDERABLE 0x8012 183 #define GLX_NONE 0x8000 184 #define GLX_TRUE_COLOR 0x8002 185 #define GLX_DIRECT_COLOR 0x8003 186 #define GLX_PSEUDO_COLOR 0x8004 187 #define GLX_STATIC_COLOR 0x8005 188 #define GLX_GRAY_SCALE 0x8006 189 #define GLX_STATIC_GRAY 0x8007 190 #define GLX_TRANSPARENT_RGB 0x8008 191 #define GLX_TRANSPARENT_INDEX 0x8009 192 #define GLX_RGBA_TYPE 0x8014 193 #define GLX_COLOR_INDEX_TYPE 0x8015 194 #define GLX_COLOR_INDEX_BIT 0x00000002 195 #define GLX_RGBA_BIT 0x00000001 196 #define GLX_SCREEN 0x800C 197 #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 198 #define GLX_DAMAGED 0x8020 199 #define GLX_SAVED 0x8021 200 #define GLX_WINDOW 0x8022 201 #define GLX_PBUFFER 0x8023 202 203 /** 204 * REMIND: these values are backwards from Sun's OpenGL headers, so we 205 * swap them here if building on Solaris/Sparc 206 */ 207 #ifdef __sparc 208 #define GLX_PBUFFER_HEIGHT 0x8041 209 #define GLX_PBUFFER_WIDTH 0x8040 210 #else /* __sparc */ 211 #define GLX_PBUFFER_HEIGHT 0x8040 212 #define GLX_PBUFFER_WIDTH 0x8041 213 #endif /* __sparc */ 214 215 /* 216 * GLX 1.4 and later: 217 */ 218 #define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/ 219 #define GLX_SAMPLES 0x186a1 /*100001*/ 220 221 222 223 typedef struct __GLXcontextRec *GLXContext; 224 typedef XID GLXPixmap; 225 typedef XID GLXDrawable; 226 /* GLX 1.3 and later */ 227 typedef struct __GLXFBConfigRec *GLXFBConfig; 228 typedef XID GLXFBConfigID; 229 typedef XID GLXContextID; 230 typedef XID GLXWindow; 231 typedef XID GLXPbuffer; 232 233 234 235 extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, 236 int *attribList ); 237 238 extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, 239 GLXContext shareList, Bool direct ); 240 241 extern void glXDestroyContext( Display *dpy, GLXContext ctx ); 242 243 extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, 244 GLXContext ctx); 245 246 extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, 247 unsigned long mask ); 248 249 extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); 250 251 extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, 252 Pixmap pixmap ); 253 254 extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); 255 256 extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); 257 258 extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); 259 260 extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); 261 262 extern int glXGetConfig( Display *dpy, XVisualInfo *visual, 263 int attrib, int *value ); 264 265 extern GLXContext glXGetCurrentContext( void ); 266 267 extern GLXDrawable glXGetCurrentDrawable( void ); 268 269 extern void glXWaitGL( void ); 270 271 extern void glXWaitX( void ); 272 273 extern void glXUseXFont( Font font, int first, int count, int list ); 274 275 276 277 /* GLX 1.1 and later */ 278 extern const char *glXQueryExtensionsString( Display *dpy, int screen ); 279 280 extern const char *glXQueryServerString( Display *dpy, int screen, int name ); 281 282 extern const char *glXGetClientString( Display *dpy, int name ); 283 284 285 /* GLX 1.2 and later */ 286 extern Display *glXGetCurrentDisplay( void ); 287 288 289 /* GLX 1.3 and later */ 290 extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen, 291 const int *attribList, int *nitems ); 292 293 extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, 294 int attribute, int *value ); 295 296 extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen, 297 int *nelements ); 298 299 extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, 300 GLXFBConfig config ); 301 302 extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config, 303 Window win, const int *attribList ); 304 305 extern void glXDestroyWindow( Display *dpy, GLXWindow window ); 306 307 extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config, 308 Pixmap pixmap, const int *attribList ); 309 310 extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ); 311 312 extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config, 313 const int *attribList ); 314 315 extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ); 316 317 extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, 318 unsigned int *value ); 319 320 extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config, 321 int renderType, GLXContext shareList, 322 Bool direct ); 323 324 extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw, 325 GLXDrawable read, GLXContext ctx ); 326 327 extern GLXDrawable glXGetCurrentReadDrawable( void ); 328 329 extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute, 330 int *value ); 331 332 extern void glXSelectEvent( Display *dpy, GLXDrawable drawable, 333 unsigned long mask ); 334 335 extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, 336 unsigned long *mask ); 337 338 339 /* GLX 1.4 and later */ 340 extern void (*glXGetProcAddress(const GLubyte *procname))(); 341 342 343 #ifndef GLX_GLXEXT_LEGACY 344 345 /* modified for inclusion in Java 2D source tree */ 346 /* #include <GL/glxext.h> */ 347 #include "J2D_GL/glxext.h" 348 349 #else 350 351 352 /* 353 * 28. GLX_EXT_visual_info extension 354 */ 355 #ifndef GLX_EXT_visual_info 356 #define GLX_EXT_visual_info 1 357 358 #define GLX_X_VISUAL_TYPE_EXT 0x22 359 #define GLX_TRANSPARENT_TYPE_EXT 0x23 360 #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 361 #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 362 #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 363 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 364 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 365 #define GLX_TRUE_COLOR_EXT 0x8002 366 #define GLX_DIRECT_COLOR_EXT 0x8003 367 #define GLX_PSEUDO_COLOR_EXT 0x8004 368 #define GLX_STATIC_COLOR_EXT 0x8005 369 #define GLX_GRAY_SCALE_EXT 0x8006 370 #define GLX_STATIC_GRAY_EXT 0x8007 371 #define GLX_NONE_EXT 0x8000 372 #define GLX_TRANSPARENT_RGB_EXT 0x8008 373 #define GLX_TRANSPARENT_INDEX_EXT 0x8009 374 375 #endif /* 28. GLX_EXT_visual_info extension */ 376 377 378 379 /* 380 * 41. GLX_SGI_video_sync 381 */ 382 #ifndef GLX_SGI_video_sync 383 #define GLX_SGI_video_sync 1 384 385 extern int glXGetVideoSyncSGI(unsigned int *count); 386 extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count); 387 388 #endif /* GLX_SGI_video_sync */ 389 390 391 392 /* 393 * 42. GLX_EXT_visual_rating 394 */ 395 #ifndef GLX_EXT_visual_rating 396 #define GLX_EXT_visual_rating 1 397 398 #define GLX_VISUAL_CAVEAT_EXT 0x20 399 /*#define GLX_NONE_EXT 0x8000*/ 400 #define GLX_SLOW_VISUAL_EXT 0x8001 401 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D 402 403 #endif /* GLX_EXT_visual_rating */ 404 405 406 407 /* 408 * 47. GLX_EXT_import_context 409 */ 410 #ifndef GLX_EXT_import_context 411 #define GLX_EXT_import_context 1 412 413 #define GLX_SHARE_CONTEXT_EXT 0x800A 414 #define GLX_VISUAL_ID_EXT 0x800B 415 #define GLX_SCREEN_EXT 0x800C 416 417 extern void glXFreeContextEXT(Display *dpy, GLXContext context); 418 419 extern GLXContextID glXGetContextIDEXT(const GLXContext context); 420 421 extern Display *glXGetCurrentDisplayEXT(void); 422 423 extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); 424 425 extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context, 426 int attribute,int *value); 427 428 #endif /* GLX_EXT_import_context */ 429 430 431 432 /* 433 * 215. GLX_MESA_copy_sub_buffer 434 */ 435 #ifndef GLX_MESA_copy_sub_buffer 436 #define GLX_MESA_copy_sub_buffer 1 437 438 extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, 439 int x, int y, int width, int height ); 440 441 #endif 442 443 444 445 /* 446 * 216. GLX_MESA_pixmap_colormap 447 */ 448 #ifndef GLX_MESA_pixmap_colormap 449 #define GLX_MESA_pixmap_colormap 1 450 451 extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, 452 Pixmap pixmap, Colormap cmap ); 453 454 #endif /* GLX_MESA_pixmap_colormap */ 455 456 457 458 /* 459 * 217. GLX_MESA_release_buffers 460 */ 461 #ifndef GLX_MESA_release_buffers 462 #define GLX_MESA_release_buffers 1 463 464 extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); 465 466 #endif /* GLX_MESA_release_buffers */ 467 468 469 470 /* 471 * 218. GLX_MESA_set_3dfx_mode 472 */ 473 #ifndef GLX_MESA_set_3dfx_mode 474 #define GLX_MESA_set_3dfx_mode 1 475 476 #define GLX_3DFX_WINDOW_MODE_MESA 0x1 477 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 478 479 extern Bool glXSet3DfxModeMESA( int mode ); 480 481 #endif /* GLX_MESA_set_3dfx_mode */ 482 483 484 485 /* 486 * ARB 2. GLX_ARB_get_proc_address 487 */ 488 #ifndef GLX_ARB_get_proc_address 489 #define GLX_ARB_get_proc_address 1 490 491 extern void (*glXGetProcAddressARB(const GLubyte *procName))(); 492 493 #endif /* GLX_ARB_get_proc_address */ 494 495 496 497 #endif /* GLX_GLXEXT_LEGACY */ 498 499 500 /** 501 ** The following aren't in glxext.h yet. 502 **/ 503 504 505 /* 506 * ???. GLX_NV_vertex_array_range 507 */ 508 #ifndef GLX_NV_vertex_array_range 509 #define GLX_NV_vertex_array_range 510 511 extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); 512 extern void glXFreeMemoryNV(GLvoid *pointer); 513 typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); 514 typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); 515 516 #endif /* GLX_NV_vertex_array_range */ 517 518 519 520 /* 521 * ???. GLX_MESA_agp_offset 522 */ 523 #ifndef GLX_MESA_agp_offset 524 #define GLX_MESA_agp_offset 1 525 526 extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer); 527 typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer); 528 529 #endif /* GLX_MESA_agp_offset */ 530 531 532 533 #ifdef __cplusplus 534 } 535 #endif 536 537 #endif