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