Clone of mesa.
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.

glut.h 29KB

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