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