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