4 /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
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. */
13 #if defined(__MINGW32__)
14 #include <GL/mesa_wgl.h>
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.
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.
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. */
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 */
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 */
53 /* To disable supression of annoying warnings about floats being promoted
54 to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
56 # if defined(_MSC_VER) && !defined(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. */
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).
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
78 Note that the __glut*WithExit routines should NEVER be called directly.
79 To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
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. */
85 # define GLUT_DEFINED___CDECL
89 /* Definition compatible with NT SDK */
92 /* Current definition */
94 # define _CRTIMP __declspec(dllimport)
99 # define GLUT_DEFINED__CRTIMP
101 # ifndef GLUT_BUILDING_LIB
102 extern _CRTIMP
void __cdecl
exit(int);
105 /* GLUT callback calling convention for Win32. */
106 # define GLUTCALLBACK __cdecl
108 /* for callback/function pointer defs */
109 # define GLUTAPIENTRYV __cdecl
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 */
115 #if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
116 # define GLUTAPIENTRY __stdcall
118 # define GLUTAPIENTRY
121 /* GLUT API entry point declarations for Win32. */
122 #if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
123 # define GLUTAPI __declspec(dllexport)
125 # define GLUTAPI __declspec(dllimport)
127 # define GLUTAPI extern
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" )
136 # define CALLBACK __stdcall
138 #if !defined(__MINGW32__)
139 typedef int (GLUTAPIENTRY
*PROC
)();
143 typedef unsigned long COLORREF
;
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" )
152 # define WGL_FONT_LINES 0
153 # define WGL_FONT_POLYGONS 1
155 # define wglUseFontBitmaps wglUseFontBitmapsW
156 # define wglUseFontOutlines wglUseFontOutlinesW
158 # define wglUseFontBitmaps wglUseFontBitmapsA
159 # define wglUseFontOutlines wglUseFontOutlinesA
160 # endif /* !UNICODE */
161 typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR
, *PLAYERPLANEDESCRIPTOR
, *LPLAYERPLANEDESCRIPTOR
;
162 typedef 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)
166 WGLAPI
int GLAPIENTRY
wglDeleteContext(HGLRC
);
167 WGLAPI
int GLAPIENTRY
wglMakeCurrent(HDC
,HGLRC
);
168 WGLAPI
int GLAPIENTRY
wglSetPixelFormat(HDC
, int, const PIXELFORMATDESCRIPTOR
*);
169 WGLAPI
int GLAPIENTRY
wglSwapBuffers(HDC hdc
);
170 WGLAPI HDC GLAPIENTRY
wglGetCurrentDC(void);
171 WGLAPI HGLRC GLAPIENTRY
wglCreateContext(HDC
);
172 WGLAPI HGLRC GLAPIENTRY
wglCreateLayerContext(HDC
,int);
173 WGLAPI HGLRC GLAPIENTRY
wglGetCurrentContext(void);
174 WGLAPI PROC GLAPIENTRY
wglGetProcAddress(const char*);
175 WGLAPI
int GLAPIENTRY
wglChoosePixelFormat(HDC
, const PIXELFORMATDESCRIPTOR
*);
176 WGLAPI
int GLAPIENTRY
wglCopyContext(HGLRC
, HGLRC
, unsigned int);
177 WGLAPI
int GLAPIENTRY
wglDeleteContext(HGLRC
);
178 WGLAPI
int GLAPIENTRY
wglDescribeLayerPlane(HDC
, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR
);
179 WGLAPI
int GLAPIENTRY
wglDescribePixelFormat(HDC
,int, unsigned int, LPPIXELFORMATDESCRIPTOR
);
180 WGLAPI
int GLAPIENTRY
wglGetLayerPaletteEntries(HDC
, int, int, int,COLORREF
*);
181 WGLAPI
int GLAPIENTRY
wglGetPixelFormat(HDC hdc
);
182 WGLAPI
int GLAPIENTRY
wglMakeCurrent(HDC
, HGLRC
);
183 WGLAPI
int GLAPIENTRY
wglRealizeLayerPalette(HDC
, int, int);
184 WGLAPI
int GLAPIENTRY
wglSetLayerPaletteEntries(HDC
, int, int, int,const COLORREF
*);
185 WGLAPI
int GLAPIENTRY
wglShareLists(HGLRC
, HGLRC
);
186 WGLAPI
int GLAPIENTRY
wglSwapLayerBuffers(HDC
, unsigned int);
187 WGLAPI
int GLAPIENTRY
wglUseFontBitmapsA(HDC
, unsigned long, unsigned long, unsigned long);
188 WGLAPI
int GLAPIENTRY
wglUseFontBitmapsW(HDC
, unsigned long, unsigned long, unsigned long);
189 WGLAPI
int GLAPIENTRY
wglUseFontOutlinesA(HDC
, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT
);
190 WGLAPI
int GLAPIENTRY
wglUseFontOutlinesW(HDC
, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT
);
191 WGLAPI
int GLAPIENTRY
SwapBuffers(HDC
);
192 WGLAPI
int GLAPIENTRY
ChoosePixelFormat(HDC
,const PIXELFORMATDESCRIPTOR
*);
193 WGLAPI
int GLAPIENTRY
DescribePixelFormat(HDC
,int,unsigned int,LPPIXELFORMATDESCRIPTOR
);
194 WGLAPI
int GLAPIENTRY
GetPixelFormat(HDC
);
195 WGLAPI
int GLAPIENTRY
SetPixelFormat(HDC
,int,const PIXELFORMATDESCRIPTOR
*);
197 # pragma warning( pop )
200 #else /* _WIN32 not defined */
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
212 GLUT API revision history:
214 GLUT_API_VERSION is updated to reflect incompatible GLUT
215 API changes (interface changes, semantic changes, deletions,
218 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
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.
224 GLUT_API_VERSION=3 glutMenuStatus added.
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!).
232 GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP)
234 #ifndef GLUT_API_VERSION /* allow this to be overriden */
235 #define GLUT_API_VERSION 5
239 GLUT implementation revision history:
241 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
242 API revisions and implementation revisions (ie, bug fixes).
244 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
245 GLUT Xlib-based implementation. 11/29/94
247 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
248 GLUT Xlib-based implementation providing GLUT version 2
251 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
253 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
255 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
257 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
259 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
260 and video resize. 1/3/97
262 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
264 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
266 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
268 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
270 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
272 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
274 #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
275 #define GLUT_XLIB_IMPLEMENTATION 15
278 /* Display mode bit masks. */
280 #define GLUT_RGBA GLUT_RGB
282 #define GLUT_SINGLE 0
283 #define GLUT_DOUBLE 2
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
292 #if (GLUT_API_VERSION >= 3)
293 #define GLUT_LUMINANCE 512
297 #define GLUT_LEFT_BUTTON 0
298 #define GLUT_MIDDLE_BUTTON 1
299 #define GLUT_RIGHT_BUTTON 2
301 /* Mouse button state. */
305 #if (GLUT_API_VERSION >= 2)
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
331 /* Entry/exit state. */
333 #define GLUT_ENTERED 1
335 /* Menu usage state. */
336 #define GLUT_MENU_NOT_IN_USE 0
337 #define GLUT_MENU_IN_USE 1
339 /* Visibility state. */
340 #define GLUT_NOT_VISIBLE 0
341 #define GLUT_VISIBLE 1
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
349 /* Color index component selection values. */
354 /* Layers for use. */
355 #define GLUT_NORMAL 0
356 #define GLUT_OVERLAY 1
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)
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)
374 /* Stroke font opaque addresses (use constants instead in source code). */
375 GLUTAPI
void *glutStrokeRoman
;
376 GLUTAPI
void *glutStrokeMonoRoman
;
378 /* Stroke font constants (use these in GLUT program). */
379 #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
380 #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
382 /* Bitmap font opaque addresses (use constants instead in source code). */
383 GLUTAPI
void *glutBitmap9By15
;
384 GLUTAPI
void *glutBitmap8By13
;
385 GLUTAPI
void *glutBitmapTimesRoman10
;
386 GLUTAPI
void *glutBitmapTimesRoman24
;
387 GLUTAPI
void *glutBitmapHelvetica10
;
388 GLUTAPI
void *glutBitmapHelvetica12
;
389 GLUTAPI
void *glutBitmapHelvetica18
;
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)
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
428 #if (GLUT_API_VERSION >= 3)
429 #define GLUT_WINDOW_CURSOR 122
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
445 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
446 #define GLUT_WINDOW_FORMAT_ID 123
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
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
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
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
495 /* glutUseLayer parameters. */
496 #define GLUT_NORMAL 0
497 #define GLUT_OVERLAY 1
499 /* glutGetModifiers return mask. */
500 #define GLUT_ACTIVE_SHIFT 1
501 #define GLUT_ACTIVE_CTRL 2
502 #define GLUT_ACTIVE_ALT 4
504 /* glutSetCursor parameters. */
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
532 #define GLUT_CURSOR_NONE 101
533 /* Fullscreen crosshair (if available). */
534 #define GLUT_CURSOR_FULL_CROSSHAIR 102
537 /* GLUT initialization sub-API. */
538 GLUTAPI
void GLUTAPIENTRY
glutInit(int *argcp
, char **argv
);
539 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
540 GLUTAPI
void GLUTAPIENTRY
__glutInitWithExit(int *argcp
, char **argv
, void (__cdecl
*exitfunc
)(int));
541 #ifndef GLUT_BUILDING_LIB
542 static void GLUTAPIENTRY
glutInit_ATEXIT_HACK(int *argcp
, char **argv
) { __glutInitWithExit(argcp
, argv
, exit
); }
543 #define glutInit glutInit_ATEXIT_HACK
546 GLUTAPI
void GLUTAPIENTRY
glutInitDisplayMode(unsigned int mode
);
547 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
548 GLUTAPI
void GLUTAPIENTRY
glutInitDisplayString(const char *string
);
550 GLUTAPI
void GLUTAPIENTRY
glutInitWindowPosition(int x
, int y
);
551 GLUTAPI
void GLUTAPIENTRY
glutInitWindowSize(int width
, int height
);
552 GLUTAPI
void GLUTAPIENTRY
glutMainLoop(void);
554 /* GLUT window sub-API. */
555 GLUTAPI
int GLUTAPIENTRY
glutCreateWindow(const char *title
);
556 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
557 GLUTAPI
int GLUTAPIENTRY
__glutCreateWindowWithExit(const char *title
, void (__cdecl
*exitfunc
)(int));
558 #ifndef GLUT_BUILDING_LIB
559 static int GLUTAPIENTRY
glutCreateWindow_ATEXIT_HACK(const char *title
) { return __glutCreateWindowWithExit(title
, exit
); }
560 #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
563 GLUTAPI
int GLUTAPIENTRY
glutCreateSubWindow(int win
, int x
, int y
, int width
, int height
);
564 GLUTAPI
void GLUTAPIENTRY
glutDestroyWindow(int win
);
565 GLUTAPI
void GLUTAPIENTRY
glutPostRedisplay(void);
566 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
567 GLUTAPI
void GLUTAPIENTRY
glutPostWindowRedisplay(int win
);
569 GLUTAPI
void GLUTAPIENTRY
glutSwapBuffers(void);
570 GLUTAPI
int GLUTAPIENTRY
glutGetWindow(void);
571 GLUTAPI
void GLUTAPIENTRY
glutSetWindow(int win
);
572 GLUTAPI
void GLUTAPIENTRY
glutSetWindowTitle(const char *title
);
573 GLUTAPI
void GLUTAPIENTRY
glutSetIconTitle(const char *title
);
574 GLUTAPI
void GLUTAPIENTRY
glutPositionWindow(int x
, int y
);
575 GLUTAPI
void GLUTAPIENTRY
glutReshapeWindow(int width
, int height
);
576 GLUTAPI
void GLUTAPIENTRY
glutPopWindow(void);
577 GLUTAPI
void GLUTAPIENTRY
glutPushWindow(void);
578 GLUTAPI
void GLUTAPIENTRY
glutIconifyWindow(void);
579 GLUTAPI
void GLUTAPIENTRY
glutShowWindow(void);
580 GLUTAPI
void GLUTAPIENTRY
glutHideWindow(void);
581 #if (GLUT_API_VERSION >= 3)
582 GLUTAPI
void GLUTAPIENTRY
glutFullScreen(void);
583 GLUTAPI
void GLUTAPIENTRY
glutSetCursor(int cursor
);
584 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
585 GLUTAPI
void GLUTAPIENTRY
glutWarpPointer(int x
, int y
);
588 /* GLUT overlay sub-API. */
589 GLUTAPI
void GLUTAPIENTRY
glutEstablishOverlay(void);
590 GLUTAPI
void GLUTAPIENTRY
glutRemoveOverlay(void);
591 GLUTAPI
void GLUTAPIENTRY
glutUseLayer(GLenum layer
);
592 GLUTAPI
void GLUTAPIENTRY
glutPostOverlayRedisplay(void);
593 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
594 GLUTAPI
void GLUTAPIENTRY
glutPostWindowOverlayRedisplay(int win
);
596 GLUTAPI
void GLUTAPIENTRY
glutShowOverlay(void);
597 GLUTAPI
void GLUTAPIENTRY
glutHideOverlay(void);
600 /* GLUT menu sub-API. */
601 GLUTAPI
int GLUTAPIENTRY
glutCreateMenu(void (GLUTCALLBACK
*func
)(int));
602 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
603 GLUTAPI
int GLUTAPIENTRY
__glutCreateMenuWithExit(void (GLUTCALLBACK
*func
)(int), void (__cdecl
*exitfunc
)(int));
604 #ifndef GLUT_BUILDING_LIB
605 static int GLUTAPIENTRY
glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK
*func
)(int)) { return __glutCreateMenuWithExit(func
, exit
); }
606 #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
609 GLUTAPI
void GLUTAPIENTRY
glutDestroyMenu(int menu
);
610 GLUTAPI
int GLUTAPIENTRY
glutGetMenu(void);
611 GLUTAPI
void GLUTAPIENTRY
glutSetMenu(int menu
);
612 GLUTAPI
void GLUTAPIENTRY
glutAddMenuEntry(const char *label
, int value
);
613 GLUTAPI
void GLUTAPIENTRY
glutAddSubMenu(const char *label
, int submenu
);
614 GLUTAPI
void GLUTAPIENTRY
glutChangeToMenuEntry(int item
, const char *label
, int value
);
615 GLUTAPI
void GLUTAPIENTRY
glutChangeToSubMenu(int item
, const char *label
, int submenu
);
616 GLUTAPI
void GLUTAPIENTRY
glutRemoveMenuItem(int item
);
617 GLUTAPI
void GLUTAPIENTRY
glutAttachMenu(int button
);
618 GLUTAPI
void GLUTAPIENTRY
glutDetachMenu(int button
);
620 /* GLUT window callback sub-API. */
621 GLUTAPI
void GLUTAPIENTRY
glutDisplayFunc(void (GLUTCALLBACK
*func
)(void));
622 GLUTAPI
void GLUTAPIENTRY
glutReshapeFunc(void (GLUTCALLBACK
*func
)(int width
, int height
));
623 GLUTAPI
void GLUTAPIENTRY
glutKeyboardFunc(void (GLUTCALLBACK
*func
)(unsigned char key
, int x
, int y
));
624 GLUTAPI
void GLUTAPIENTRY
glutMouseFunc(void (GLUTCALLBACK
*func
)(int button
, int state
, int x
, int y
));
625 GLUTAPI
void GLUTAPIENTRY
glutMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
));
626 GLUTAPI
void GLUTAPIENTRY
glutPassiveMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
));
627 GLUTAPI
void GLUTAPIENTRY
glutEntryFunc(void (GLUTCALLBACK
*func
)(int state
));
628 GLUTAPI
void GLUTAPIENTRY
glutVisibilityFunc(void (GLUTCALLBACK
*func
)(int state
));
629 GLUTAPI
void GLUTAPIENTRY
glutIdleFunc(void (GLUTCALLBACK
*func
)(void));
630 GLUTAPI
void GLUTAPIENTRY
glutTimerFunc(unsigned int millis
, void (GLUTCALLBACK
*func
)(int value
), int value
);
631 GLUTAPI
void GLUTAPIENTRY
glutMenuStateFunc(void (GLUTCALLBACK
*func
)(int state
));
632 #if (GLUT_API_VERSION >= 2)
633 GLUTAPI
void GLUTAPIENTRY
glutSpecialFunc(void (GLUTCALLBACK
*func
)(int key
, int x
, int y
));
634 GLUTAPI
void GLUTAPIENTRY
glutSpaceballMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
, int z
));
635 GLUTAPI
void GLUTAPIENTRY
glutSpaceballRotateFunc(void (GLUTCALLBACK
*func
)(int x
, int y
, int z
));
636 GLUTAPI
void GLUTAPIENTRY
glutSpaceballButtonFunc(void (GLUTCALLBACK
*func
)(int button
, int state
));
637 GLUTAPI
void GLUTAPIENTRY
glutButtonBoxFunc(void (GLUTCALLBACK
*func
)(int button
, int state
));
638 GLUTAPI
void GLUTAPIENTRY
glutDialsFunc(void (GLUTCALLBACK
*func
)(int dial
, int value
));
639 GLUTAPI
void GLUTAPIENTRY
glutTabletMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
));
640 GLUTAPI
void GLUTAPIENTRY
glutTabletButtonFunc(void (GLUTCALLBACK
*func
)(int button
, int state
, int x
, int y
));
641 #if (GLUT_API_VERSION >= 3)
642 GLUTAPI
void GLUTAPIENTRY
glutMenuStatusFunc(void (GLUTCALLBACK
*func
)(int status
, int x
, int y
));
643 GLUTAPI
void GLUTAPIENTRY
glutOverlayDisplayFunc(void (GLUTCALLBACK
*func
)(void));
644 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
645 GLUTAPI
void GLUTAPIENTRY
glutWindowStatusFunc(void (GLUTCALLBACK
*func
)(int state
));
647 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
648 GLUTAPI
void GLUTAPIENTRY
glutKeyboardUpFunc(void (GLUTCALLBACK
*func
)(unsigned char key
, int x
, int y
));
649 GLUTAPI
void GLUTAPIENTRY
glutSpecialUpFunc(void (GLUTCALLBACK
*func
)(int key
, int x
, int y
));
650 GLUTAPI
void GLUTAPIENTRY
glutJoystickFunc(void (GLUTCALLBACK
*func
)(unsigned int buttonMask
, int x
, int y
, int z
), int pollInterval
);
655 /* GLUT color index sub-API. */
656 GLUTAPI
void GLUTAPIENTRY
glutSetColor(int ndx
, GLfloat red
, GLfloat green
, GLfloat blue
);
657 GLUTAPI GLfloat GLUTAPIENTRY
glutGetColor(int ndx
, int component
);
658 GLUTAPI
void GLUTAPIENTRY
glutCopyColormap(int win
);
660 /* GLUT state retrieval sub-API. */
661 GLUTAPI
int GLUTAPIENTRY
glutGet(GLenum type
);
662 GLUTAPI
int GLUTAPIENTRY
glutDeviceGet(GLenum type
);
663 #if (GLUT_API_VERSION >= 2)
664 /* GLUT extension support sub-API */
665 GLUTAPI
int GLUTAPIENTRY
glutExtensionSupported(const char *name
);
667 #if (GLUT_API_VERSION >= 3)
668 GLUTAPI
int GLUTAPIENTRY
glutGetModifiers(void);
669 GLUTAPI
int GLUTAPIENTRY
glutLayerGet(GLenum type
);
671 #if (GLUT_API_VERSION >= 5)
672 typedef void (*GLUTproc
)();
673 GLUTAPI GLUTproc GLUTAPIENTRY
glutGetProcAddress(const char *procName
);
676 /* GLUT font sub-API */
677 GLUTAPI
void GLUTAPIENTRY
glutBitmapCharacter(void *font
, int character
);
678 GLUTAPI
int GLUTAPIENTRY
glutBitmapWidth(void *font
, int character
);
679 GLUTAPI
void GLUTAPIENTRY
glutStrokeCharacter(void *font
, int character
);
680 GLUTAPI
int GLUTAPIENTRY
glutStrokeWidth(void *font
, int character
);
681 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
682 GLUTAPI
int GLUTAPIENTRY
glutBitmapLength(void *font
, const unsigned char *string
);
683 GLUTAPI
int GLUTAPIENTRY
glutStrokeLength(void *font
, const unsigned char *string
);
686 /* GLUT pre-built models sub-API */
687 GLUTAPI
void GLUTAPIENTRY
glutWireSphere(GLdouble radius
, GLint slices
, GLint stacks
);
688 GLUTAPI
void GLUTAPIENTRY
glutSolidSphere(GLdouble radius
, GLint slices
, GLint stacks
);
689 GLUTAPI
void GLUTAPIENTRY
glutWireCone(GLdouble base
, GLdouble height
, GLint slices
, GLint stacks
);
690 GLUTAPI
void GLUTAPIENTRY
glutSolidCone(GLdouble base
, GLdouble height
, GLint slices
, GLint stacks
);
691 GLUTAPI
void GLUTAPIENTRY
glutWireCube(GLdouble size
);
692 GLUTAPI
void GLUTAPIENTRY
glutSolidCube(GLdouble size
);
693 GLUTAPI
void GLUTAPIENTRY
glutWireTorus(GLdouble innerRadius
, GLdouble outerRadius
, GLint sides
, GLint rings
);
694 GLUTAPI
void GLUTAPIENTRY
glutSolidTorus(GLdouble innerRadius
, GLdouble outerRadius
, GLint sides
, GLint rings
);
695 GLUTAPI
void GLUTAPIENTRY
glutWireDodecahedron(void);
696 GLUTAPI
void GLUTAPIENTRY
glutSolidDodecahedron(void);
697 GLUTAPI
void GLUTAPIENTRY
glutWireTeapot(GLdouble size
);
698 GLUTAPI
void GLUTAPIENTRY
glutSolidTeapot(GLdouble size
);
699 GLUTAPI
void GLUTAPIENTRY
glutWireOctahedron(void);
700 GLUTAPI
void GLUTAPIENTRY
glutSolidOctahedron(void);
701 GLUTAPI
void GLUTAPIENTRY
glutWireTetrahedron(void);
702 GLUTAPI
void GLUTAPIENTRY
glutSolidTetrahedron(void);
703 GLUTAPI
void GLUTAPIENTRY
glutWireIcosahedron(void);
704 GLUTAPI
void GLUTAPIENTRY
glutSolidIcosahedron(void);
706 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
707 /* GLUT video resize sub-API. */
708 GLUTAPI
int GLUTAPIENTRY
glutVideoResizeGet(GLenum param
);
709 GLUTAPI
void GLUTAPIENTRY
glutSetupVideoResizing(void);
710 GLUTAPI
void GLUTAPIENTRY
glutStopVideoResizing(void);
711 GLUTAPI
void GLUTAPIENTRY
glutVideoResize(int x
, int y
, int width
, int height
);
712 GLUTAPI
void GLUTAPIENTRY
glutVideoPan(int x
, int y
, int width
, int height
);
714 /* GLUT debugging sub-API. */
715 GLUTAPI
void GLUTAPIENTRY
glutReportErrors(void);
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
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
731 GLUTAPI
void GLUTAPIENTRY
glutIgnoreKeyRepeat(int ignore
);
732 GLUTAPI
void GLUTAPIENTRY
glutSetKeyRepeat(int repeatMode
);
733 GLUTAPI
void GLUTAPIENTRY
glutForceJoystickFunc(void);
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
745 GLUTAPI
void GLUTAPIENTRY
glutGameModeString(const char *string
);
746 GLUTAPI
int GLUTAPIENTRY
glutEnterGameMode(void);
747 GLUTAPI
void GLUTAPIENTRY
glutLeaveGameMode(void);
748 GLUTAPI
int GLUTAPIENTRY
glutGameModeGet(GLenum mode
);
755 #endif /* __glut_h__ */