Home | History | Annotate | Line # | Download | only in GL
      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 #if defined(_WIN32)
     11 #  ifndef WIN32_LEAN_AND_MEAN
     12 #    define WIN32_LEAN_AND_MEAN 1
     13 #  endif
     14 #  include <windows.h>
     15 #endif
     16 
     17 #include <GL/gl.h>
     18 #include <GL/glu.h>
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 #if defined(_WIN32)
     25 
     26 /* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
     27    in your compile preprocessor options. */
     28 # if defined(_MSC_VER) && !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
     29 #  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. */
     46 # if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
     47 #  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> */
     72 # if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__cdecl)
     73    /* Define __cdecl for non-Microsoft compilers. */
     74 #  define __cdecl
     75 #  define GLUT_DEFINED___CDECL
     76 # endif
     77 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
     78 #include <stdlib.h>
     79 #endif
     80 
     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 
     91 #if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
     92 #	define GLUTAPIENTRY __stdcall
     93 #else
     94 #	define GLUTAPIENTRY
     95 #endif
     96 
     97 /* GLUT API entry point declarations for Win32. */
     98 #if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && !defined(GLUT_STATIC)
     99 # 	define GLUTAPI __declspec(dllexport)
    100 #elif !defined(GLUT_STATIC)
    101 #   define GLUTAPI __declspec(dllimport)
    102 #else
    103 #	define GLUTAPI extern
    104 #endif
    105 
    106 #elif defined(__GNUC__)
    107 
    108 #  define GLUTAPIENTRY
    109 #  define GLUTAPIENTRYV
    110 #  define GLUTCALLBACK
    111 #  define GLUTAPI extern __attribute__((visibility("default")))
    112 
    113 #else
    114 
    115 /* Define GLUTAPIENTRY and GLUTCALLBACK to nothing */
    116 #  define GLUTAPIENTRY
    117 #  define GLUTAPIENTRYV
    118 #  define GLUTCALLBACK
    119 #  define GLUTAPI extern
    120 
    121 #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!).
    144 
    145  GLUT_API_VERSION=5  glutGetProcAddress (added by BrianP)
    146 **/
    147 #ifndef GLUT_API_VERSION  /* allow this to be overriden */
    148 #define GLUT_API_VERSION		5
    149 #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 
    271 #if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
    272 /* 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). */
    288 GLUTAPI void *glutStrokeRoman;
    289 GLUTAPI 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). */
    296 GLUTAPI void *glutBitmap9By15;
    297 GLUTAPI void *glutBitmap8By13;
    298 GLUTAPI void *glutBitmapTimesRoman10;
    299 GLUTAPI void *glutBitmapTimesRoman24;
    300 GLUTAPI void *glutBitmapHelvetica10;
    301 GLUTAPI void *glutBitmapHelvetica12;
    302 GLUTAPI 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. */
    451 GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
    452 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
    453 GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
    454 #ifndef GLUT_BUILDING_LIB
    455 #define glutInit(__argcp, __argv) __glutInitWithExit(__argcp, __argv, exit)
    456 #endif
    457 #endif
    458 GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
    459 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
    460 GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
    461 #endif
    462 GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
    463 GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
    464 GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
    465 
    466 /* GLUT window sub-API. */
    467 GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
    468 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
    469 GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
    470 #ifndef GLUT_BUILDING_LIB
    471 #define glutCreateWindow(__title) __glutCreateWindowWithExit(__title, exit)
    472 #endif
    473 #endif
    474 GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
    475 GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
    476 GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
    477 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
    478 GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
    479 #endif
    480 GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
    481 GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
    482 GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
    483 GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
    484 GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
    485 GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
    486 GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
    487 GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
    488 GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
    489 GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
    490 GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
    491 GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
    492 #if (GLUT_API_VERSION >= 3)
    493 GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
    494 GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
    495 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
    496 GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
    497 #endif
    498 
    499 /* GLUT overlay sub-API. */
    500 GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
    501 GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
    502 GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
    503 GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
    504 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
    505 GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
    506 #endif
    507 GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
    508 GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
    509 #endif
    510 
    511 /* GLUT menu sub-API. */
    512 GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
    513 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
    514 GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
    515 #ifndef GLUT_BUILDING_LIB
    516 #define glutCreateMenu(__func) __glutCreateMenuWithExit(__func, exit)
    517 #endif
    518 #endif
    519 GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
    520 GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
    521 GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
    522 GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
    523 GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
    524 GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
    525 GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
    526 GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
    527 GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
    528 GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
    529 
    530 /* GLUT window callback sub-API. */
    531 GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
    532 GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
    533 GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
    534 GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
    535 GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
    536 GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
    537 GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
    538 GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
    539 GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
    540 GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
    541 GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
    542 #if (GLUT_API_VERSION >= 2)
    543 GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
    544 GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
    545 GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
    546 GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
    547 GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
    548 GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
    549 GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
    550 GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
    551 #if (GLUT_API_VERSION >= 3)
    552 GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
    553 GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
    554 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
    555 GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
    556 #endif
    557 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
    558 GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
    559 GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
    560 GLUTAPI 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. */
    566 GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue);
    567 GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
    568 GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
    569 
    570 /* GLUT state retrieval sub-API. */
    571 GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
    572 GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
    573 #if (GLUT_API_VERSION >= 2)
    574 /* GLUT extension support sub-API */
    575 GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
    576 #endif
    577 #if (GLUT_API_VERSION >= 3)
    578 GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
    579 GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
    580 #endif
    581 #if (GLUT_API_VERSION >= 5)
    582 typedef void (*GLUTproc)();
    583 GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName);
    584 #endif
    585 
    586 /* GLUT font sub-API */
    587 GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
    588 GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
    589 GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
    590 GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
    591 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
    592 GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
    593 GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
    594 #endif
    595 
    596 /* GLUT pre-built models sub-API */
    597 GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
    598 GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
    599 GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
    600 GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
    601 GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
    602 GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
    603 GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
    604 GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
    605 GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
    606 GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
    607 GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
    608 GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
    609 GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
    610 GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
    611 GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
    612 GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
    613 GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
    614 GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
    615 
    616 #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
    617 /* GLUT video resize sub-API. */
    618 GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
    619 GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
    620 GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
    621 GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
    622 GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
    623 
    624 /* GLUT debugging sub-API. */
    625 GLUTAPI 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 
    641 GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
    642 GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
    643 GLUTAPI 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 
    655 GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
    656 GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
    657 GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
    658 GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
    659 #endif
    660 
    661 #ifdef __cplusplus
    662 }
    663 #endif
    664 
    665 #endif                  /* __glut_h__ */
    666