Initial revision
[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)
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 GLUTAPI int GLUTAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
157 GLUTAPI HGLRC GLUTAPIENTRY wglCreateContext(HDC);
158 GLUTAPI HGLRC GLUTAPIENTRY wglCreateLayerContext(HDC, int);
159 GLUTAPI int GLUTAPIENTRY wglDeleteContext(HGLRC);
160 GLUTAPI HGLRC GLUTAPIENTRY wglGetCurrentContext(void);
161 GLUTAPI HDC GLUTAPIENTRY wglGetCurrentDC(void);
162 GLUTAPI PROC GLUTAPIENTRY wglGetProcAddress(char*);
163 GLUTAPI int GLUTAPIENTRY wglMakeCurrent(HDC, HGLRC);
164 GLUTAPI int GLUTAPIENTRY wglShareLists(HGLRC, HGLRC);
165 GLUTAPI int GLUTAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
166 GLUTAPI int GLUTAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
167 GLUTAPI int GLUTAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
168 GLUTAPI int GLUTAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
169 GLUTAPI int GLUTAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
170 GLUTAPI int GLUTAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
171 GLUTAPI int GLUTAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
172 GLUTAPI int GLUTAPIENTRY wglRealizeLayerPalette(HDC, int, int);
173 GLUTAPI int GLUTAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
174 GLUTAPI int GLUTAPIENTRY SwapBuffers(HDC);
175 #endif
176
177 #else /* _WIN32 not defined */
178
179 /* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */
180 # define GLUTAPIENTRY
181 # define GLUTAPIENTRYV
182 # define GLUT_APIENTRY_DEFINED
183 # define GLUTCALLBACK
184 # define GLUTAPI extern
185 /* Prototype exit for the non-Win32 case (see above). */
186 extern void exit(int);
187 #endif
188
189
190 /**
191 GLUT API revision history:
192
193 GLUT_API_VERSION is updated to reflect incompatible GLUT
194 API changes (interface changes, semantic changes, deletions,
195 or additions).
196
197 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
198
199 GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
200 extension. Supports new input devices like tablet, dial and button
201 box, and Spaceball. Easy to query OpenGL extensions.
202
203 GLUT_API_VERSION=3 glutMenuStatus added.
204
205 GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
206 glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
207 video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
208 glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
209 glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
210 **/
211 #ifndef GLUT_API_VERSION /* allow this to be overriden */
212 #define GLUT_API_VERSION 3
213 #endif
214
215 /**
216 GLUT implementation revision history:
217
218 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
219 API revisions and implementation revisions (ie, bug fixes).
220
221 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
222 GLUT Xlib-based implementation. 11/29/94
223
224 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
225 GLUT Xlib-based implementation providing GLUT version 2
226 interfaces.
227
228 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
229
230 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
231
232 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
233
234 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
235
236 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
237 and video resize. 1/3/97
238
239 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
240
241 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
242
243 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
244
245 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
246
247 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
248
249 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
250 **/
251 #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
252 #define GLUT_XLIB_IMPLEMENTATION 15
253 #endif
254
255 /* Display mode bit masks. */
256 #define GLUT_RGB 0
257 #define GLUT_RGBA GLUT_RGB
258 #define GLUT_INDEX 1
259 #define GLUT_SINGLE 0
260 #define GLUT_DOUBLE 2
261 #define GLUT_ACCUM 4
262 #define GLUT_ALPHA 8
263 #define GLUT_DEPTH 16
264 #define GLUT_STENCIL 32
265 #if (GLUT_API_VERSION >= 2)
266 #define GLUT_MULTISAMPLE 128
267 #define GLUT_STEREO 256
268 #endif
269 #if (GLUT_API_VERSION >= 3)
270 #define GLUT_LUMINANCE 512
271 #endif
272
273 /* Mouse buttons. */
274 #define GLUT_LEFT_BUTTON 0
275 #define GLUT_MIDDLE_BUTTON 1
276 #define GLUT_RIGHT_BUTTON 2
277
278 /* Mouse button state. */
279 #define GLUT_DOWN 0
280 #define GLUT_UP 1
281
282 #if (GLUT_API_VERSION >= 2)
283 /* function keys */
284 #define GLUT_KEY_F1 1
285 #define GLUT_KEY_F2 2
286 #define GLUT_KEY_F3 3
287 #define GLUT_KEY_F4 4
288 #define GLUT_KEY_F5 5
289 #define GLUT_KEY_F6 6
290 #define GLUT_KEY_F7 7
291 #define GLUT_KEY_F8 8
292 #define GLUT_KEY_F9 9
293 #define GLUT_KEY_F10 10
294 #define GLUT_KEY_F11 11
295 #define GLUT_KEY_F12 12
296 /* directional keys */
297 #define GLUT_KEY_LEFT 100
298 #define GLUT_KEY_UP 101
299 #define GLUT_KEY_RIGHT 102
300 #define GLUT_KEY_DOWN 103
301 #define GLUT_KEY_PAGE_UP 104
302 #define GLUT_KEY_PAGE_DOWN 105
303 #define GLUT_KEY_HOME 106
304 #define GLUT_KEY_END 107
305 #define GLUT_KEY_INSERT 108
306 #endif
307
308 /* Entry/exit state. */
309 #define GLUT_LEFT 0
310 #define GLUT_ENTERED 1
311
312 /* Menu usage state. */
313 #define GLUT_MENU_NOT_IN_USE 0
314 #define GLUT_MENU_IN_USE 1
315
316 /* Visibility state. */
317 #define GLUT_NOT_VISIBLE 0
318 #define GLUT_VISIBLE 1
319
320 /* Window status state. */
321 #define GLUT_HIDDEN 0
322 #define GLUT_FULLY_RETAINED 1
323 #define GLUT_PARTIALLY_RETAINED 2
324 #define GLUT_FULLY_COVERED 3
325
326 /* Color index component selection values. */
327 #define GLUT_RED 0
328 #define GLUT_GREEN 1
329 #define GLUT_BLUE 2
330
331 /* Layers for use. */
332 #define GLUT_NORMAL 0
333 #define GLUT_OVERLAY 1
334
335 #if defined(_WIN32)
336 /* Stroke font constants (use these in GLUT program). */
337 #define GLUT_STROKE_ROMAN ((void*)0)
338 #define GLUT_STROKE_MONO_ROMAN ((void*)1)
339
340 /* Bitmap font constants (use these in GLUT program). */
341 #define GLUT_BITMAP_9_BY_15 ((void*)2)
342 #define GLUT_BITMAP_8_BY_13 ((void*)3)
343 #define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
344 #define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
345 #if (GLUT_API_VERSION >= 3)
346 #define GLUT_BITMAP_HELVETICA_10 ((void*)6)
347 #define GLUT_BITMAP_HELVETICA_12 ((void*)7)
348 #define GLUT_BITMAP_HELVETICA_18 ((void*)8)
349 #endif
350 #else
351 /* Stroke font opaque addresses (use constants instead in source code). */
352 GLUTAPI void *glutStrokeRoman;
353 GLUTAPI void *glutStrokeMonoRoman;
354
355 /* Stroke font constants (use these in GLUT program). */
356 #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
357 #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
358
359 /* Bitmap font opaque addresses (use constants instead in source code). */
360 GLUTAPI void *glutBitmap9By15;
361 GLUTAPI void *glutBitmap8By13;
362 GLUTAPI void *glutBitmapTimesRoman10;
363 GLUTAPI void *glutBitmapTimesRoman24;
364 GLUTAPI void *glutBitmapHelvetica10;
365 GLUTAPI void *glutBitmapHelvetica12;
366 GLUTAPI void *glutBitmapHelvetica18;
367
368 /* Bitmap font constants (use these in GLUT program). */
369 #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
370 #define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
371 #define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
372 #define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
373 #if (GLUT_API_VERSION >= 3)
374 #define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
375 #define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
376 #define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
377 #endif
378 #endif
379
380 /* glutGet parameters. */
381 #define GLUT_WINDOW_X 100
382 #define GLUT_WINDOW_Y 101
383 #define GLUT_WINDOW_WIDTH 102
384 #define GLUT_WINDOW_HEIGHT 103
385 #define GLUT_WINDOW_BUFFER_SIZE 104
386 #define GLUT_WINDOW_STENCIL_SIZE 105
387 #define GLUT_WINDOW_DEPTH_SIZE 106
388 #define GLUT_WINDOW_RED_SIZE 107
389 #define GLUT_WINDOW_GREEN_SIZE 108
390 #define GLUT_WINDOW_BLUE_SIZE 109
391 #define GLUT_WINDOW_ALPHA_SIZE 110
392 #define GLUT_WINDOW_ACCUM_RED_SIZE 111
393 #define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
394 #define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
395 #define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
396 #define GLUT_WINDOW_DOUBLEBUFFER 115
397 #define GLUT_WINDOW_RGBA 116
398 #define GLUT_WINDOW_PARENT 117
399 #define GLUT_WINDOW_NUM_CHILDREN 118
400 #define GLUT_WINDOW_COLORMAP_SIZE 119
401 #if (GLUT_API_VERSION >= 2)
402 #define GLUT_WINDOW_NUM_SAMPLES 120
403 #define GLUT_WINDOW_STEREO 121
404 #endif
405 #if (GLUT_API_VERSION >= 3)
406 #define GLUT_WINDOW_CURSOR 122
407 #endif
408 #define GLUT_SCREEN_WIDTH 200
409 #define GLUT_SCREEN_HEIGHT 201
410 #define GLUT_SCREEN_WIDTH_MM 202
411 #define GLUT_SCREEN_HEIGHT_MM 203
412 #define GLUT_MENU_NUM_ITEMS 300
413 #define GLUT_DISPLAY_MODE_POSSIBLE 400
414 #define GLUT_INIT_WINDOW_X 500
415 #define GLUT_INIT_WINDOW_Y 501
416 #define GLUT_INIT_WINDOW_WIDTH 502
417 #define GLUT_INIT_WINDOW_HEIGHT 503
418 #define GLUT_INIT_DISPLAY_MODE 504
419 #if (GLUT_API_VERSION >= 2)
420 #define GLUT_ELAPSED_TIME 700
421 #endif
422 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
423 #define GLUT_WINDOW_FORMAT_ID 123
424 #endif
425
426 #if (GLUT_API_VERSION >= 2)
427 /* glutDeviceGet parameters. */
428 #define GLUT_HAS_KEYBOARD 600
429 #define GLUT_HAS_MOUSE 601
430 #define GLUT_HAS_SPACEBALL 602
431 #define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
432 #define GLUT_HAS_TABLET 604
433 #define GLUT_NUM_MOUSE_BUTTONS 605
434 #define GLUT_NUM_SPACEBALL_BUTTONS 606
435 #define GLUT_NUM_BUTTON_BOX_BUTTONS 607
436 #define GLUT_NUM_DIALS 608
437 #define GLUT_NUM_TABLET_BUTTONS 609
438 #endif
439 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
440 #define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
441 #define GLUT_DEVICE_KEY_REPEAT 611
442 #define GLUT_HAS_JOYSTICK 612
443 #define GLUT_OWNS_JOYSTICK 613
444 #define GLUT_JOYSTICK_BUTTONS 614
445 #define GLUT_JOYSTICK_AXES 615
446 #define GLUT_JOYSTICK_POLL_RATE 616
447 #endif
448
449 #if (GLUT_API_VERSION >= 3)
450 /* glutLayerGet parameters. */
451 #define GLUT_OVERLAY_POSSIBLE 800
452 #define GLUT_LAYER_IN_USE 801
453 #define GLUT_HAS_OVERLAY 802
454 #define GLUT_TRANSPARENT_INDEX 803
455 #define GLUT_NORMAL_DAMAGED 804
456 #define GLUT_OVERLAY_DAMAGED 805
457
458 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
459 /* glutVideoResizeGet parameters. */
460 #define GLUT_VIDEO_RESIZE_POSSIBLE 900
461 #define GLUT_VIDEO_RESIZE_IN_USE 901
462 #define GLUT_VIDEO_RESIZE_X_DELTA 902
463 #define GLUT_VIDEO_RESIZE_Y_DELTA 903
464 #define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
465 #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
466 #define GLUT_VIDEO_RESIZE_X 906
467 #define GLUT_VIDEO_RESIZE_Y 907
468 #define GLUT_VIDEO_RESIZE_WIDTH 908
469 #define GLUT_VIDEO_RESIZE_HEIGHT 909
470 #endif
471
472 /* glutUseLayer parameters. */
473 #define GLUT_NORMAL 0
474 #define GLUT_OVERLAY 1
475
476 /* glutGetModifiers return mask. */
477 #define GLUT_ACTIVE_SHIFT 1
478 #define GLUT_ACTIVE_CTRL 2
479 #define GLUT_ACTIVE_ALT 4
480
481 /* glutSetCursor parameters. */
482 /* Basic arrows. */
483 #define GLUT_CURSOR_RIGHT_ARROW 0
484 #define GLUT_CURSOR_LEFT_ARROW 1
485 /* Symbolic cursor shapes. */
486 #define GLUT_CURSOR_INFO 2
487 #define GLUT_CURSOR_DESTROY 3
488 #define GLUT_CURSOR_HELP 4
489 #define GLUT_CURSOR_CYCLE 5
490 #define GLUT_CURSOR_SPRAY 6
491 #define GLUT_CURSOR_WAIT 7
492 #define GLUT_CURSOR_TEXT 8
493 #define GLUT_CURSOR_CROSSHAIR 9
494 /* Directional cursors. */
495 #define GLUT_CURSOR_UP_DOWN 10
496 #define GLUT_CURSOR_LEFT_RIGHT 11
497 /* Sizing cursors. */
498 #define GLUT_CURSOR_TOP_SIDE 12
499 #define GLUT_CURSOR_BOTTOM_SIDE 13
500 #define GLUT_CURSOR_LEFT_SIDE 14
501 #define GLUT_CURSOR_RIGHT_SIDE 15
502 #define GLUT_CURSOR_TOP_LEFT_CORNER 16
503 #define GLUT_CURSOR_TOP_RIGHT_CORNER 17
504 #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
505 #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
506 /* Inherit from parent window. */
507 #define GLUT_CURSOR_INHERIT 100
508 /* Blank cursor. */
509 #define GLUT_CURSOR_NONE 101
510 /* Fullscreen crosshair (if available). */
511 #define GLUT_CURSOR_FULL_CROSSHAIR 102
512 #endif
513
514 /* GLUT initialization sub-API. */
515 GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
516 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
517 GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
518 #ifndef GLUT_BUILDING_LIB
519 static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
520 #define glutInit glutInit_ATEXIT_HACK
521 #endif
522 #endif
523 GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
524 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
525 GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
526 #endif
527 GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
528 GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
529 GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
530
531 /* GLUT window sub-API. */
532 GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
533 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
534 GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
535 #ifndef GLUT_BUILDING_LIB
536 static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
537 #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
538 #endif
539 #endif
540 GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
541 GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
542 GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
543 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
544 GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
545 #endif
546 GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
547 GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
548 GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
549 GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
550 GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
551 GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
552 GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
553 GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
554 GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
555 GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
556 GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
557 GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
558 #if (GLUT_API_VERSION >= 3)
559 GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
560 GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
561 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
562 GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
563 #endif
564
565 /* GLUT overlay sub-API. */
566 GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
567 GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
568 GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
569 GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
570 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
571 GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
572 #endif
573 GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
574 GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
575 #endif
576
577 /* GLUT menu sub-API. */
578 GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
579 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
580 GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
581 #ifndef GLUT_BUILDING_LIB
582 static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
583 #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
584 #endif
585 #endif
586 GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
587 GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
588 GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
589 GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
590 GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
591 GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
592 GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
593 GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
594 GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
595 GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
596
597 /* GLUT window callback sub-API. */
598 GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
599 GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
600 GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
601 GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
602 GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
603 GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
604 GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
605 GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
606 GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
607 GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
608 GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
609 #if (GLUT_API_VERSION >= 2)
610 GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
611 GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
612 GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
613 GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
614 GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
615 GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
616 GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
617 GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
618 #if (GLUT_API_VERSION >= 3)
619 GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
620 GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
621 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
622 GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
623 #endif
624 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
625 GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
626 GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
627 GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
628 #endif
629 #endif
630 #endif
631
632 /* GLUT color index sub-API. */
633 GLUTAPI void GLUTAPIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
634 GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
635 GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
636
637 /* GLUT state retrieval sub-API. */
638 GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
639 GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
640 #if (GLUT_API_VERSION >= 2)
641 /* GLUT extension support sub-API */
642 GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
643 #endif
644 #if (GLUT_API_VERSION >= 3)
645 GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
646 GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
647 #endif
648
649 /* GLUT font sub-API */
650 GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
651 GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
652 GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
653 GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
654 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
655 GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
656 GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
657 #endif
658
659 /* GLUT pre-built models sub-API */
660 GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
661 GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
662 GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
663 GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
664 GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
665 GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
666 GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
667 GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
668 GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
669 GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
670 GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
671 GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
672 GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
673 GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
674 GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
675 GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
676 GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
677 GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
678
679 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
680 /* GLUT video resize sub-API. */
681 GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
682 GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
683 GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
684 GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
685 GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
686
687 /* GLUT debugging sub-API. */
688 GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
689 #endif
690
691 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
692 /* GLUT device control sub-API. */
693 /* glutSetKeyRepeat modes. */
694 #define GLUT_KEY_REPEAT_OFF 0
695 #define GLUT_KEY_REPEAT_ON 1
696 #define GLUT_KEY_REPEAT_DEFAULT 2
697
698 /* Joystick button masks. */
699 #define GLUT_JOYSTICK_BUTTON_A 1
700 #define GLUT_JOYSTICK_BUTTON_B 2
701 #define GLUT_JOYSTICK_BUTTON_C 4
702 #define GLUT_JOYSTICK_BUTTON_D 8
703
704 GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
705 GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
706 GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
707
708 /* GLUT game mode sub-API. */
709 /* glutGameModeGet. */
710 #define GLUT_GAME_MODE_ACTIVE 0
711 #define GLUT_GAME_MODE_POSSIBLE 1
712 #define GLUT_GAME_MODE_WIDTH 2
713 #define GLUT_GAME_MODE_HEIGHT 3
714 #define GLUT_GAME_MODE_PIXEL_DEPTH 4
715 #define GLUT_GAME_MODE_REFRESH_RATE 5
716 #define GLUT_GAME_MODE_DISPLAY_CHANGED 6
717
718 GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
719 GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
720 GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
721 GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
722 #endif
723
724 #ifdef __cplusplus
725 }
726
727 #endif
728
729 #if 0
730 #ifdef GLUT_APIENTRY_DEFINED
731 # undef GLUT_APIENTRY_DEFINED
732 # undef APIENTRY
733 #endif
734
735 #ifdef GLUT_WINGDIAPI_DEFINED
736 # undef GLUT_WINGDIAPI_DEFINED
737 # undef WINGDIAPI
738 #endif
739
740 #ifdef GLUT_DEFINED___CDECL
741 # undef GLUT_DEFINED___CDECL
742 # undef __cdecl
743 #endif
744
745 #ifdef GLUT_DEFINED__CRTIMP
746 # undef GLUT_DEFINED__CRTIMP
747 # undef _CRTIMP
748 #endif
749 #endif
750
751 #endif /* __glut_h__ */