blob: a2826352051f18955ee7b005d79aeef44a4455f5 [file] [log] [blame]
jtgafb833d1999-08-19 00:55:39 +00001#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
José Fonseca492c7b32009-01-24 12:47:02 +000010#if defined(_WIN32)
José Fonseca4558f6a2009-01-22 14:29:01 +000011# ifndef WIN32_LEAN_AND_MEAN
12# define WIN32_LEAN_AND_MEAN 1
13# endif
14# include <windows.h>
Zhang76fb8082007-07-21 11:28:06 -060015#endif
16
José Fonseca492c7b32009-01-24 12:47:02 +000017#include <GL/gl.h>
18#include <GL/glu.h>
19
jtgafb833d1999-08-19 00:55:39 +000020#ifdef __cplusplus
21extern "C" {
22#endif
23
24#if defined(_WIN32)
25
jtgafb833d1999-08-19 00:55:39 +000026/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
27 in your compile preprocessor options. */
José Fonseca43677782009-01-24 15:32:01 +000028# if defined(_MSC_VER) && !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
jtgafb833d1999-08-19 00:55:39 +000029# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
30/* To enable automatic SGI OpenGL for Windows library usage for GLUT,
31 define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
32# ifdef GLUT_USE_SGI_OPENGL
33# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
34# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
35# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */
36# else
37# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
38# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
39# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
40# endif
41# endif
42
43/* To disable supression of annoying warnings about floats being promoted
44 to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
45 options. */
José Fonseca81aa6782008-11-21 05:26:52 +090046# if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
jtgafb833d1999-08-19 00:55:39 +000047# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
48# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
49# endif
50
51/* Win32 has an annoying issue where there are multiple C run-time
52 libraries (CRTs). If the executable is linked with a different CRT
53 from the GLUT DLL, the GLUT DLL will not share the same CRT static
54 data seen by the executable. In particular, atexit callbacks registered
55 in the executable will not be called if GLUT calls its (different)
56 exit routine). GLUT is typically built with the
57 "/MD" option (the CRT with multithreading DLL support), but the Visual
58 C++ linker default is "/ML" (the single threaded CRT).
59
60 One workaround to this issue is requiring users to always link with
61 the same CRT as GLUT is compiled with. That requires users supply a
62 non-standard option. GLUT 3.7 has its own built-in workaround where
63 the executable's "exit" function pointer is covertly passed to GLUT.
64 GLUT then calls the executable's exit function pointer to ensure that
65 any "atexit" calls registered by the application are called if GLUT
66 needs to exit.
67
68 Note that the __glut*WithExit routines should NEVER be called directly.
69 To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
70
71/* XXX This is from Win32's <process.h> */
Brian Paul83889ff2004-11-08 15:08:48 +000072# if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__cdecl)
jtgafb833d1999-08-19 00:55:39 +000073 /* Define __cdecl for non-Microsoft compilers. */
74# define __cdecl
75# define GLUT_DEFINED___CDECL
76# endif
José Fonsecab5c901a2009-02-12 13:52:16 +000077#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
78#include <stdlib.h>
79#endif
jtgafb833d1999-08-19 00:55:39 +000080
81/* GLUT callback calling convention for Win32. */
82# define GLUTCALLBACK __cdecl
83
84/* for callback/function pointer defs */
85# define GLUTAPIENTRYV __cdecl
86
87/* glut-win32 specific macros, defined to prevent collision with
88 and redifinition of Windows system defs, also removes requirement of
89 pretty much any standard windows header from this file */
90
Zhang35f35292007-07-27 11:19:35 -060091#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
jtgafb833d1999-08-19 00:55:39 +000092# define GLUTAPIENTRY __stdcall
93#else
94# define GLUTAPIENTRY
95#endif
96
97/* GLUT API entry point declarations for Win32. */
José Fonseca0e4e7652009-01-24 13:52:02 +000098#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && !defined(GLUT_STATIC)
jtgafb833d1999-08-19 00:55:39 +000099# define GLUTAPI __declspec(dllexport)
José Fonseca0e4e7652009-01-24 13:52:02 +0000100#elif !defined(GLUT_STATIC)
jtgafb833d1999-08-19 00:55:39 +0000101# define GLUTAPI __declspec(dllimport)
102#else
103# define GLUTAPI extern
104#endif
105
Ian Romanick016fc302010-03-03 16:02:45 -0800106#elif defined(__GNUC__)
jtgafb833d1999-08-19 00:55:39 +0000107
José Fonsecad150e6a2009-01-23 12:27:10 +0000108# define GLUTAPIENTRY
109# define GLUTAPIENTRYV
110# define GLUTCALLBACK
José Fonseca5ef51622009-02-12 15:49:55 +0000111# define GLUTAPI extern __attribute__((visibility("default")))
José Fonsecad150e6a2009-01-23 12:27:10 +0000112
113#else
114
115/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing */
116# define GLUTAPIENTRY
jtgafb833d1999-08-19 00:55:39 +0000117# define GLUTAPIENTRYV
jtgafb833d1999-08-19 00:55:39 +0000118# define GLUTCALLBACK
119# define GLUTAPI extern
Brian Paulf321f162005-02-16 19:52:35 +0000120
jtgafb833d1999-08-19 00:55:39 +0000121#endif
122
123
124/**
125 GLUT API revision history:
126
127 GLUT_API_VERSION is updated to reflect incompatible GLUT
128 API changes (interface changes, semantic changes, deletions,
129 or additions).
130
131 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
132
133 GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
134 extension. Supports new input devices like tablet, dial and button
135 box, and Spaceball. Easy to query OpenGL extensions.
136
137 GLUT_API_VERSION=3 glutMenuStatus added.
138
139 GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
140 glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
141 video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
142 glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
143 glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
Brian Paul7ae67142002-08-17 00:12:48 +0000144
145 GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP)
jtgafb833d1999-08-19 00:55:39 +0000146**/
147#ifndef GLUT_API_VERSION /* allow this to be overriden */
Brian Paul7ae67142002-08-17 00:12:48 +0000148#define GLUT_API_VERSION 5
jtgafb833d1999-08-19 00:55:39 +0000149#endif
150
151/**
152 GLUT implementation revision history:
153
154 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
155 API revisions and implementation revisions (ie, bug fixes).
156
157 GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
158 GLUT Xlib-based implementation. 11/29/94
159
160 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
161 GLUT Xlib-based implementation providing GLUT version 2
162 interfaces.
163
164 GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
165
166 GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
167
168 GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
169
170 GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
171
172 GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
173 and video resize. 1/3/97
174
175 GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
176
177 GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
178
179 GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
180
181 GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
182
183 GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
184
185 GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
186**/
187#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
188#define GLUT_XLIB_IMPLEMENTATION 15
189#endif
190
191/* Display mode bit masks. */
192#define GLUT_RGB 0
193#define GLUT_RGBA GLUT_RGB
194#define GLUT_INDEX 1
195#define GLUT_SINGLE 0
196#define GLUT_DOUBLE 2
197#define GLUT_ACCUM 4
198#define GLUT_ALPHA 8
199#define GLUT_DEPTH 16
200#define GLUT_STENCIL 32
201#if (GLUT_API_VERSION >= 2)
202#define GLUT_MULTISAMPLE 128
203#define GLUT_STEREO 256
204#endif
205#if (GLUT_API_VERSION >= 3)
206#define GLUT_LUMINANCE 512
207#endif
208
209/* Mouse buttons. */
210#define GLUT_LEFT_BUTTON 0
211#define GLUT_MIDDLE_BUTTON 1
212#define GLUT_RIGHT_BUTTON 2
213
214/* Mouse button state. */
215#define GLUT_DOWN 0
216#define GLUT_UP 1
217
218#if (GLUT_API_VERSION >= 2)
219/* function keys */
220#define GLUT_KEY_F1 1
221#define GLUT_KEY_F2 2
222#define GLUT_KEY_F3 3
223#define GLUT_KEY_F4 4
224#define GLUT_KEY_F5 5
225#define GLUT_KEY_F6 6
226#define GLUT_KEY_F7 7
227#define GLUT_KEY_F8 8
228#define GLUT_KEY_F9 9
229#define GLUT_KEY_F10 10
230#define GLUT_KEY_F11 11
231#define GLUT_KEY_F12 12
232/* directional keys */
233#define GLUT_KEY_LEFT 100
234#define GLUT_KEY_UP 101
235#define GLUT_KEY_RIGHT 102
236#define GLUT_KEY_DOWN 103
237#define GLUT_KEY_PAGE_UP 104
238#define GLUT_KEY_PAGE_DOWN 105
239#define GLUT_KEY_HOME 106
240#define GLUT_KEY_END 107
241#define GLUT_KEY_INSERT 108
242#endif
243
244/* Entry/exit state. */
245#define GLUT_LEFT 0
246#define GLUT_ENTERED 1
247
248/* Menu usage state. */
249#define GLUT_MENU_NOT_IN_USE 0
250#define GLUT_MENU_IN_USE 1
251
252/* Visibility state. */
253#define GLUT_NOT_VISIBLE 0
254#define GLUT_VISIBLE 1
255
256/* Window status state. */
257#define GLUT_HIDDEN 0
258#define GLUT_FULLY_RETAINED 1
259#define GLUT_PARTIALLY_RETAINED 2
260#define GLUT_FULLY_COVERED 3
261
262/* Color index component selection values. */
263#define GLUT_RED 0
264#define GLUT_GREEN 1
265#define GLUT_BLUE 2
266
267/* Layers for use. */
268#define GLUT_NORMAL 0
269#define GLUT_OVERLAY 1
270
Brian Paul9ec58c22003-08-19 15:52:51 +0000271#if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
jtgafb833d1999-08-19 00:55:39 +0000272/* Stroke font constants (use these in GLUT program). */
273#define GLUT_STROKE_ROMAN ((void*)0)
274#define GLUT_STROKE_MONO_ROMAN ((void*)1)
275
276/* Bitmap font constants (use these in GLUT program). */
277#define GLUT_BITMAP_9_BY_15 ((void*)2)
278#define GLUT_BITMAP_8_BY_13 ((void*)3)
279#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
280#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
281#if (GLUT_API_VERSION >= 3)
282#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
283#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
284#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
285#endif
286#else
287/* Stroke font opaque addresses (use constants instead in source code). */
288GLUTAPI void *glutStrokeRoman;
289GLUTAPI void *glutStrokeMonoRoman;
290
291/* Stroke font constants (use these in GLUT program). */
292#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
293#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
294
295/* Bitmap font opaque addresses (use constants instead in source code). */
296GLUTAPI void *glutBitmap9By15;
297GLUTAPI void *glutBitmap8By13;
298GLUTAPI void *glutBitmapTimesRoman10;
299GLUTAPI void *glutBitmapTimesRoman24;
300GLUTAPI void *glutBitmapHelvetica10;
301GLUTAPI void *glutBitmapHelvetica12;
302GLUTAPI void *glutBitmapHelvetica18;
303
304/* Bitmap font constants (use these in GLUT program). */
305#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
306#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
307#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
308#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
309#if (GLUT_API_VERSION >= 3)
310#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
311#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
312#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
313#endif
314#endif
315
316/* glutGet parameters. */
317#define GLUT_WINDOW_X 100
318#define GLUT_WINDOW_Y 101
319#define GLUT_WINDOW_WIDTH 102
320#define GLUT_WINDOW_HEIGHT 103
321#define GLUT_WINDOW_BUFFER_SIZE 104
322#define GLUT_WINDOW_STENCIL_SIZE 105
323#define GLUT_WINDOW_DEPTH_SIZE 106
324#define GLUT_WINDOW_RED_SIZE 107
325#define GLUT_WINDOW_GREEN_SIZE 108
326#define GLUT_WINDOW_BLUE_SIZE 109
327#define GLUT_WINDOW_ALPHA_SIZE 110
328#define GLUT_WINDOW_ACCUM_RED_SIZE 111
329#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
330#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
331#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
332#define GLUT_WINDOW_DOUBLEBUFFER 115
333#define GLUT_WINDOW_RGBA 116
334#define GLUT_WINDOW_PARENT 117
335#define GLUT_WINDOW_NUM_CHILDREN 118
336#define GLUT_WINDOW_COLORMAP_SIZE 119
337#if (GLUT_API_VERSION >= 2)
338#define GLUT_WINDOW_NUM_SAMPLES 120
339#define GLUT_WINDOW_STEREO 121
340#endif
341#if (GLUT_API_VERSION >= 3)
342#define GLUT_WINDOW_CURSOR 122
343#endif
344#define GLUT_SCREEN_WIDTH 200
345#define GLUT_SCREEN_HEIGHT 201
346#define GLUT_SCREEN_WIDTH_MM 202
347#define GLUT_SCREEN_HEIGHT_MM 203
348#define GLUT_MENU_NUM_ITEMS 300
349#define GLUT_DISPLAY_MODE_POSSIBLE 400
350#define GLUT_INIT_WINDOW_X 500
351#define GLUT_INIT_WINDOW_Y 501
352#define GLUT_INIT_WINDOW_WIDTH 502
353#define GLUT_INIT_WINDOW_HEIGHT 503
354#define GLUT_INIT_DISPLAY_MODE 504
355#if (GLUT_API_VERSION >= 2)
356#define GLUT_ELAPSED_TIME 700
357#endif
358#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
359#define GLUT_WINDOW_FORMAT_ID 123
360#endif
361
362#if (GLUT_API_VERSION >= 2)
363/* glutDeviceGet parameters. */
364#define GLUT_HAS_KEYBOARD 600
365#define GLUT_HAS_MOUSE 601
366#define GLUT_HAS_SPACEBALL 602
367#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
368#define GLUT_HAS_TABLET 604
369#define GLUT_NUM_MOUSE_BUTTONS 605
370#define GLUT_NUM_SPACEBALL_BUTTONS 606
371#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
372#define GLUT_NUM_DIALS 608
373#define GLUT_NUM_TABLET_BUTTONS 609
374#endif
375#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
376#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
377#define GLUT_DEVICE_KEY_REPEAT 611
378#define GLUT_HAS_JOYSTICK 612
379#define GLUT_OWNS_JOYSTICK 613
380#define GLUT_JOYSTICK_BUTTONS 614
381#define GLUT_JOYSTICK_AXES 615
382#define GLUT_JOYSTICK_POLL_RATE 616
383#endif
384
385#if (GLUT_API_VERSION >= 3)
386/* glutLayerGet parameters. */
387#define GLUT_OVERLAY_POSSIBLE 800
388#define GLUT_LAYER_IN_USE 801
389#define GLUT_HAS_OVERLAY 802
390#define GLUT_TRANSPARENT_INDEX 803
391#define GLUT_NORMAL_DAMAGED 804
392#define GLUT_OVERLAY_DAMAGED 805
393
394#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
395/* glutVideoResizeGet parameters. */
396#define GLUT_VIDEO_RESIZE_POSSIBLE 900
397#define GLUT_VIDEO_RESIZE_IN_USE 901
398#define GLUT_VIDEO_RESIZE_X_DELTA 902
399#define GLUT_VIDEO_RESIZE_Y_DELTA 903
400#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
401#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
402#define GLUT_VIDEO_RESIZE_X 906
403#define GLUT_VIDEO_RESIZE_Y 907
404#define GLUT_VIDEO_RESIZE_WIDTH 908
405#define GLUT_VIDEO_RESIZE_HEIGHT 909
406#endif
407
408/* glutUseLayer parameters. */
409#define GLUT_NORMAL 0
410#define GLUT_OVERLAY 1
411
412/* glutGetModifiers return mask. */
413#define GLUT_ACTIVE_SHIFT 1
414#define GLUT_ACTIVE_CTRL 2
415#define GLUT_ACTIVE_ALT 4
416
417/* glutSetCursor parameters. */
418/* Basic arrows. */
419#define GLUT_CURSOR_RIGHT_ARROW 0
420#define GLUT_CURSOR_LEFT_ARROW 1
421/* Symbolic cursor shapes. */
422#define GLUT_CURSOR_INFO 2
423#define GLUT_CURSOR_DESTROY 3
424#define GLUT_CURSOR_HELP 4
425#define GLUT_CURSOR_CYCLE 5
426#define GLUT_CURSOR_SPRAY 6
427#define GLUT_CURSOR_WAIT 7
428#define GLUT_CURSOR_TEXT 8
429#define GLUT_CURSOR_CROSSHAIR 9
430/* Directional cursors. */
431#define GLUT_CURSOR_UP_DOWN 10
432#define GLUT_CURSOR_LEFT_RIGHT 11
433/* Sizing cursors. */
434#define GLUT_CURSOR_TOP_SIDE 12
435#define GLUT_CURSOR_BOTTOM_SIDE 13
436#define GLUT_CURSOR_LEFT_SIDE 14
437#define GLUT_CURSOR_RIGHT_SIDE 15
438#define GLUT_CURSOR_TOP_LEFT_CORNER 16
439#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
440#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
441#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
442/* Inherit from parent window. */
443#define GLUT_CURSOR_INHERIT 100
444/* Blank cursor. */
445#define GLUT_CURSOR_NONE 101
446/* Fullscreen crosshair (if available). */
447#define GLUT_CURSOR_FULL_CROSSHAIR 102
448#endif
449
450/* GLUT initialization sub-API. */
451GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
452#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
453GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
454#ifndef GLUT_BUILDING_LIB
José Fonseca700a2eb2009-12-31 17:53:23 +0000455#define glutInit(__argcp, __argv) __glutInitWithExit(__argcp, __argv, exit)
jtgafb833d1999-08-19 00:55:39 +0000456#endif
457#endif
458GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
459#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
460GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
461#endif
462GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
463GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
464GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
465
466/* GLUT window sub-API. */
467GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
468#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
469GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
470#ifndef GLUT_BUILDING_LIB
José Fonseca700a2eb2009-12-31 17:53:23 +0000471#define glutCreateWindow(__title) __glutCreateWindowWithExit(__title, exit)
jtgafb833d1999-08-19 00:55:39 +0000472#endif
473#endif
474GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
475GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
476GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
477#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
478GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
479#endif
480GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
481GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
482GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
483GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
484GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
485GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
486GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
487GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
488GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
489GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
490GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
491GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
492#if (GLUT_API_VERSION >= 3)
493GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
494GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
495#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
496GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
497#endif
498
499/* GLUT overlay sub-API. */
500GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
501GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
502GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
503GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
504#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
505GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
506#endif
507GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
508GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
509#endif
510
511/* GLUT menu sub-API. */
512GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
513#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
514GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
515#ifndef GLUT_BUILDING_LIB
José Fonseca700a2eb2009-12-31 17:53:23 +0000516#define glutCreateMenu(__func) __glutCreateMenuWithExit(__func, exit)
jtgafb833d1999-08-19 00:55:39 +0000517#endif
518#endif
519GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
520GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
521GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
522GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
523GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
524GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
525GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
526GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
527GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
528GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
529
530/* GLUT window callback sub-API. */
531GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
532GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
533GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
534GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
535GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
536GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
537GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
538GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
539GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
540GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
541GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
542#if (GLUT_API_VERSION >= 2)
543GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
544GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
545GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
546GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
547GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
548GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
549GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
550GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
551#if (GLUT_API_VERSION >= 3)
552GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
553GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
554#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
555GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
556#endif
557#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
558GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
559GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
560GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
561#endif
562#endif
563#endif
564
565/* GLUT color index sub-API. */
Brian Paul20f40fa2003-10-27 18:33:34 +0000566GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue);
jtgafb833d1999-08-19 00:55:39 +0000567GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
568GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
569
570/* GLUT state retrieval sub-API. */
571GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
572GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
573#if (GLUT_API_VERSION >= 2)
574/* GLUT extension support sub-API */
575GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
576#endif
577#if (GLUT_API_VERSION >= 3)
578GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
579GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
580#endif
Brian Paul7ae67142002-08-17 00:12:48 +0000581#if (GLUT_API_VERSION >= 5)
Brian Paul2dd5b9e2004-11-27 04:54:48 +0000582typedef void (*GLUTproc)();
583GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName);
Brian Paul7ae67142002-08-17 00:12:48 +0000584#endif
jtgafb833d1999-08-19 00:55:39 +0000585
586/* GLUT font sub-API */
587GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
588GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
589GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
590GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
591#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
592GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
593GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
594#endif
595
596/* GLUT pre-built models sub-API */
597GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
598GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
599GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
600GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
601GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
602GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
603GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
604GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
605GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
606GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
607GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
608GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
609GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
610GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
611GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
612GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
613GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
614GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
615
616#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
617/* GLUT video resize sub-API. */
618GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
619GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
620GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
621GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
622GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
623
624/* GLUT debugging sub-API. */
625GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
626#endif
627
628#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
629/* GLUT device control sub-API. */
630/* glutSetKeyRepeat modes. */
631#define GLUT_KEY_REPEAT_OFF 0
632#define GLUT_KEY_REPEAT_ON 1
633#define GLUT_KEY_REPEAT_DEFAULT 2
634
635/* Joystick button masks. */
636#define GLUT_JOYSTICK_BUTTON_A 1
637#define GLUT_JOYSTICK_BUTTON_B 2
638#define GLUT_JOYSTICK_BUTTON_C 4
639#define GLUT_JOYSTICK_BUTTON_D 8
640
641GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
642GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
643GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
644
645/* GLUT game mode sub-API. */
646/* glutGameModeGet. */
647#define GLUT_GAME_MODE_ACTIVE 0
648#define GLUT_GAME_MODE_POSSIBLE 1
649#define GLUT_GAME_MODE_WIDTH 2
650#define GLUT_GAME_MODE_HEIGHT 3
651#define GLUT_GAME_MODE_PIXEL_DEPTH 4
652#define GLUT_GAME_MODE_REFRESH_RATE 5
653#define GLUT_GAME_MODE_DISPLAY_CHANGED 6
654
655GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
656GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
657GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
658GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
659#endif
660
661#ifdef __cplusplus
662}
jtgafb833d1999-08-19 00:55:39 +0000663#endif
664
jtgafb833d1999-08-19 00:55:39 +0000665#endif /* __glut_h__ */