glut.h 32 KB

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