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 #ifndef GLUT_API_VERSION /* allow this to be overriden */
228 #define GLUT_API_VERSION 3
232 GLUT implementation revision history:
234 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
235 API revisions and implementation revisions (ie, bug fixes).
237 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
238 GLUT Xlib-based implementation. 11/29/94
240 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
241 GLUT Xlib-based implementation providing GLUT version 2
244 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
246 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
248 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
250 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
252 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
253 and video resize. 1/3/97
255 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
257 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
259 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
261 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
263 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
265 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
267 #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
268 #define GLUT_XLIB_IMPLEMENTATION 15
271 /* Display mode bit masks. */
273 #define GLUT_RGBA GLUT_RGB
275 #define GLUT_SINGLE 0
276 #define GLUT_DOUBLE 2
279 #define GLUT_DEPTH 16
280 #define GLUT_STENCIL 32
281 #if (GLUT_API_VERSION >= 2)
282 #define GLUT_MULTISAMPLE 128
283 #define GLUT_STEREO 256
285 #if (GLUT_API_VERSION >= 3)
286 #define GLUT_LUMINANCE 512
290 #define GLUT_LEFT_BUTTON 0
291 #define GLUT_MIDDLE_BUTTON 1
292 #define GLUT_RIGHT_BUTTON 2
294 /* Mouse button state. */
298 #if (GLUT_API_VERSION >= 2)
300 #define GLUT_KEY_F1 1
301 #define GLUT_KEY_F2 2
302 #define GLUT_KEY_F3 3
303 #define GLUT_KEY_F4 4
304 #define GLUT_KEY_F5 5
305 #define GLUT_KEY_F6 6
306 #define GLUT_KEY_F7 7
307 #define GLUT_KEY_F8 8
308 #define GLUT_KEY_F9 9
309 #define GLUT_KEY_F10 10
310 #define GLUT_KEY_F11 11
311 #define GLUT_KEY_F12 12
312 /* directional keys */
313 #define GLUT_KEY_LEFT 100
314 #define GLUT_KEY_UP 101
315 #define GLUT_KEY_RIGHT 102
316 #define GLUT_KEY_DOWN 103
317 #define GLUT_KEY_PAGE_UP 104
318 #define GLUT_KEY_PAGE_DOWN 105
319 #define GLUT_KEY_HOME 106
320 #define GLUT_KEY_END 107
321 #define GLUT_KEY_INSERT 108
324 /* Entry/exit state. */
326 #define GLUT_ENTERED 1
328 /* Menu usage state. */
329 #define GLUT_MENU_NOT_IN_USE 0
330 #define GLUT_MENU_IN_USE 1
332 /* Visibility state. */
333 #define GLUT_NOT_VISIBLE 0
334 #define GLUT_VISIBLE 1
336 /* Window status state. */
337 #define GLUT_HIDDEN 0
338 #define GLUT_FULLY_RETAINED 1
339 #define GLUT_PARTIALLY_RETAINED 2
340 #define GLUT_FULLY_COVERED 3
342 /* Color index component selection values. */
347 /* Layers for use. */
348 #define GLUT_NORMAL 0
349 #define GLUT_OVERLAY 1
352 /* Stroke font constants (use these in GLUT program). */
353 #define GLUT_STROKE_ROMAN ((void*)0)
354 #define GLUT_STROKE_MONO_ROMAN ((void*)1)
356 /* Bitmap font constants (use these in GLUT program). */
357 #define GLUT_BITMAP_9_BY_15 ((void*)2)
358 #define GLUT_BITMAP_8_BY_13 ((void*)3)
359 #define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
360 #define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
361 #if (GLUT_API_VERSION >= 3)
362 #define GLUT_BITMAP_HELVETICA_10 ((void*)6)
363 #define GLUT_BITMAP_HELVETICA_12 ((void*)7)
364 #define GLUT_BITMAP_HELVETICA_18 ((void*)8)
367 /* Stroke font opaque addresses (use constants instead in source code). */
368 GLUTAPI
void *glutStrokeRoman
;
369 GLUTAPI
void *glutStrokeMonoRoman
;
371 /* Stroke font constants (use these in GLUT program). */
372 #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
373 #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
375 /* Bitmap font opaque addresses (use constants instead in source code). */
376 GLUTAPI
void *glutBitmap9By15
;
377 GLUTAPI
void *glutBitmap8By13
;
378 GLUTAPI
void *glutBitmapTimesRoman10
;
379 GLUTAPI
void *glutBitmapTimesRoman24
;
380 GLUTAPI
void *glutBitmapHelvetica10
;
381 GLUTAPI
void *glutBitmapHelvetica12
;
382 GLUTAPI
void *glutBitmapHelvetica18
;
384 /* Bitmap font constants (use these in GLUT program). */
385 #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
386 #define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
387 #define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
388 #define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
389 #if (GLUT_API_VERSION >= 3)
390 #define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
391 #define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
392 #define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
396 /* glutGet parameters. */
397 #define GLUT_WINDOW_X 100
398 #define GLUT_WINDOW_Y 101
399 #define GLUT_WINDOW_WIDTH 102
400 #define GLUT_WINDOW_HEIGHT 103
401 #define GLUT_WINDOW_BUFFER_SIZE 104
402 #define GLUT_WINDOW_STENCIL_SIZE 105
403 #define GLUT_WINDOW_DEPTH_SIZE 106
404 #define GLUT_WINDOW_RED_SIZE 107
405 #define GLUT_WINDOW_GREEN_SIZE 108
406 #define GLUT_WINDOW_BLUE_SIZE 109
407 #define GLUT_WINDOW_ALPHA_SIZE 110
408 #define GLUT_WINDOW_ACCUM_RED_SIZE 111
409 #define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
410 #define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
411 #define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
412 #define GLUT_WINDOW_DOUBLEBUFFER 115
413 #define GLUT_WINDOW_RGBA 116
414 #define GLUT_WINDOW_PARENT 117
415 #define GLUT_WINDOW_NUM_CHILDREN 118
416 #define GLUT_WINDOW_COLORMAP_SIZE 119
417 #if (GLUT_API_VERSION >= 2)
418 #define GLUT_WINDOW_NUM_SAMPLES 120
419 #define GLUT_WINDOW_STEREO 121
421 #if (GLUT_API_VERSION >= 3)
422 #define GLUT_WINDOW_CURSOR 122
424 #define GLUT_SCREEN_WIDTH 200
425 #define GLUT_SCREEN_HEIGHT 201
426 #define GLUT_SCREEN_WIDTH_MM 202
427 #define GLUT_SCREEN_HEIGHT_MM 203
428 #define GLUT_MENU_NUM_ITEMS 300
429 #define GLUT_DISPLAY_MODE_POSSIBLE 400
430 #define GLUT_INIT_WINDOW_X 500
431 #define GLUT_INIT_WINDOW_Y 501
432 #define GLUT_INIT_WINDOW_WIDTH 502
433 #define GLUT_INIT_WINDOW_HEIGHT 503
434 #define GLUT_INIT_DISPLAY_MODE 504
435 #if (GLUT_API_VERSION >= 2)
436 #define GLUT_ELAPSED_TIME 700
438 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
439 #define GLUT_WINDOW_FORMAT_ID 123
442 #if (GLUT_API_VERSION >= 2)
443 /* glutDeviceGet parameters. */
444 #define GLUT_HAS_KEYBOARD 600
445 #define GLUT_HAS_MOUSE 601
446 #define GLUT_HAS_SPACEBALL 602
447 #define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
448 #define GLUT_HAS_TABLET 604
449 #define GLUT_NUM_MOUSE_BUTTONS 605
450 #define GLUT_NUM_SPACEBALL_BUTTONS 606
451 #define GLUT_NUM_BUTTON_BOX_BUTTONS 607
452 #define GLUT_NUM_DIALS 608
453 #define GLUT_NUM_TABLET_BUTTONS 609
455 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
456 #define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
457 #define GLUT_DEVICE_KEY_REPEAT 611
458 #define GLUT_HAS_JOYSTICK 612
459 #define GLUT_OWNS_JOYSTICK 613
460 #define GLUT_JOYSTICK_BUTTONS 614
461 #define GLUT_JOYSTICK_AXES 615
462 #define GLUT_JOYSTICK_POLL_RATE 616
465 #if (GLUT_API_VERSION >= 3)
466 /* glutLayerGet parameters. */
467 #define GLUT_OVERLAY_POSSIBLE 800
468 #define GLUT_LAYER_IN_USE 801
469 #define GLUT_HAS_OVERLAY 802
470 #define GLUT_TRANSPARENT_INDEX 803
471 #define GLUT_NORMAL_DAMAGED 804
472 #define GLUT_OVERLAY_DAMAGED 805
474 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
475 /* glutVideoResizeGet parameters. */
476 #define GLUT_VIDEO_RESIZE_POSSIBLE 900
477 #define GLUT_VIDEO_RESIZE_IN_USE 901
478 #define GLUT_VIDEO_RESIZE_X_DELTA 902
479 #define GLUT_VIDEO_RESIZE_Y_DELTA 903
480 #define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
481 #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
482 #define GLUT_VIDEO_RESIZE_X 906
483 #define GLUT_VIDEO_RESIZE_Y 907
484 #define GLUT_VIDEO_RESIZE_WIDTH 908
485 #define GLUT_VIDEO_RESIZE_HEIGHT 909
488 /* glutUseLayer parameters. */
489 #define GLUT_NORMAL 0
490 #define GLUT_OVERLAY 1
492 /* glutGetModifiers return mask. */
493 #define GLUT_ACTIVE_SHIFT 1
494 #define GLUT_ACTIVE_CTRL 2
495 #define GLUT_ACTIVE_ALT 4
497 /* glutSetCursor parameters. */
499 #define GLUT_CURSOR_RIGHT_ARROW 0
500 #define GLUT_CURSOR_LEFT_ARROW 1
501 /* Symbolic cursor shapes. */
502 #define GLUT_CURSOR_INFO 2
503 #define GLUT_CURSOR_DESTROY 3
504 #define GLUT_CURSOR_HELP 4
505 #define GLUT_CURSOR_CYCLE 5
506 #define GLUT_CURSOR_SPRAY 6
507 #define GLUT_CURSOR_WAIT 7
508 #define GLUT_CURSOR_TEXT 8
509 #define GLUT_CURSOR_CROSSHAIR 9
510 /* Directional cursors. */
511 #define GLUT_CURSOR_UP_DOWN 10
512 #define GLUT_CURSOR_LEFT_RIGHT 11
513 /* Sizing cursors. */
514 #define GLUT_CURSOR_TOP_SIDE 12
515 #define GLUT_CURSOR_BOTTOM_SIDE 13
516 #define GLUT_CURSOR_LEFT_SIDE 14
517 #define GLUT_CURSOR_RIGHT_SIDE 15
518 #define GLUT_CURSOR_TOP_LEFT_CORNER 16
519 #define GLUT_CURSOR_TOP_RIGHT_CORNER 17
520 #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
521 #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
522 /* Inherit from parent window. */
523 #define GLUT_CURSOR_INHERIT 100
525 #define GLUT_CURSOR_NONE 101
526 /* Fullscreen crosshair (if available). */
527 #define GLUT_CURSOR_FULL_CROSSHAIR 102
530 /* GLUT initialization sub-API. */
531 GLUTAPI
void GLUTAPIENTRY
glutInit(int *argcp
, char **argv
);
532 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
533 GLUTAPI
void GLUTAPIENTRY
__glutInitWithExit(int *argcp
, char **argv
, void (__cdecl
*exitfunc
)(int));
534 #ifndef GLUT_BUILDING_LIB
535 static void GLUTAPIENTRY
glutInit_ATEXIT_HACK(int *argcp
, char **argv
) { __glutInitWithExit(argcp
, argv
, exit
); }
536 #define glutInit glutInit_ATEXIT_HACK
539 GLUTAPI
void GLUTAPIENTRY
glutInitDisplayMode(unsigned int mode
);
540 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
541 GLUTAPI
void GLUTAPIENTRY
glutInitDisplayString(const char *string
);
543 GLUTAPI
void GLUTAPIENTRY
glutInitWindowPosition(int x
, int y
);
544 GLUTAPI
void GLUTAPIENTRY
glutInitWindowSize(int width
, int height
);
545 GLUTAPI
void GLUTAPIENTRY
glutMainLoop(void);
547 /* GLUT window sub-API. */
548 GLUTAPI
int GLUTAPIENTRY
glutCreateWindow(const char *title
);
549 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
550 GLUTAPI
int GLUTAPIENTRY
__glutCreateWindowWithExit(const char *title
, void (__cdecl
*exitfunc
)(int));
551 #ifndef GLUT_BUILDING_LIB
552 static int GLUTAPIENTRY
glutCreateWindow_ATEXIT_HACK(const char *title
) { return __glutCreateWindowWithExit(title
, exit
); }
553 #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
556 GLUTAPI
int GLUTAPIENTRY
glutCreateSubWindow(int win
, int x
, int y
, int width
, int height
);
557 GLUTAPI
void GLUTAPIENTRY
glutDestroyWindow(int win
);
558 GLUTAPI
void GLUTAPIENTRY
glutPostRedisplay(void);
559 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
560 GLUTAPI
void GLUTAPIENTRY
glutPostWindowRedisplay(int win
);
562 GLUTAPI
void GLUTAPIENTRY
glutSwapBuffers(void);
563 GLUTAPI
int GLUTAPIENTRY
glutGetWindow(void);
564 GLUTAPI
void GLUTAPIENTRY
glutSetWindow(int win
);
565 GLUTAPI
void GLUTAPIENTRY
glutSetWindowTitle(const char *title
);
566 GLUTAPI
void GLUTAPIENTRY
glutSetIconTitle(const char *title
);
567 GLUTAPI
void GLUTAPIENTRY
glutPositionWindow(int x
, int y
);
568 GLUTAPI
void GLUTAPIENTRY
glutReshapeWindow(int width
, int height
);
569 GLUTAPI
void GLUTAPIENTRY
glutPopWindow(void);
570 GLUTAPI
void GLUTAPIENTRY
glutPushWindow(void);
571 GLUTAPI
void GLUTAPIENTRY
glutIconifyWindow(void);
572 GLUTAPI
void GLUTAPIENTRY
glutShowWindow(void);
573 GLUTAPI
void GLUTAPIENTRY
glutHideWindow(void);
574 #if (GLUT_API_VERSION >= 3)
575 GLUTAPI
void GLUTAPIENTRY
glutFullScreen(void);
576 GLUTAPI
void GLUTAPIENTRY
glutSetCursor(int cursor
);
577 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
578 GLUTAPI
void GLUTAPIENTRY
glutWarpPointer(int x
, int y
);
581 /* GLUT overlay sub-API. */
582 GLUTAPI
void GLUTAPIENTRY
glutEstablishOverlay(void);
583 GLUTAPI
void GLUTAPIENTRY
glutRemoveOverlay(void);
584 GLUTAPI
void GLUTAPIENTRY
glutUseLayer(GLenum layer
);
585 GLUTAPI
void GLUTAPIENTRY
glutPostOverlayRedisplay(void);
586 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
587 GLUTAPI
void GLUTAPIENTRY
glutPostWindowOverlayRedisplay(int win
);
589 GLUTAPI
void GLUTAPIENTRY
glutShowOverlay(void);
590 GLUTAPI
void GLUTAPIENTRY
glutHideOverlay(void);
593 /* GLUT menu sub-API. */
594 GLUTAPI
int GLUTAPIENTRY
glutCreateMenu(void (GLUTCALLBACK
*func
)(int));
595 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
596 GLUTAPI
int GLUTAPIENTRY
__glutCreateMenuWithExit(void (GLUTCALLBACK
*func
)(int), void (__cdecl
*exitfunc
)(int));
597 #ifndef GLUT_BUILDING_LIB
598 static int GLUTAPIENTRY
glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK
*func
)(int)) { return __glutCreateMenuWithExit(func
, exit
); }
599 #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
602 GLUTAPI
void GLUTAPIENTRY
glutDestroyMenu(int menu
);
603 GLUTAPI
int GLUTAPIENTRY
glutGetMenu(void);
604 GLUTAPI
void GLUTAPIENTRY
glutSetMenu(int menu
);
605 GLUTAPI
void GLUTAPIENTRY
glutAddMenuEntry(const char *label
, int value
);
606 GLUTAPI
void GLUTAPIENTRY
glutAddSubMenu(const char *label
, int submenu
);
607 GLUTAPI
void GLUTAPIENTRY
glutChangeToMenuEntry(int item
, const char *label
, int value
);
608 GLUTAPI
void GLUTAPIENTRY
glutChangeToSubMenu(int item
, const char *label
, int submenu
);
609 GLUTAPI
void GLUTAPIENTRY
glutRemoveMenuItem(int item
);
610 GLUTAPI
void GLUTAPIENTRY
glutAttachMenu(int button
);
611 GLUTAPI
void GLUTAPIENTRY
glutDetachMenu(int button
);
613 /* GLUT window callback sub-API. */
614 GLUTAPI
void GLUTAPIENTRY
glutDisplayFunc(void (GLUTCALLBACK
*func
)(void));
615 GLUTAPI
void GLUTAPIENTRY
glutReshapeFunc(void (GLUTCALLBACK
*func
)(int width
, int height
));
616 GLUTAPI
void GLUTAPIENTRY
glutKeyboardFunc(void (GLUTCALLBACK
*func
)(unsigned char key
, int x
, int y
));
617 GLUTAPI
void GLUTAPIENTRY
glutMouseFunc(void (GLUTCALLBACK
*func
)(int button
, int state
, int x
, int y
));
618 GLUTAPI
void GLUTAPIENTRY
glutMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
));
619 GLUTAPI
void GLUTAPIENTRY
glutPassiveMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
));
620 GLUTAPI
void GLUTAPIENTRY
glutEntryFunc(void (GLUTCALLBACK
*func
)(int state
));
621 GLUTAPI
void GLUTAPIENTRY
glutVisibilityFunc(void (GLUTCALLBACK
*func
)(int state
));
622 GLUTAPI
void GLUTAPIENTRY
glutIdleFunc(void (GLUTCALLBACK
*func
)(void));
623 GLUTAPI
void GLUTAPIENTRY
glutTimerFunc(unsigned int millis
, void (GLUTCALLBACK
*func
)(int value
), int value
);
624 GLUTAPI
void GLUTAPIENTRY
glutMenuStateFunc(void (GLUTCALLBACK
*func
)(int state
));
625 #if (GLUT_API_VERSION >= 2)
626 GLUTAPI
void GLUTAPIENTRY
glutSpecialFunc(void (GLUTCALLBACK
*func
)(int key
, int x
, int y
));
627 GLUTAPI
void GLUTAPIENTRY
glutSpaceballMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
, int z
));
628 GLUTAPI
void GLUTAPIENTRY
glutSpaceballRotateFunc(void (GLUTCALLBACK
*func
)(int x
, int y
, int z
));
629 GLUTAPI
void GLUTAPIENTRY
glutSpaceballButtonFunc(void (GLUTCALLBACK
*func
)(int button
, int state
));
630 GLUTAPI
void GLUTAPIENTRY
glutButtonBoxFunc(void (GLUTCALLBACK
*func
)(int button
, int state
));
631 GLUTAPI
void GLUTAPIENTRY
glutDialsFunc(void (GLUTCALLBACK
*func
)(int dial
, int value
));
632 GLUTAPI
void GLUTAPIENTRY
glutTabletMotionFunc(void (GLUTCALLBACK
*func
)(int x
, int y
));
633 GLUTAPI
void GLUTAPIENTRY
glutTabletButtonFunc(void (GLUTCALLBACK
*func
)(int button
, int state
, int x
, int y
));
634 #if (GLUT_API_VERSION >= 3)
635 GLUTAPI
void GLUTAPIENTRY
glutMenuStatusFunc(void (GLUTCALLBACK
*func
)(int status
, int x
, int y
));
636 GLUTAPI
void GLUTAPIENTRY
glutOverlayDisplayFunc(void (GLUTCALLBACK
*func
)(void));
637 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
638 GLUTAPI
void GLUTAPIENTRY
glutWindowStatusFunc(void (GLUTCALLBACK
*func
)(int state
));
640 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
641 GLUTAPI
void GLUTAPIENTRY
glutKeyboardUpFunc(void (GLUTCALLBACK
*func
)(unsigned char key
, int x
, int y
));
642 GLUTAPI
void GLUTAPIENTRY
glutSpecialUpFunc(void (GLUTCALLBACK
*func
)(int key
, int x
, int y
));
643 GLUTAPI
void GLUTAPIENTRY
glutJoystickFunc(void (GLUTCALLBACK
*func
)(unsigned int buttonMask
, int x
, int y
, int z
), int pollInterval
);
648 /* GLUT color index sub-API. */
649 GLUTAPI
void GLUTAPIENTRY
glutSetColor(int, GLfloat red
, GLfloat green
, GLfloat blue
);
650 GLUTAPI GLfloat GLUTAPIENTRY
glutGetColor(int ndx
, int component
);
651 GLUTAPI
void GLUTAPIENTRY
glutCopyColormap(int win
);
653 /* GLUT state retrieval sub-API. */
654 GLUTAPI
int GLUTAPIENTRY
glutGet(GLenum type
);
655 GLUTAPI
int GLUTAPIENTRY
glutDeviceGet(GLenum type
);
656 #if (GLUT_API_VERSION >= 2)
657 /* GLUT extension support sub-API */
658 GLUTAPI
int GLUTAPIENTRY
glutExtensionSupported(const char *name
);
660 #if (GLUT_API_VERSION >= 3)
661 GLUTAPI
int GLUTAPIENTRY
glutGetModifiers(void);
662 GLUTAPI
int GLUTAPIENTRY
glutLayerGet(GLenum type
);
665 /* GLUT font sub-API */
666 GLUTAPI
void GLUTAPIENTRY
glutBitmapCharacter(void *font
, int character
);
667 GLUTAPI
int GLUTAPIENTRY
glutBitmapWidth(void *font
, int character
);
668 GLUTAPI
void GLUTAPIENTRY
glutStrokeCharacter(void *font
, int character
);
669 GLUTAPI
int GLUTAPIENTRY
glutStrokeWidth(void *font
, int character
);
670 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
671 GLUTAPI
int GLUTAPIENTRY
glutBitmapLength(void *font
, const unsigned char *string
);
672 GLUTAPI
int GLUTAPIENTRY
glutStrokeLength(void *font
, const unsigned char *string
);
675 /* GLUT pre-built models sub-API */
676 GLUTAPI
void GLUTAPIENTRY
glutWireSphere(GLdouble radius
, GLint slices
, GLint stacks
);
677 GLUTAPI
void GLUTAPIENTRY
glutSolidSphere(GLdouble radius
, GLint slices
, GLint stacks
);
678 GLUTAPI
void GLUTAPIENTRY
glutWireCone(GLdouble base
, GLdouble height
, GLint slices
, GLint stacks
);
679 GLUTAPI
void GLUTAPIENTRY
glutSolidCone(GLdouble base
, GLdouble height
, GLint slices
, GLint stacks
);
680 GLUTAPI
void GLUTAPIENTRY
glutWireCube(GLdouble size
);
681 GLUTAPI
void GLUTAPIENTRY
glutSolidCube(GLdouble size
);
682 GLUTAPI
void GLUTAPIENTRY
glutWireTorus(GLdouble innerRadius
, GLdouble outerRadius
, GLint sides
, GLint rings
);
683 GLUTAPI
void GLUTAPIENTRY
glutSolidTorus(GLdouble innerRadius
, GLdouble outerRadius
, GLint sides
, GLint rings
);
684 GLUTAPI
void GLUTAPIENTRY
glutWireDodecahedron(void);
685 GLUTAPI
void GLUTAPIENTRY
glutSolidDodecahedron(void);
686 GLUTAPI
void GLUTAPIENTRY
glutWireTeapot(GLdouble size
);
687 GLUTAPI
void GLUTAPIENTRY
glutSolidTeapot(GLdouble size
);
688 GLUTAPI
void GLUTAPIENTRY
glutWireOctahedron(void);
689 GLUTAPI
void GLUTAPIENTRY
glutSolidOctahedron(void);
690 GLUTAPI
void GLUTAPIENTRY
glutWireTetrahedron(void);
691 GLUTAPI
void GLUTAPIENTRY
glutSolidTetrahedron(void);
692 GLUTAPI
void GLUTAPIENTRY
glutWireIcosahedron(void);
693 GLUTAPI
void GLUTAPIENTRY
glutSolidIcosahedron(void);
695 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
696 /* GLUT video resize sub-API. */
697 GLUTAPI
int GLUTAPIENTRY
glutVideoResizeGet(GLenum param
);
698 GLUTAPI
void GLUTAPIENTRY
glutSetupVideoResizing(void);
699 GLUTAPI
void GLUTAPIENTRY
glutStopVideoResizing(void);
700 GLUTAPI
void GLUTAPIENTRY
glutVideoResize(int x
, int y
, int width
, int height
);
701 GLUTAPI
void GLUTAPIENTRY
glutVideoPan(int x
, int y
, int width
, int height
);
703 /* GLUT debugging sub-API. */
704 GLUTAPI
void GLUTAPIENTRY
glutReportErrors(void);
707 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
708 /* GLUT device control sub-API. */
709 /* glutSetKeyRepeat modes. */
710 #define GLUT_KEY_REPEAT_OFF 0
711 #define GLUT_KEY_REPEAT_ON 1
712 #define GLUT_KEY_REPEAT_DEFAULT 2
714 /* Joystick button masks. */
715 #define GLUT_JOYSTICK_BUTTON_A 1
716 #define GLUT_JOYSTICK_BUTTON_B 2
717 #define GLUT_JOYSTICK_BUTTON_C 4
718 #define GLUT_JOYSTICK_BUTTON_D 8
720 GLUTAPI
void GLUTAPIENTRY
glutIgnoreKeyRepeat(int ignore
);
721 GLUTAPI
void GLUTAPIENTRY
glutSetKeyRepeat(int repeatMode
);
722 GLUTAPI
void GLUTAPIENTRY
glutForceJoystickFunc(void);
724 /* GLUT game mode sub-API. */
725 /* glutGameModeGet. */
726 #define GLUT_GAME_MODE_ACTIVE 0
727 #define GLUT_GAME_MODE_POSSIBLE 1
728 #define GLUT_GAME_MODE_WIDTH 2
729 #define GLUT_GAME_MODE_HEIGHT 3
730 #define GLUT_GAME_MODE_PIXEL_DEPTH 4
731 #define GLUT_GAME_MODE_REFRESH_RATE 5
732 #define GLUT_GAME_MODE_DISPLAY_CHANGED 6
734 GLUTAPI
void GLUTAPIENTRY
glutGameModeString(const char *string
);
735 GLUTAPI
int GLUTAPIENTRY
glutEnterGameMode(void);
736 GLUTAPI
void GLUTAPIENTRY
glutLeaveGameMode(void);
737 GLUTAPI
int GLUTAPIENTRY
glutGameModeGet(GLenum mode
);
745 #ifdef GLUT_APIENTRY_DEFINED
746 # undef GLUT_APIENTRY_DEFINED
750 #ifdef GLUT_WINGDIAPI_DEFINED
751 # undef GLUT_WINGDIAPI_DEFINED
755 #ifdef GLUT_DEFINED___CDECL
756 # undef GLUT_DEFINED___CDECL
760 #ifdef GLUT_DEFINED__CRTIMP
761 # undef GLUT_DEFINED__CRTIMP
766 #endif /* __glut_h__ */