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