You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

717 lines
26 KiB

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