1 /* 2 * Copyright 1994-1997 Mark Kilgard, All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Mark Kilgard 7 */ 8 #ifndef __glut_h__ 9 #define __glut_h__ 10 11 12 #include <GL/gl.h> 13 #include <GL/glu.h> 14 15 16 #if defined(__MINGW32__) 17 #include <GL/mesa_wgl.h> 18 #endif 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #if defined(_WIN32) 25 26 /* GLUT 3.7 now tries to avoid including <windows.h> 27 to avoid name space pollution, but Win32's <GL/gl.h> 28 needs APIENTRY and WINGDIAPI defined properly. 29 30 tjump@spgs.com contributes: 31 If users are building glut code on MS Windows, then they should 32 make sure they include windows.h early, let's not get into a 33 header definitions war since MS has proven it's capability to 34 change header dependencies w/o publishing they have done so. 35 36 So, let's not include windows.h here, as it's not really required and 37 MS own gl/gl.h *should* include it if the dependency is there. */ 38 39 /* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA 40 in your compile preprocessor options. */ 41 # if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) 42 # pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */ 43 /* To enable automatic SGI OpenGL for Windows library usage for GLUT, 44 define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */ 45 # ifdef GLUT_USE_SGI_OPENGL 46 # pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */ 47 # pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */ 48 # pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */ 49 # else 50 # pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */ 51 # pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */ 52 # pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */ 53 # endif 54 # endif 55 56 /* To disable supression of annoying warnings about floats being promoted 57 to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor 58 options. */ 59 # ifndef GLUT_NO_WARNING_DISABLE 60 # pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */ 61 # pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ 62 # endif 63 64 /* Win32 has an annoying issue where there are multiple C run-time 65 libraries (CRTs). If the executable is linked with a different CRT 66 from the GLUT DLL, the GLUT DLL will not share the same CRT static 67 data seen by the executable. In particular, atexit callbacks registered 68 in the executable will not be called if GLUT calls its (different) 69 exit routine). GLUT is typically built with the 70 "/MD" option (the CRT with multithreading DLL support), but the Visual 71 C++ linker default is "/ML" (the single threaded CRT). 72 73 One workaround to this issue is requiring users to always link with 74 the same CRT as GLUT is compiled with. That requires users supply a 75 non-standard option. GLUT 3.7 has its own built-in workaround where 76 the executable's "exit" function pointer is covertly passed to GLUT. 77 GLUT then calls the executable's exit function pointer to ensure that 78 any "atexit" calls registered by the application are called if GLUT 79 needs to exit. 80 81 Note that the __glut*WithExit routines should NEVER be called directly. 82 To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */ 83 84 /* XXX This is from Win32's <process.h> */ 85 # if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__cdecl) 86 /* Define __cdecl for non-Microsoft compilers. */ 87 # define __cdecl 88 # define GLUT_DEFINED___CDECL 89 # endif 90 # ifndef _CRTIMP 91 # ifdef _NTSDK 92 /* Definition compatible with NT SDK */ 93 # define _CRTIMP 94 # else 95 /* Current definition */ 96 # ifdef _DLL 97 # define _CRTIMP __declspec(dllimport) 98 # else 99 # define _CRTIMP 100 # endif 101 # endif 102 # define GLUT_DEFINED__CRTIMP 103 # endif 104 # ifndef GLUT_BUILDING_LIB 105 extern _CRTIMP void __cdecl exit(int); 106 # endif 107 108 /* GLUT callback calling convention for Win32. */ 109 # define GLUTCALLBACK __cdecl 110 111 /* for callback/function pointer defs */ 112 # define GLUTAPIENTRYV __cdecl 113 114 /* glut-win32 specific macros, defined to prevent collision with 115 and redifinition of Windows system defs, also removes requirement of 116 pretty much any standard windows header from this file */ 117 118 #if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__) 119 # define GLUTAPIENTRY __stdcall 120 #else 121 # define GLUTAPIENTRY 122 #endif 123 124 /* GLUT API entry point declarations for Win32. */ 125 #if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL) 126 # define GLUTAPI __declspec(dllexport) 127 #elif defined(_DLL) 128 # define GLUTAPI __declspec(dllimport) 129 #else 130 # define GLUTAPI extern 131 #endif 132 133 #if defined(_WIN32) && !defined(_WINDEF_) && !defined(MESA) 134 # if !defined(MESA_MINWARN) 135 # pragma message( "note: WINDOWS.H not included, providing Mesa definition of CALLBACK macro" ) 136 # pragma message( "----: and PROC typedef. If you receive compiler warnings about either ") 137 # pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" ) 138 # endif 139 # define CALLBACK __stdcall 140 141 #if !defined(__MINGW32__) 142 typedef int (GLUTAPIENTRY *PROC)(); 143 typedef void *HGLRC; 144 typedef void *HDC; 145 #endif 146 typedef unsigned long COLORREF; 147 #endif 148 149 #if defined(_WIN32) && !defined(_WINGDI_) && !defined(MESA) 150 # if !defined(MESA_MINWARN) 151 # pragma message( "note: WINDOWS.H not included, providing Mesa definition of wgl functions" ) 152 # pragma message( "----: and macros. If you receive compiler warnings about any being multiply ") 153 # pragma message( "----: defined you should include WINDOWS.H priot to gl/glut.h" ) 154 # endif 155 # define WGL_FONT_LINES 0 156 # define WGL_FONT_POLYGONS 1 157 # ifdef UNICODE 158 # define wglUseFontBitmaps wglUseFontBitmapsW 159 # define wglUseFontOutlines wglUseFontOutlinesW 160 # else 161 # define wglUseFontBitmaps wglUseFontBitmapsA 162 # define wglUseFontOutlines wglUseFontOutlinesA 163 # endif /* !UNICODE */ 164 typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; 165 typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; 166 # pragma warning( push ) 167 # pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */ 168 # define WGLAPI __declspec(dllimport) 169 WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); 170 WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC); 171 WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *); 172 WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc); 173 WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void); 174 WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); 175 WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); 176 WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void); 177 WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*); 178 WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *); 179 WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); 180 WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); 181 WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR); 182 WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); 183 WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *); 184 WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); 185 WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC); 186 WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int); 187 WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *); 188 WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC); 189 WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int); 190 WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long); 191 WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); 192 WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); 193 WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); 194 WGLAPI int GLAPIENTRY SwapBuffers(HDC); 195 WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *); 196 WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR); 197 WGLAPI int GLAPIENTRY GetPixelFormat(HDC); 198 WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); 199 # undef WGLAPI 200 # pragma warning( pop ) 201 #endif 202 203 #else /* _WIN32 not defined */ 204 205 /* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */ 206 # define GLUTAPIENTRY GLAPIENTRY 207 # define GLUTAPIENTRYV 208 # define GLUTCALLBACK 209 # define GLUTAPI extern 210 211 #endif 212 213 214 /** 215 GLUT API revision history: 216 217 GLUT_API_VERSION is updated to reflect incompatible GLUT 218 API changes (interface changes, semantic changes, deletions, 219 or additions). 220 221 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94 222 223 GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling, 224 extension. Supports new input devices like tablet, dial and button 225 box, and Spaceball. Easy to query OpenGL extensions. 226 227 GLUT_API_VERSION=3 glutMenuStatus added. 228 229 GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer, 230 glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic 231 video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc, 232 glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat, 233 glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). 234 235 GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP) 236 **/ 237 #ifndef GLUT_API_VERSION /* allow this to be overriden */ 238 #define GLUT_API_VERSION 5 239 #endif 240 241 /** 242 GLUT implementation revision history: 243 244 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT 245 API revisions and implementation revisions (ie, bug fixes). 246 247 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of 248 GLUT Xlib-based implementation. 11/29/94 249 250 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of 251 GLUT Xlib-based implementation providing GLUT version 2 252 interfaces. 253 254 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95 255 256 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95 257 258 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95 259 260 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96 261 262 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner 263 and video resize. 1/3/97 264 265 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines. 266 267 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release. 268 269 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling. 270 271 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support. 272 273 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface. 274 275 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h> 276 **/ 277 #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */ 278 #define GLUT_XLIB_IMPLEMENTATION 15 279 #endif 280 281 /* Display mode bit masks. */ 282 #define GLUT_RGB 0 283 #define GLUT_RGBA GLUT_RGB 284 #define GLUT_INDEX 1 285 #define GLUT_SINGLE 0 286 #define GLUT_DOUBLE 2 287 #define GLUT_ACCUM 4 288 #define GLUT_ALPHA 8 289 #define GLUT_DEPTH 16 290 #define GLUT_STENCIL 32 291 #if (GLUT_API_VERSION >= 2) 292 #define GLUT_MULTISAMPLE 128 293 #define GLUT_STEREO 256 294 #endif 295 #if (GLUT_API_VERSION >= 3) 296 #define GLUT_LUMINANCE 512 297 #endif 298 299 /* Mouse buttons. */ 300 #define GLUT_LEFT_BUTTON 0 301 #define GLUT_MIDDLE_BUTTON 1 302 #define GLUT_RIGHT_BUTTON 2 303 304 /* Mouse button state. */ 305 #define GLUT_DOWN 0 306 #define GLUT_UP 1 307 308 #if (GLUT_API_VERSION >= 2) 309 /* function keys */ 310 #define GLUT_KEY_F1 1 311 #define GLUT_KEY_F2 2 312 #define GLUT_KEY_F3 3 313 #define GLUT_KEY_F4 4 314 #define GLUT_KEY_F5 5 315 #define GLUT_KEY_F6 6 316 #define GLUT_KEY_F7 7 317 #define GLUT_KEY_F8 8 318 #define GLUT_KEY_F9 9 319 #define GLUT_KEY_F10 10 320 #define GLUT_KEY_F11 11 321 #define GLUT_KEY_F12 12 322 /* directional keys */ 323 #define GLUT_KEY_LEFT 100 324 #define GLUT_KEY_UP 101 325 #define GLUT_KEY_RIGHT 102 326 #define GLUT_KEY_DOWN 103 327 #define GLUT_KEY_PAGE_UP 104 328 #define GLUT_KEY_PAGE_DOWN 105 329 #define GLUT_KEY_HOME 106 330 #define GLUT_KEY_END 107 331 #define GLUT_KEY_INSERT 108 332 #endif 333 334 /* Entry/exit state. */ 335 #define GLUT_LEFT 0 336 #define GLUT_ENTERED 1 337 338 /* Menu usage state. */ 339 #define GLUT_MENU_NOT_IN_USE 0 340 #define GLUT_MENU_IN_USE 1 341 342 /* Visibility state. */ 343 #define GLUT_NOT_VISIBLE 0 344 #define GLUT_VISIBLE 1 345 346 /* Window status state. */ 347 #define GLUT_HIDDEN 0 348 #define GLUT_FULLY_RETAINED 1 349 #define GLUT_PARTIALLY_RETAINED 2 350 #define GLUT_FULLY_COVERED 3 351 352 /* Color index component selection values. */ 353 #define GLUT_RED 0 354 #define GLUT_GREEN 1 355 #define GLUT_BLUE 2 356 357 /* Layers for use. */ 358 #define GLUT_NORMAL 0 359 #define GLUT_OVERLAY 1 360 361 #if defined(_WIN32) || defined (GLUT_IMPORT_LIB) 362 /* Stroke font constants (use these in GLUT program). */ 363 #define GLUT_STROKE_ROMAN ((void*)0) 364 #define GLUT_STROKE_MONO_ROMAN ((void*)1) 365 366 /* Bitmap font constants (use these in GLUT program). */ 367 #define GLUT_BITMAP_9_BY_15 ((void*)2) 368 #define GLUT_BITMAP_8_BY_13 ((void*)3) 369 #define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4) 370 #define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5) 371 #if (GLUT_API_VERSION >= 3) 372 #define GLUT_BITMAP_HELVETICA_10 ((void*)6) 373 #define GLUT_BITMAP_HELVETICA_12 ((void*)7) 374 #define GLUT_BITMAP_HELVETICA_18 ((void*)8) 375 #endif 376 #else 377 /* Stroke font opaque addresses (use constants instead in source code). */ 378 GLUTAPI void *glutStrokeRoman; 379 GLUTAPI void *glutStrokeMonoRoman; 380 381 /* Stroke font constants (use these in GLUT program). */ 382 #define GLUT_STROKE_ROMAN (&glutStrokeRoman) 383 #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) 384 385 /* Bitmap font opaque addresses (use constants instead in source code). */ 386 GLUTAPI void *glutBitmap9By15; 387 GLUTAPI void *glutBitmap8By13; 388 GLUTAPI void *glutBitmapTimesRoman10; 389 GLUTAPI void *glutBitmapTimesRoman24; 390 GLUTAPI void *glutBitmapHelvetica10; 391 GLUTAPI void *glutBitmapHelvetica12; 392 GLUTAPI void *glutBitmapHelvetica18; 393 394 /* Bitmap font constants (use these in GLUT program). */ 395 #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) 396 #define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) 397 #define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) 398 #define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) 399 #if (GLUT_API_VERSION >= 3) 400 #define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) 401 #define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) 402 #define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) 403 #endif 404 #endif 405 406 /* glutGet parameters. */ 407 #define GLUT_WINDOW_X 100 408 #define GLUT_WINDOW_Y 101 409 #define GLUT_WINDOW_WIDTH 102 410 #define GLUT_WINDOW_HEIGHT 103 411 #define GLUT_WINDOW_BUFFER_SIZE 104 412 #define GLUT_WINDOW_STENCIL_SIZE 105 413 #define GLUT_WINDOW_DEPTH_SIZE 106 414 #define GLUT_WINDOW_RED_SIZE 107 415 #define GLUT_WINDOW_GREEN_SIZE 108 416 #define GLUT_WINDOW_BLUE_SIZE 109 417 #define GLUT_WINDOW_ALPHA_SIZE 110 418 #define GLUT_WINDOW_ACCUM_RED_SIZE 111 419 #define GLUT_WINDOW_ACCUM_GREEN_SIZE 112 420 #define GLUT_WINDOW_ACCUM_BLUE_SIZE 113 421 #define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114 422 #define GLUT_WINDOW_DOUBLEBUFFER 115 423 #define GLUT_WINDOW_RGBA 116 424 #define GLUT_WINDOW_PARENT 117 425 #define GLUT_WINDOW_NUM_CHILDREN 118 426 #define GLUT_WINDOW_COLORMAP_SIZE 119 427 #if (GLUT_API_VERSION >= 2) 428 #define GLUT_WINDOW_NUM_SAMPLES 120 429 #define GLUT_WINDOW_STEREO 121 430 #endif 431 #if (GLUT_API_VERSION >= 3) 432 #define GLUT_WINDOW_CURSOR 122 433 #endif 434 #define GLUT_SCREEN_WIDTH 200 435 #define GLUT_SCREEN_HEIGHT 201 436 #define GLUT_SCREEN_WIDTH_MM 202 437 #define GLUT_SCREEN_HEIGHT_MM 203 438 #define GLUT_MENU_NUM_ITEMS 300 439 #define GLUT_DISPLAY_MODE_POSSIBLE 400 440 #define GLUT_INIT_WINDOW_X 500 441 #define GLUT_INIT_WINDOW_Y 501 442 #define GLUT_INIT_WINDOW_WIDTH 502 443 #define GLUT_INIT_WINDOW_HEIGHT 503 444 #define GLUT_INIT_DISPLAY_MODE 504 445 #if (GLUT_API_VERSION >= 2) 446 #define GLUT_ELAPSED_TIME 700 447 #endif 448 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) 449 #define GLUT_WINDOW_FORMAT_ID 123 450 #endif 451 452 #if (GLUT_API_VERSION >= 2) 453 /* glutDeviceGet parameters. */ 454 #define GLUT_HAS_KEYBOARD 600 455 #define GLUT_HAS_MOUSE 601 456 #define GLUT_HAS_SPACEBALL 602 457 #define GLUT_HAS_DIAL_AND_BUTTON_BOX 603 458 #define GLUT_HAS_TABLET 604 459 #define GLUT_NUM_MOUSE_BUTTONS 605 460 #define GLUT_NUM_SPACEBALL_BUTTONS 606 461 #define GLUT_NUM_BUTTON_BOX_BUTTONS 607 462 #define GLUT_NUM_DIALS 608 463 #define GLUT_NUM_TABLET_BUTTONS 609 464 #endif 465 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) 466 #define GLUT_DEVICE_IGNORE_KEY_REPEAT 610 467 #define GLUT_DEVICE_KEY_REPEAT 611 468 #define GLUT_HAS_JOYSTICK 612 469 #define GLUT_OWNS_JOYSTICK 613 470 #define GLUT_JOYSTICK_BUTTONS 614 471 #define GLUT_JOYSTICK_AXES 615 472 #define GLUT_JOYSTICK_POLL_RATE 616 473 #endif 474 475 #if (GLUT_API_VERSION >= 3) 476 /* glutLayerGet parameters. */ 477 #define GLUT_OVERLAY_POSSIBLE 800 478 #define GLUT_LAYER_IN_USE 801 479 #define GLUT_HAS_OVERLAY 802 480 #define GLUT_TRANSPARENT_INDEX 803 481 #define GLUT_NORMAL_DAMAGED 804 482 #define GLUT_OVERLAY_DAMAGED 805 483 484 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) 485 /* glutVideoResizeGet parameters. */ 486 #define GLUT_VIDEO_RESIZE_POSSIBLE 900 487 #define GLUT_VIDEO_RESIZE_IN_USE 901 488 #define GLUT_VIDEO_RESIZE_X_DELTA 902 489 #define GLUT_VIDEO_RESIZE_Y_DELTA 903 490 #define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904 491 #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905 492 #define GLUT_VIDEO_RESIZE_X 906 493 #define GLUT_VIDEO_RESIZE_Y 907 494 #define GLUT_VIDEO_RESIZE_WIDTH 908 495 #define GLUT_VIDEO_RESIZE_HEIGHT 909 496 #endif 497 498 /* glutUseLayer parameters. */ 499 #define GLUT_NORMAL 0 500 #define GLUT_OVERLAY 1 501 502 /* glutGetModifiers return mask. */ 503 #define GLUT_ACTIVE_SHIFT 1 504 #define GLUT_ACTIVE_CTRL 2 505 #define GLUT_ACTIVE_ALT 4 506 507 /* glutSetCursor parameters. */ 508 /* Basic arrows. */ 509 #define GLUT_CURSOR_RIGHT_ARROW 0 510 #define GLUT_CURSOR_LEFT_ARROW 1 511 /* Symbolic cursor shapes. */ 512 #define GLUT_CURSOR_INFO 2 513 #define GLUT_CURSOR_DESTROY 3 514 #define GLUT_CURSOR_HELP 4 515 #define GLUT_CURSOR_CYCLE 5 516 #define GLUT_CURSOR_SPRAY 6 517 #define GLUT_CURSOR_WAIT 7 518 #define GLUT_CURSOR_TEXT 8 519 #define GLUT_CURSOR_CROSSHAIR 9 520 /* Directional cursors. */ 521 #define GLUT_CURSOR_UP_DOWN 10 522 #define GLUT_CURSOR_LEFT_RIGHT 11 523 /* Sizing cursors. */ 524 #define GLUT_CURSOR_TOP_SIDE 12 525 #define GLUT_CURSOR_BOTTOM_SIDE 13 526 #define GLUT_CURSOR_LEFT_SIDE 14 527 #define GLUT_CURSOR_RIGHT_SIDE 15 528 #define GLUT_CURSOR_TOP_LEFT_CORNER 16 529 #define GLUT_CURSOR_TOP_RIGHT_CORNER 17 530 #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18 531 #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19 532 /* Inherit from parent window. */ 533 #define GLUT_CURSOR_INHERIT 100 534 /* Blank cursor. */ 535 #define GLUT_CURSOR_NONE 101 536 /* Fullscreen crosshair (if available). */ 537 #define GLUT_CURSOR_FULL_CROSSHAIR 102 538 #endif 539 540 /* GLUT initialization sub-API. */ 541 GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv); 542 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) 543 GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)); 544 #ifndef GLUT_BUILDING_LIB 545 static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); } 546 #define glutInit glutInit_ATEXIT_HACK 547 #endif 548 #endif 549 GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode); 550 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) 551 GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string); 552 #endif 553 GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y); 554 GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height); 555 GLUTAPI void GLUTAPIENTRY glutMainLoop(void); 556 557 /* GLUT window sub-API. */ 558 GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title); 559 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) 560 GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)); 561 #ifndef GLUT_BUILDING_LIB 562 static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); } 563 #define glutCreateWindow glutCreateWindow_ATEXIT_HACK 564 #endif 565 #endif 566 GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height); 567 GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win); 568 GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void); 569 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) 570 GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win); 571 #endif 572 GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void); 573 GLUTAPI int GLUTAPIENTRY glutGetWindow(void); 574 GLUTAPI void GLUTAPIENTRY glutSetWindow(int win); 575 GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title); 576 GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title); 577 GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y); 578 GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height); 579 GLUTAPI void GLUTAPIENTRY glutPopWindow(void); 580 GLUTAPI void GLUTAPIENTRY glutPushWindow(void); 581 GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void); 582 GLUTAPI void GLUTAPIENTRY glutShowWindow(void); 583 GLUTAPI void GLUTAPIENTRY glutHideWindow(void); 584 #if (GLUT_API_VERSION >= 3) 585 GLUTAPI void GLUTAPIENTRY glutFullScreen(void); 586 GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor); 587 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) 588 GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y); 589 #endif 590 591 /* GLUT overlay sub-API. */ 592 GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void); 593 GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void); 594 GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer); 595 GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void); 596 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) 597 GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win); 598 #endif 599 GLUTAPI void GLUTAPIENTRY glutShowOverlay(void); 600 GLUTAPI void GLUTAPIENTRY glutHideOverlay(void); 601 #endif 602 603 /* GLUT menu sub-API. */ 604 GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int)); 605 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) 606 GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int)); 607 #ifndef GLUT_BUILDING_LIB 608 static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); } 609 #define glutCreateMenu glutCreateMenu_ATEXIT_HACK 610 #endif 611 #endif 612 GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu); 613 GLUTAPI int GLUTAPIENTRY glutGetMenu(void); 614 GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu); 615 GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value); 616 GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu); 617 GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value); 618 GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu); 619 GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item); 620 GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button); 621 GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button); 622 623 /* GLUT window callback sub-API. */ 624 GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void)); 625 GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height)); 626 GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); 627 GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); 628 GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); 629 GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); 630 GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state)); 631 GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state)); 632 GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void)); 633 GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value); 634 GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state)); 635 #if (GLUT_API_VERSION >= 2) 636 GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); 637 GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); 638 GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); 639 GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state)); 640 GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state)); 641 GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value)); 642 GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); 643 GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); 644 #if (GLUT_API_VERSION >= 3) 645 GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y)); 646 GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void)); 647 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) 648 GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state)); 649 #endif 650 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) 651 GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); 652 GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); 653 GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval); 654 #endif 655 #endif 656 #endif 657 658 /* GLUT color index sub-API. */ 659 GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue); 660 GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component); 661 GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win); 662 663 /* GLUT state retrieval sub-API. */ 664 GLUTAPI int GLUTAPIENTRY glutGet(GLenum type); 665 GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type); 666 #if (GLUT_API_VERSION >= 2) 667 /* GLUT extension support sub-API */ 668 GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name); 669 #endif 670 #if (GLUT_API_VERSION >= 3) 671 GLUTAPI int GLUTAPIENTRY glutGetModifiers(void); 672 GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type); 673 #endif 674 #if (GLUT_API_VERSION >= 5) 675 typedef void (*GLUTproc)(); 676 GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName); 677 #endif 678 679 /* GLUT font sub-API */ 680 GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character); 681 GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character); 682 GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character); 683 GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character); 684 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) 685 GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string); 686 GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string); 687 #endif 688 689 /* GLUT pre-built models sub-API */ 690 GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks); 691 GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); 692 GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); 693 GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); 694 GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size); 695 GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size); 696 GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); 697 GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); 698 GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void); 699 GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void); 700 GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size); 701 GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size); 702 GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void); 703 GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void); 704 GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void); 705 GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void); 706 GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void); 707 GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void); 708 709 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) 710 /* GLUT video resize sub-API. */ 711 GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param); 712 GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void); 713 GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void); 714 GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height); 715 GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height); 716 717 /* GLUT debugging sub-API. */ 718 GLUTAPI void GLUTAPIENTRY glutReportErrors(void); 719 #endif 720 721 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) 722 /* GLUT device control sub-API. */ 723 /* glutSetKeyRepeat modes. */ 724 #define GLUT_KEY_REPEAT_OFF 0 725 #define GLUT_KEY_REPEAT_ON 1 726 #define GLUT_KEY_REPEAT_DEFAULT 2 727 728 /* Joystick button masks. */ 729 #define GLUT_JOYSTICK_BUTTON_A 1 730 #define GLUT_JOYSTICK_BUTTON_B 2 731 #define GLUT_JOYSTICK_BUTTON_C 4 732 #define GLUT_JOYSTICK_BUTTON_D 8 733 734 GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore); 735 GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode); 736 GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void); 737 738 /* GLUT game mode sub-API. */ 739 /* glutGameModeGet. */ 740 #define GLUT_GAME_MODE_ACTIVE 0 741 #define GLUT_GAME_MODE_POSSIBLE 1 742 #define GLUT_GAME_MODE_WIDTH 2 743 #define GLUT_GAME_MODE_HEIGHT 3 744 #define GLUT_GAME_MODE_PIXEL_DEPTH 4 745 #define GLUT_GAME_MODE_REFRESH_RATE 5 746 #define GLUT_GAME_MODE_DISPLAY_CHANGED 6 747 748 GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string); 749 GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void); 750 GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void); 751 GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode); 752 #endif 753 754 #ifdef __cplusplus 755 } 756 #endif 757 758 759 #endif /* __glut_h__ */ 760