27d937f7ce809ad466022cca98bfb48e5f677d20
[mesa.git] / include / GL / glut.h
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 <GL/gl.h>
11 #include <GL/glu.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #if defined(_WIN32)
18
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.
22
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.
28
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. */
31
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 */
42 # else
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 */
46 # endif
47 # endif
48
49 /* To disable supression of annoying warnings about floats being promoted
50 to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
51 options. */
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. */
55 # endif
56
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).
65
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
72 needs to exit.
73
74 Note that the __glut*WithExit routines should NEVER be called directly.
75 To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
76
77 /* XXX This is from Win32's <process.h> */
78 # if !defined(_MSC_VER) && !defined(__cdecl)
79 /* Define __cdecl for non-Microsoft compilers. */
80 # define __cdecl
81 # define GLUT_DEFINED___CDECL
82 # endif
83 # ifndef _CRTIMP
84 # ifdef _NTSDK
85 /* Definition compatible with NT SDK */
86 # define _CRTIMP
87 # else
88 /* Current definition */
89 # ifdef _DLL
90 # define _CRTIMP __declspec(dllimport)
91 # else
92 # define _CRTIMP
93 # endif
94 # endif
95 # define GLUT_DEFINED__CRTIMP
96 # endif
97 # ifndef GLUT_BUILDING_LIB
98 extern _CRTIMP void __cdecl exit(int);
99 # endif
100
101 /* GLUT callback calling convention for Win32. */
102 # define GLUTCALLBACK __cdecl
103
104 /* for callback/function pointer defs */
105 # define GLUTAPIENTRYV __cdecl
106
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 */
110
111 #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
112 # define GLUTAPIENTRY __stdcall
113 #else
114 # define GLUTAPIENTRY
115 #endif
116
117 /* GLUT API entry point declarations for Win32. */
118 #if defined(GLUT_BUILDING_LIB) && defined(_DLL)
119 # define GLUTAPI __declspec(dllexport)
120 #elif defined(_DLL)
121 # define GLUTAPI __declspec(dllimport)
122 #else
123 # define GLUTAPI extern
124 #endif
125
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" )
131 # endif
132 # define CALLBACK __stdcall
133 typedef int (GLUTAPIENTRY *PROC)();
134 typedef void *HGLRC;
135 typedef void *HDC;
136 typedef unsigned long COLORREF;
137 #endif
138
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" )
144 # endif
145 # define WGL_FONT_LINES 0
146 # define WGL_FONT_POLYGONS 1
147 # ifdef UNICODE
148 # define wglUseFontBitmaps wglUseFontBitmapsW
149 # define wglUseFontOutlines wglUseFontOutlinesW
150 # else
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 *);
189 # undef WGLAPI
190 # pragma warning( pop )
191 #endif
192
193 #else /* _WIN32 not defined */
194
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! */
203 #endif
204
205
206 /**
207 GLUT API revision history:
208
209 GLUT_API_VERSION is updated to reflect incompatible GLUT
210 API changes (interface changes, semantic changes, deletions,
211 or additions).
212
213 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
214
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.
218
219 GLUT_API_VERSION=3 glutMenuStatus added.
220
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!).
226
227 GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP)
228 **/
229 #ifndef GLUT_API_VERSION /* allow this to be overriden */
230 #define GLUT_API_VERSION 5
231 #endif
232
233 /**
234 GLUT implementation revision history:
235
236 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
237 API revisions and implementation revisions (ie, bug fixes).
238
239 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
240 GLUT Xlib-based implementation. 11/29/94
241
242 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
243 GLUT Xlib-based implementation providing GLUT version 2
244 interfaces.
245
246 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
247
248 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
249
250 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
251
252 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
253
254 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
255 and video resize. 1/3/97
256
257 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
258
259 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
260
261 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
262
263 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
264
265 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
266
267 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
268 **/
269 #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
270 #define GLUT_XLIB_IMPLEMENTATION 15
271 #endif
272
273 /* Display mode bit masks. */
274 #define GLUT_RGB 0
275 #define GLUT_RGBA GLUT_RGB
276 #define GLUT_INDEX 1
277 #define GLUT_SINGLE 0
278 #define GLUT_DOUBLE 2
279 #define GLUT_ACCUM 4
280 #define GLUT_ALPHA 8
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
286 #endif
287 #if (GLUT_API_VERSION >= 3)
288 #define GLUT_LUMINANCE 512
289 #endif
290
291 /* Mouse buttons. */
292 #define GLUT_LEFT_BUTTON 0
293 #define GLUT_MIDDLE_BUTTON 1
294 #define GLUT_RIGHT_BUTTON 2
295
296 /* Mouse button state. */
297 #define GLUT_DOWN 0
298 #define GLUT_UP 1
299
300 #if (GLUT_API_VERSION >= 2)
301 /* function keys */
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
324 #endif
325
326 /* Entry/exit state. */
327 #define GLUT_LEFT 0
328 #define GLUT_ENTERED 1
329
330 /* Menu usage state. */
331 #define GLUT_MENU_NOT_IN_USE 0
332 #define GLUT_MENU_IN_USE 1
333
334 /* Visibility state. */
335 #define GLUT_NOT_VISIBLE 0
336 #define GLUT_VISIBLE 1
337
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
343
344 /* Color index component selection values. */
345 #define GLUT_RED 0
346 #define GLUT_GREEN 1
347 #define GLUT_BLUE 2
348
349 /* Layers for use. */
350 #define GLUT_NORMAL 0
351 #define GLUT_OVERLAY 1
352
353 #if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
354 /* Stroke font constants (use these in GLUT program). */
355 #define GLUT_STROKE_ROMAN ((void*)0)
356 #define GLUT_STROKE_MONO_ROMAN ((void*)1)
357
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)
367 #endif
368 #else
369 /* Stroke font opaque addresses (use constants instead in source code). */
370 GLUTAPI void *glutStrokeRoman;
371 GLUTAPI void *glutStrokeMonoRoman;
372
373 /* Stroke font constants (use these in GLUT program). */
374 #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
375 #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
376
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;
385
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)
395 #endif
396 #endif
397
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
422 #endif
423 #if (GLUT_API_VERSION >= 3)
424 #define GLUT_WINDOW_CURSOR 122
425 #endif
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
439 #endif
440 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
441 #define GLUT_WINDOW_FORMAT_ID 123
442 #endif
443
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
456 #endif
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
465 #endif
466
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
475
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
488 #endif
489
490 /* glutUseLayer parameters. */
491 #define GLUT_NORMAL 0
492 #define GLUT_OVERLAY 1
493
494 /* glutGetModifiers return mask. */
495 #define GLUT_ACTIVE_SHIFT 1
496 #define GLUT_ACTIVE_CTRL 2
497 #define GLUT_ACTIVE_ALT 4
498
499 /* glutSetCursor parameters. */
500 /* Basic arrows. */
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
526 /* Blank cursor. */
527 #define GLUT_CURSOR_NONE 101
528 /* Fullscreen crosshair (if available). */
529 #define GLUT_CURSOR_FULL_CROSSHAIR 102
530 #endif
531
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
539 #endif
540 #endif
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);
544 #endif
545 GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
546 GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
547 GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
548
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
556 #endif
557 #endif
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);
563 #endif
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);
581 #endif
582
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);
590 #endif
591 GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
592 GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
593 #endif
594
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
602 #endif
603 #endif
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);
614
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));
641 #endif
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);
646 #endif
647 #endif
648 #endif
649
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);
654
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);
661 #endif
662 #if (GLUT_API_VERSION >= 3)
663 GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
664 GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
665 #endif
666 #if (GLUT_API_VERSION >= 5)
667 GLUTAPI void * GLUTAPIENTRY glutGetProcAddress(const char *procName);
668 #endif
669
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);
678 #endif
679
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);
699
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);
707
708 /* GLUT debugging sub-API. */
709 GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
710 #endif
711
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
718
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
724
725 GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
726 GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
727 GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
728
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
738
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);
743 #endif
744
745 #ifdef __cplusplus
746 }
747 #endif
748
749 #if 0
750 #ifdef GLUT_APIENTRY_DEFINED
751 # undef GLUT_APIENTRY_DEFINED
752 # undef APIENTRY
753 #endif
754
755 #ifdef GLUT_WINGDIAPI_DEFINED
756 # undef GLUT_WINGDIAPI_DEFINED
757 # undef WINGDIAPI
758 #endif
759
760 #ifdef GLUT_DEFINED___CDECL
761 # undef GLUT_DEFINED___CDECL
762 # undef __cdecl
763 #endif
764
765 #ifdef GLUT_DEFINED__CRTIMP
766 # undef GLUT_DEFINED__CRTIMP
767 # undef _CRTIMP
768 #endif
769 #endif
770
771 #endif /* __glut_h__ */