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