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 30KB

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