4 /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998, 2000, 2006. */
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. */
10 #if defined(_WIN32) || defined(__CYGWIN__)
12 /* GLUT 3.7 now tries to avoid including <windows.h>
13 to avoid name space pollution, but Win32's <GL/gl.h>
14 needs APIENTRY and WINGDIAPI defined properly. */
16 /* This would put tons of macros and crap in our clean name space. */
17 # define WIN32_LEAN_AND_MEAN
20 /* XXX This is from Win32's <windef.h> */
22 # define GLUT_APIENTRY_DEFINED
23 /* Cygwin and MingW32 are two free GNU-based Open Source compilation
24 environments for Win32. Note that __CYGWIN32__ is deprecated
25 in favor of simply __CYGWIN__. */
26 # if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
27 # if defined(__CYGWIN__)
28 # define APIENTRY __stdcall
31 # define APIENTRY __attribute__((stdcall))
37 # if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
38 # define APIENTRY __stdcall
44 /* XXX This is from Win32's <winnt.h> */
46 # if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
48 # define __stdcall __attribute__((stdcall))
50 # define CALLBACK __stdcall
52 # if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
53 # define CALLBACK __stdcall
59 /* XXX This is from Win32's <wingdi.h> and <winnt.h> */
61 # define GLUT_WINGDIAPI_DEFINED
62 # if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
65 # define WINGDIAPI __declspec(dllimport)
68 # if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
69 /* Rely on Cygwin32/MingW32 <stddef.h> to set wchar_t. */
70 /* XXX Warning. The Cygwin32/MingW32 definition for wchar_t
71 is an "int" instead of the "short" used by Windows. */
74 /* XXX This is from Win32's <ctype.h> */
75 # ifndef _WCHAR_T_DEFINED
76 typedef unsigned short wchar_t;
77 # define _WCHAR_T_DEFINED
82 /* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
83 in your compile preprocessor options (Microsoft Visual C only). */
84 # if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) && defined(_MSC_VER)
85 # pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
86 # pragma comment (lib, "user32.lib") /* link with Windows User lib */
87 # pragma comment (lib, "gdi32.lib") /* link with Windows GDI lib */
88 /* To enable automatic SGI OpenGL for Windows library usage for GLUT,
89 define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
90 # ifdef GLUT_USE_SGI_OPENGL
91 # pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
92 # pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
93 # if defined(GLUT_STATIC_LIB)
94 # pragma comment (lib, "glutstatic.lib") /* link with static Win32 GLUT lib */
96 # pragma comment (lib, "glut.lib") /* link with Win32 GLUT lib */
99 # pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
100 # pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
101 # if defined(GLUT_STATIC_LIB)
102 # pragma comment (lib, "glutstatic.lib") /* link with static Win32 GLUT lib */
104 # pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
109 /* To disable supression of annoying warnings about floats being promoted
110 to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
112 # if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
113 # pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
114 # pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
117 /* Win32 has an annoying issue where there are multiple C run-time
118 libraries (CRTs). If the executable is linked with a different CRT
119 from the GLUT DLL, the GLUT DLL will not share the same CRT static
120 data seen by the executable. In particular, atexit callbacks registered
121 in the executable will not be called if GLUT calls its (different)
122 exit routine). GLUT is typically built with the
123 "/MD" option (the CRT with multithreading DLL support), but the Visual
124 C++ linker default is "/ML" (the single threaded CRT).
126 One workaround to this issue is requiring users to always link with
127 the same CRT as GLUT is compiled with. That requires users supply a
128 non-standard option. GLUT 3.7 has its own built-in workaround where
129 the executable's "exit" function pointer is covertly passed to GLUT.
130 GLUT then calls the executable's exit function pointer to ensure that
131 any "atexit" calls registered by the application are called if GLUT
134 Note that the __glut*WithExit routines should NEVER be called directly.
135 To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
137 /* XXX This is from Win32's <process.h> */
138 # if !defined(_MSC_VER) && !defined(__cdecl)
139 /* Define __cdecl for non-Microsoft compilers. */
141 # define GLUT_DEFINED___CDECL
145 /* Definition compatible with NT SDK */
148 /* Current definition */
150 # define _CRTIMP __declspec(dllimport)
155 # define GLUT_DEFINED__CRTIMP
158 /* GLUT API entry point declarations for Win32. */
159 # ifdef GLUT_BUILDING_LIB
160 /* MSDN article 835326 says "When you build a DLL by using the 64-bit
161 version of the Microsoft Visual C++ Compiler and Linker, you may
162 receive Linker error number LNK4197 if a function has been declared
163 for export more than one time." GLUT builds with glut.def that
164 declares GLUT's EXPORTS list so do not use __declspec(dllexport)
165 to keep 64-bit compiler happy. */
166 # define GLUTAPI /*__declspec(dllexport)*/
169 # define GLUTAPI __declspec(dllimport)
171 # define GLUTAPI extern
175 /* GLUT callback calling convention for Win32. */
176 # define GLUTCALLBACK __cdecl
178 # if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
179 # define GLUTAPIENTRY __stdcall
181 # define GLUTAPIENTRY
193 #if defined(_WIN32) || defined(__CYGWIN__)
194 # ifndef GLUT_BUILDING_LIB
196 # if defined(_BUILDRTLDLL)
197 void __cdecl __export exit(int __status);
199 void __cdecl exit(int __status);
202 # if _MSC_VER >= 1200
203 extern _CRTIMP __declspec(noreturn) void __cdecl exit(int);
205 extern _CRTIMP void __cdecl exit(int);
210 /* non-Win32 case. */
211 /* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */
213 # define GLUT_APIENTRY_DEFINED
215 /* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */
216 # define GLUTAPI extern
217 # define GLUTAPIENTRY
218 # define GLUTCALLBACK
219 /* Prototype exit for the non-Win32 case (see above). */
221 extern void exit(int __status) __attribute__((__noreturn__));
223 extern void exit(int);
228 GLUT API revision history:
230 GLUT_API_VERSION is updated to reflect incompatible GLUT
231 API changes (interface changes, semantic changes, deletions,
234 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
236 GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
237 extension. Supports new input devices like tablet, dial and button
238 box, and Spaceball. Easy to query OpenGL extensions.
240 GLUT_API_VERSION=3 glutMenuStatus added.
242 GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
243 glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
244 video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
245 glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
246 glutJoystickFunc, glutForceJoystickFunc, glutStrokeWidthf,
247 glutStrokeLengthf (NOT FINALIZED!).
249 #ifndef GLUT_API_VERSION /* allow this to be overriden */
250 #define GLUT_API_VERSION 3
254 GLUT implementation revision history:
256 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
257 API revisions and implementation revisions (ie, bug fixes).
259 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
260 GLUT Xlib-based implementation. 11/29/94
262 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
263 GLUT Xlib-based implementation providing GLUT version 2
266 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
268 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
270 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
272 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
274 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
275 and video resize. 1/3/97
277 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
279 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
281 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
283 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
285 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
287 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
289 GLUT_XLIB_IMPLEMENTATION=16 mjk's early GLUT 3.8
291 GLUT_XLIB_IMPLEMENTATION=17 mjk's GLUT 3.8 with glutStrokeWidthf and glutStrokeLengthf
293 #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
294 #define GLUT_XLIB_IMPLEMENTATION 17
297 /* Display mode bit masks. */
299 #define GLUT_RGBA GLUT_RGB
301 #define GLUT_SINGLE 0
302 #define GLUT_DOUBLE 2
305 #define GLUT_DEPTH 16
306 #define GLUT_STENCIL 32
307 #if (GLUT_API_VERSION >= 2)
308 #define GLUT_MULTISAMPLE 128
309 #define GLUT_STEREO 256
311 #if (GLUT_API_VERSION >= 3)
312 #define GLUT_LUMINANCE 512
316 #define GLUT_LEFT_BUTTON 0
317 #define GLUT_MIDDLE_BUTTON 1
318 #define GLUT_RIGHT_BUTTON 2
320 /* Mouse button state. */
324 #if (GLUT_API_VERSION >= 2)
326 #define GLUT_KEY_F1 1
327 #define GLUT_KEY_F2 2
328 #define GLUT_KEY_F3 3
329 #define GLUT_KEY_F4 4
330 #define GLUT_KEY_F5 5
331 #define GLUT_KEY_F6 6
332 #define GLUT_KEY_F7 7
333 #define GLUT_KEY_F8 8
334 #define GLUT_KEY_F9 9
335 #define GLUT_KEY_F10 10
336 #define GLUT_KEY_F11 11
337 #define GLUT_KEY_F12 12
338 /* directional keys */
339 #define GLUT_KEY_LEFT 100
340 #define GLUT_KEY_UP 101
341 #define GLUT_KEY_RIGHT 102
342 #define GLUT_KEY_DOWN 103
343 #define GLUT_KEY_PAGE_UP 104
344 #define GLUT_KEY_PAGE_DOWN 105
345 #define GLUT_KEY_HOME 106
346 #define GLUT_KEY_END 107
347 #define GLUT_KEY_INSERT 108
350 /* Entry/exit state. */
352 #define GLUT_ENTERED 1
354 /* Menu usage state. */
355 #define GLUT_MENU_NOT_IN_USE 0
356 #define GLUT_MENU_IN_USE 1
358 /* Visibility state. */
359 #define GLUT_NOT_VISIBLE 0
360 #define GLUT_VISIBLE 1
362 /* Window status state. */
363 #define GLUT_HIDDEN 0
364 #define GLUT_FULLY_RETAINED 1
365 #define GLUT_PARTIALLY_RETAINED 2
366 #define GLUT_FULLY_COVERED 3
368 /* Color index component selection values. */
374 /* Stroke font constants (use these in GLUT program). */
375 #define GLUT_STROKE_ROMAN ((void*)0)
376 #define GLUT_STROKE_MONO_ROMAN ((void*)1)
378 /* Bitmap font constants (use these in GLUT program). */
379 #define GLUT_BITMAP_9_BY_15 ((void*)2)
380 #define GLUT_BITMAP_8_BY_13 ((void*)3)
381 #define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
382 #define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
383 #if (GLUT_API_VERSION >= 3)
384 #define GLUT_BITMAP_HELVETICA_10 ((void*)6)
385 #define GLUT_BITMAP_HELVETICA_12 ((void*)7)
386 #define GLUT_BITMAP_HELVETICA_18 ((void*)8)
389 /* Stroke font opaque addresses (use constants instead in source code). */
390 GLUTAPI void *glutStrokeRoman;
391 GLUTAPI void *glutStrokeMonoRoman;
393 /* Stroke font constants (use these in GLUT program). */
394 #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
395 #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
397 /* Bitmap font opaque addresses (use constants instead in source code). */
398 GLUTAPI void *glutBitmap9By15;
399 GLUTAPI void *glutBitmap8By13;
400 GLUTAPI void *glutBitmapTimesRoman10;
401 GLUTAPI void *glutBitmapTimesRoman24;
402 GLUTAPI void *glutBitmapHelvetica10;
403 GLUTAPI void *glutBitmapHelvetica12;
404 GLUTAPI void *glutBitmapHelvetica18;
406 /* Bitmap font constants (use these in GLUT program). */
407 #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
408 #define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
409 #define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
410 #define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
411 #if (GLUT_API_VERSION >= 3)
412 #define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
413 #define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
414 #define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
418 /* glutGet parameters. */
419 #define GLUT_WINDOW_X ((GLenum) 100)
420 #define GLUT_WINDOW_Y ((GLenum) 101)
421 #define GLUT_WINDOW_WIDTH ((GLenum) 102)
422 #define GLUT_WINDOW_HEIGHT ((GLenum) 103)
423 #define GLUT_WINDOW_BUFFER_SIZE ((GLenum) 104)
424 #define GLUT_WINDOW_STENCIL_SIZE ((GLenum) 105)
425 #define GLUT_WINDOW_DEPTH_SIZE ((GLenum) 106)
426 #define GLUT_WINDOW_RED_SIZE ((GLenum) 107)
427 #define GLUT_WINDOW_GREEN_SIZE ((GLenum) 108)
428 #define GLUT_WINDOW_BLUE_SIZE ((GLenum) 109)
429 #define GLUT_WINDOW_ALPHA_SIZE ((GLenum) 110)
430 #define GLUT_WINDOW_ACCUM_RED_SIZE ((GLenum) 111)
431 #define GLUT_WINDOW_ACCUM_GREEN_SIZE ((GLenum) 112)
432 #define GLUT_WINDOW_ACCUM_BLUE_SIZE ((GLenum) 113)
433 #define GLUT_WINDOW_ACCUM_ALPHA_SIZE ((GLenum) 114)
434 #define GLUT_WINDOW_DOUBLEBUFFER ((GLenum) 115)
435 #define GLUT_WINDOW_RGBA ((GLenum) 116)
436 #define GLUT_WINDOW_PARENT ((GLenum) 117)
437 #define GLUT_WINDOW_NUM_CHILDREN ((GLenum) 118)
438 #define GLUT_WINDOW_COLORMAP_SIZE ((GLenum) 119)
439 #if (GLUT_API_VERSION >= 2)
440 #define GLUT_WINDOW_NUM_SAMPLES ((GLenum) 120)
441 #define GLUT_WINDOW_STEREO ((GLenum) 121)
443 #if (GLUT_API_VERSION >= 3)
444 #define GLUT_WINDOW_CURSOR ((GLenum) 122)
446 #define GLUT_SCREEN_WIDTH ((GLenum) 200)
447 #define GLUT_SCREEN_HEIGHT ((GLenum) 201)
448 #define GLUT_SCREEN_WIDTH_MM ((GLenum) 202)
449 #define GLUT_SCREEN_HEIGHT_MM ((GLenum) 203)
450 #define GLUT_MENU_NUM_ITEMS ((GLenum) 300)
451 #define GLUT_DISPLAY_MODE_POSSIBLE ((GLenum) 400)
452 #define GLUT_INIT_WINDOW_X ((GLenum) 500)
453 #define GLUT_INIT_WINDOW_Y ((GLenum) 501)
454 #define GLUT_INIT_WINDOW_WIDTH ((GLenum) 502)
455 #define GLUT_INIT_WINDOW_HEIGHT ((GLenum) 503)
456 #define GLUT_INIT_DISPLAY_MODE ((GLenum) 504)
457 #if (GLUT_API_VERSION >= 2)
458 #define GLUT_ELAPSED_TIME ((GLenum) 700)
460 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
461 #define GLUT_WINDOW_FORMAT_ID ((GLenum) 123)
464 #if (GLUT_API_VERSION >= 2)
465 /* glutDeviceGet parameters. */
466 #define GLUT_HAS_KEYBOARD ((GLenum) 600)
467 #define GLUT_HAS_MOUSE ((GLenum) 601)
468 #define GLUT_HAS_SPACEBALL ((GLenum) 602)
469 #define GLUT_HAS_DIAL_AND_BUTTON_BOX ((GLenum) 603)
470 #define GLUT_HAS_TABLET ((GLenum) 604)
471 #define GLUT_NUM_MOUSE_BUTTONS ((GLenum) 605)
472 #define GLUT_NUM_SPACEBALL_BUTTONS ((GLenum) 606)
473 #define GLUT_NUM_BUTTON_BOX_BUTTONS ((GLenum) 607)
474 #define GLUT_NUM_DIALS ((GLenum) 608)
475 #define GLUT_NUM_TABLET_BUTTONS ((GLenum) 609)
477 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
478 #define GLUT_DEVICE_IGNORE_KEY_REPEAT ((GLenum) 610)
479 #define GLUT_DEVICE_KEY_REPEAT ((GLenum) 611)
480 #define GLUT_HAS_JOYSTICK ((GLenum) 612)
481 #define GLUT_OWNS_JOYSTICK ((GLenum) 613)
482 #define GLUT_JOYSTICK_BUTTONS ((GLenum) 614)
483 #define GLUT_JOYSTICK_AXES ((GLenum) 615)
484 #define GLUT_JOYSTICK_POLL_RATE ((GLenum) 616)
487 #if (GLUT_API_VERSION >= 3)
488 /* glutLayerGet parameters. */
489 #define GLUT_OVERLAY_POSSIBLE ((GLenum) 800)
490 #define GLUT_LAYER_IN_USE ((GLenum) 801)
491 #define GLUT_HAS_OVERLAY ((GLenum) 802)
492 #define GLUT_TRANSPARENT_INDEX ((GLenum) 803)
493 #define GLUT_NORMAL_DAMAGED ((GLenum) 804)
494 #define GLUT_OVERLAY_DAMAGED ((GLenum) 805)
496 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
497 /* glutVideoResizeGet parameters. */
498 #define GLUT_VIDEO_RESIZE_POSSIBLE ((GLenum) 900)
499 #define GLUT_VIDEO_RESIZE_IN_USE ((GLenum) 901)
500 #define GLUT_VIDEO_RESIZE_X_DELTA ((GLenum) 902)
501 #define GLUT_VIDEO_RESIZE_Y_DELTA ((GLenum) 903)
502 #define GLUT_VIDEO_RESIZE_WIDTH_DELTA ((GLenum) 904)
503 #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA ((GLenum) 905)
504 #define GLUT_VIDEO_RESIZE_X ((GLenum) 906)
505 #define GLUT_VIDEO_RESIZE_Y ((GLenum) 907)
506 #define GLUT_VIDEO_RESIZE_WIDTH ((GLenum) 908)
507 #define GLUT_VIDEO_RESIZE_HEIGHT ((GLenum) 909)
510 /* glutUseLayer parameters. */
511 #define GLUT_NORMAL ((GLenum) 0)
512 #define GLUT_OVERLAY ((GLenum) 1)
514 /* glutGetModifiers return mask. */
515 #define GLUT_ACTIVE_SHIFT 1
516 #define GLUT_ACTIVE_CTRL 2
517 #define GLUT_ACTIVE_ALT 4
519 /* glutSetCursor parameters. */
521 #define GLUT_CURSOR_RIGHT_ARROW 0
522 #define GLUT_CURSOR_LEFT_ARROW 1
523 /* Symbolic cursor shapes. */
524 #define GLUT_CURSOR_INFO 2
525 #define GLUT_CURSOR_DESTROY 3
526 #define GLUT_CURSOR_HELP 4
527 #define GLUT_CURSOR_CYCLE 5
528 #define GLUT_CURSOR_SPRAY 6
529 #define GLUT_CURSOR_WAIT 7
530 #define GLUT_CURSOR_TEXT 8
531 #define GLUT_CURSOR_CROSSHAIR 9
532 /* Directional cursors. */
533 #define GLUT_CURSOR_UP_DOWN 10
534 #define GLUT_CURSOR_LEFT_RIGHT 11
535 /* Sizing cursors. */
536 #define GLUT_CURSOR_TOP_SIDE 12
537 #define GLUT_CURSOR_BOTTOM_SIDE 13
538 #define GLUT_CURSOR_LEFT_SIDE 14
539 #define GLUT_CURSOR_RIGHT_SIDE 15
540 #define GLUT_CURSOR_TOP_LEFT_CORNER 16
541 #define GLUT_CURSOR_TOP_RIGHT_CORNER 17
542 #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
543 #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
544 /* Inherit from parent window. */
545 #define GLUT_CURSOR_INHERIT 100
547 #define GLUT_CURSOR_NONE 101
548 /* Fullscreen crosshair (if available). */
549 #define GLUT_CURSOR_FULL_CROSSHAIR 102
552 /* GLUT initialization sub-API. */
553 GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
554 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
555 GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
556 #ifndef GLUT_BUILDING_LIB
557 static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
558 #define glutInit glutInit_ATEXIT_HACK
561 GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
562 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
563 GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
565 GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
566 GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
567 GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
569 /* GLUT window sub-API. */
570 GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
571 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
572 GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
573 #ifndef GLUT_BUILDING_LIB
574 static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
575 #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
578 GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
579 GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
580 GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
581 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
582 GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
584 GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
585 GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
586 GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
587 GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
588 GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
589 GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
590 GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
591 GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
592 GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
593 GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
594 GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
595 GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
596 #if (GLUT_API_VERSION >= 3)
597 GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
598 GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
599 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
600 GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
603 /* GLUT overlay sub-API. */
604 GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
605 GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
606 GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
607 GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
608 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
609 GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
611 GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
612 GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
615 /* GLUT menu sub-API. */
616 GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
617 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
618 GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
619 #ifndef GLUT_BUILDING_LIB
620 static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
621 #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
624 GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
625 GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
626 GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
627 GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
628 GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
629 GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
630 GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
631 GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
632 GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
633 GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
635 /* GLUT window callback sub-API. */
636 GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
637 GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
638 GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
639 GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
640 GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
641 GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
642 GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
643 GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
644 GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
645 GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
646 GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
647 #if (GLUT_API_VERSION >= 2)
648 GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
649 GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
650 GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
651 GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
652 GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
653 GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
654 GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
655 GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
656 #if (GLUT_API_VERSION >= 3)
657 GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
658 GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
659 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
660 GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
662 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
663 GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
664 GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
665 GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
670 /* GLUT color index sub-API. */
671 GLUTAPI void GLUTAPIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
672 GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
673 GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
675 /* GLUT state retrieval sub-API. */
676 GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
677 GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
678 #if (GLUT_API_VERSION >= 2)
679 /* GLUT extension support sub-API */
680 GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
682 #if (GLUT_API_VERSION >= 3)
683 GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
684 GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
687 /* GLUT font sub-API */
688 GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
689 GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
690 GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
691 GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
692 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
693 GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
694 GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
696 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 17)
697 GLUTAPI float GLUTAPIENTRY glutStrokeWidthf(void *font, int character);
698 GLUTAPI float GLUTAPIENTRY glutStrokeLengthf(void *font, const unsigned char *string);
701 /* GLUT pre-built models sub-API */
702 GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
703 GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
704 GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
705 GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
706 GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
707 GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
708 GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
709 GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
710 GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
711 GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
712 GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
713 GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
714 GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
715 GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
716 GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
717 GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
718 GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
719 GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
721 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
722 /* GLUT video resize sub-API. */
723 GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
724 GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
725 GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
726 GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
727 GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
729 /* GLUT debugging sub-API. */
730 GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
733 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
734 /* GLUT device control sub-API. */
735 /* glutSetKeyRepeat modes. */
736 #define GLUT_KEY_REPEAT_OFF 0
737 #define GLUT_KEY_REPEAT_ON 1
738 #define GLUT_KEY_REPEAT_DEFAULT 2
740 /* Joystick button masks. */
741 #define GLUT_JOYSTICK_BUTTON_A 1
742 #define GLUT_JOYSTICK_BUTTON_B 2
743 #define GLUT_JOYSTICK_BUTTON_C 4
744 #define GLUT_JOYSTICK_BUTTON_D 8
746 GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
747 GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
748 GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
750 /* GLUT game mode sub-API. */
751 /* glutGameModeGet. */
752 #define GLUT_GAME_MODE_ACTIVE ((GLenum) 0)
753 #define GLUT_GAME_MODE_POSSIBLE ((GLenum) 1)
754 #define GLUT_GAME_MODE_WIDTH ((GLenum) 2)
755 #define GLUT_GAME_MODE_HEIGHT ((GLenum) 3)
756 #define GLUT_GAME_MODE_PIXEL_DEPTH ((GLenum) 4)
757 #define GLUT_GAME_MODE_REFRESH_RATE ((GLenum) 5)
758 #define GLUT_GAME_MODE_DISPLAY_CHANGED ((GLenum) 6)
760 GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
761 GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
762 GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
763 GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
771 #ifdef GLUT_APIENTRY_DEFINED
772 # undef GLUT_APIENTRY_DEFINED
776 #ifdef GLUT_WINGDIAPI_DEFINED
777 # undef GLUT_WINGDIAPI_DEFINED
781 #ifdef GLUT_DEFINED___CDECL
782 # undef GLUT_DEFINED___CDECL
786 #ifdef GLUT_DEFINED__CRTIMP
787 # undef GLUT_DEFINED__CRTIMP
791 #endif /* __glut_h__ */