Source code of Windows XP (NT5)
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.

305 lines
9.3 KiB

  1. #ifndef __glut_h__
  2. #define __glut_h__
  3. /* Copyright (c) Mark J. Kilgard, 1994. */
  4. /* This program is freely distributable without licensing fees
  5. and is provided without guarantee or warrantee expressed or
  6. implied. This 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. /*
  13. * GLUT API revision history:
  14. *
  15. * GLUT_API_VERSION is updated to reflect incompatible GLUT
  16. * API changes (interface changes, semantic changes, deletions,
  17. * or additions).
  18. *
  19. * GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
  20. *
  21. * GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
  22. * extension. Supports new input devices like tablet, dial and button
  23. * box, and Spaceball. Easy to query OpenGL extensions.
  24. *
  25. */
  26. #ifndef GLUT_API_VERSION /* allow this to be overriden */
  27. #define GLUT_API_VERSION 2
  28. #endif
  29. /*
  30. * GLUT implementation revision history:
  31. *
  32. * GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
  33. * API revisions and implementation revisions (ie, bug fixes).
  34. *
  35. * GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
  36. * GLUT Xlib-based implementation. 11/29/94
  37. *
  38. * GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
  39. * GLUT Xlib-based implementation providing GLUT version 2
  40. * interfaces.
  41. *
  42. * GLUT_WIN32_IMPLEMENTATION=2 Drew Bliss's addition of Win32 targeting,
  43. * supporting GLUT version 2 interfaces
  44. */
  45. #ifndef GLUT_XLIB_IMPLEMENTATION /* allow this to be overriden */
  46. #define GLUT_XLIB_IMPLEMENTATION 2
  47. #endif
  48. #ifndef GLUT_WIN32_IMPLEMENTATION /* allow this to be overriden */
  49. #define GLUT_WIN32_IMPLEMENTATION 2
  50. #endif
  51. /* display mode bit masks */
  52. #define GLUT_RGB 0
  53. #define GLUT_RGBA GLUT_RGB
  54. #define GLUT_INDEX 1
  55. #define GLUT_SINGLE 0
  56. #define GLUT_DOUBLE 2
  57. #define GLUT_ACCUM 4
  58. #define GLUT_ALPHA 8
  59. #define GLUT_DEPTH 16
  60. #define GLUT_STENCIL 32
  61. #if (GLUT_API_VERSION >= 2)
  62. #define GLUT_MULTISAMPLE 128
  63. #define GLUT_STEREO 256
  64. #endif
  65. /* mouse buttons */
  66. #define GLUT_LEFT_BUTTON 0
  67. #define GLUT_MIDDLE_BUTTON 1
  68. #define GLUT_RIGHT_BUTTON 2
  69. /* mouse button callback state */
  70. #define GLUT_DOWN 0
  71. #define GLUT_UP 1
  72. #if (GLUT_API_VERSION >= 2)
  73. /* function keys */
  74. #define GLUT_KEY_F1 1
  75. #define GLUT_KEY_F2 2
  76. #define GLUT_KEY_F3 3
  77. #define GLUT_KEY_F4 4
  78. #define GLUT_KEY_F5 5
  79. #define GLUT_KEY_F6 6
  80. #define GLUT_KEY_F7 7
  81. #define GLUT_KEY_F8 8
  82. #define GLUT_KEY_F9 9
  83. #define GLUT_KEY_F10 10
  84. #define GLUT_KEY_F11 11
  85. #define GLUT_KEY_F12 12
  86. /* directional keys */
  87. #define GLUT_KEY_LEFT 100
  88. #define GLUT_KEY_UP 101
  89. #define GLUT_KEY_RIGHT 102
  90. #define GLUT_KEY_DOWN 103
  91. #define GLUT_KEY_PAGE_UP 104
  92. #define GLUT_KEY_PAGE_DOWN 105
  93. #define GLUT_KEY_HOME 106
  94. #define GLUT_KEY_END 107
  95. #define GLUT_KEY_INSERT 108
  96. #endif
  97. /* entry/exit callback state */
  98. #define GLUT_LEFT 0
  99. #define GLUT_ENTERED 1
  100. /* menu usage callback state */
  101. #define GLUT_MENU_NOT_IN_USE 0
  102. #define GLUT_MENU_IN_USE 1
  103. /* visibility callback state */
  104. #define GLUT_NOT_VISIBLE 0
  105. #define GLUT_VISIBLE 1
  106. /* color index component selection values */
  107. #define GLUT_RED 0
  108. #define GLUT_GREEN 1
  109. #define GLUT_BLUE 2
  110. /* stroke font opaque addresses (use constants instead in source code) */
  111. extern void *glutStrokeRoman;
  112. extern void *glutStrokeMonoRoman;
  113. /* stroke font constants (use these in GLUT program) */
  114. #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
  115. #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
  116. /* bitmap font opaque addresses (use constants instead in source code) */
  117. extern void *glutBitmap9By15;
  118. extern void *glutBitmap8By13;
  119. extern void *glutBitmapTimesRoman10;
  120. extern void *glutBitmapTimesRoman24;
  121. /* bitmap font constants (use these in GLUT program) */
  122. #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
  123. #define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
  124. #define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
  125. #define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
  126. /* glutGet parameters */
  127. #define GLUT_WINDOW_X 100
  128. #define GLUT_WINDOW_Y 101
  129. #define GLUT_WINDOW_WIDTH 102
  130. #define GLUT_WINDOW_HEIGHT 103
  131. #define GLUT_WINDOW_BUFFER_SIZE 104
  132. #define GLUT_WINDOW_STENCIL_SIZE 105
  133. #define GLUT_WINDOW_DEPTH_SIZE 106
  134. #define GLUT_WINDOW_RED_SIZE 107
  135. #define GLUT_WINDOW_GREEN_SIZE 108
  136. #define GLUT_WINDOW_BLUE_SIZE 109
  137. #define GLUT_WINDOW_ALPHA_SIZE 110
  138. #define GLUT_WINDOW_ACCUM_RED_SIZE 111
  139. #define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
  140. #define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
  141. #define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
  142. #define GLUT_WINDOW_DOUBLEBUFFER 115
  143. #define GLUT_WINDOW_RGBA 116
  144. #define GLUT_WINDOW_PARENT 117
  145. #define GLUT_WINDOW_NUM_CHILDREN 118
  146. #define GLUT_WINDOW_COLORMAP_SIZE 119
  147. #if (GLUT_API_VERSION >= 2)
  148. #define GLUT_WINDOW_NUM_SAMPLES 120
  149. #define GLUT_WINDOW_STEREO 121
  150. #endif
  151. #define GLUT_SCREEN_WIDTH 200
  152. #define GLUT_SCREEN_HEIGHT 201
  153. #define GLUT_SCREEN_WIDTH_MM 202
  154. #define GLUT_SCREEN_HEIGHT_MM 203
  155. #define GLUT_MENU_NUM_ITEMS 300
  156. #define GLUT_DISPLAY_MODE_POSSIBLE 400
  157. #define GLUT_INIT_WINDOW_X 500
  158. #define GLUT_INIT_WINDOW_Y 501
  159. #define GLUT_INIT_WINDOW_WIDTH 502
  160. #define GLUT_INIT_WINDOW_HEIGHT 503
  161. #define GLUT_INIT_DISPLAY_MODE 504
  162. #define GLUT_ENTRY_CALLBACKS 505
  163. #if (GLUT_API_VERSION >= 2)
  164. #define GLUT_ELAPSED_TIME 700
  165. #endif
  166. #if (GLUT_API_VERSION >= 2)
  167. /* glutDeviceGet parameters */
  168. #define GLUT_HAS_KEYBOARD 600
  169. #define GLUT_HAS_MOUSE 601
  170. #define GLUT_HAS_SPACEBALL 602
  171. #define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
  172. #define GLUT_HAS_TABLET 604
  173. #define GLUT_NUM_MOUSE_BUTTONS 605
  174. #define GLUT_NUM_SPACEBALL_BUTTONS 606
  175. #define GLUT_NUM_BUTTON_BOX_BUTTONS 607
  176. #define GLUT_NUM_DIALS 608
  177. #define GLUT_NUM_TABLET_BUTTONS 609
  178. #endif
  179. /* GLUT initialization sub-API */
  180. extern void glutInit (int *, char **);
  181. extern void glutInitDisplayMode (unsigned long);
  182. extern void glutInitWindowPosition (int, int);
  183. extern void glutInitWindowSize (int, int);
  184. extern void glutMainLoop (void);
  185. /* GLUT window sub-api */
  186. extern int glutCreateWindow (char *);
  187. extern int glutCreateSubWindow (int, int, int, int, int);
  188. extern void glutDestroyWindow (int);
  189. extern void glutPostRedisplay (void);
  190. extern void glutSwapBuffers (void);
  191. extern int glutGetWindow (void);
  192. extern void glutSetWindow (int);
  193. extern void glutSetWindowTitle (char *);
  194. extern void glutSetIconTitle (char *);
  195. extern void glutPositionWindow (int, int);
  196. extern void glutReshapeWindow (int, int);
  197. extern void glutPopWindow (void);
  198. extern void glutPushWindow (void);
  199. extern void glutIconifyWindow (void);
  200. extern void glutShowWindow (void);
  201. extern void glutHideWindow (void);
  202. /* GLUT menu sub-API */
  203. extern int glutCreateMenu (void (*)(int));
  204. extern void glutDestroyMenu (int);
  205. extern int glutGetMenu (void);
  206. extern void glutSetMenu (int);
  207. extern void glutAddMenuEntry (char *, int);
  208. extern void glutAddSubMenu (char *, int);
  209. extern void glutChangeToMenuEntry (int, char *, int);
  210. extern void glutChangeToSubMenu (int, char *, int);
  211. extern void glutRemoveMenuItem (int);
  212. extern void glutAttachMenu (int);
  213. extern void glutDetachMenu (int);
  214. /* GLUT callback sub-api */
  215. extern void glutDisplayFunc (void (*)(void));
  216. extern void glutReshapeFunc (void (*)(int, int));
  217. extern void glutKeyboardFunc (void (*)(unsigned char, int, int));
  218. extern void glutMouseFunc (void (*)(int, int, int, int));
  219. extern void glutMotionFunc (void (*)(int, int));
  220. extern void glutPassiveMotionFunc (void (*)(int, int));
  221. extern void glutEntryFunc (void (*)(int));
  222. extern void glutVisibilityFunc (void (*)(int));
  223. extern void glutIdleFunc (void (*)(void));
  224. extern void glutTimerFunc (unsigned long, void (*)(int), int);
  225. extern void glutMenuStateFunc (void (*)(int));
  226. #if (GLUT_API_VERSION >= 2)
  227. extern void glutSpecialFunc (void (*)(int, int, int));
  228. extern void glutSpaceballMotionFunc (void (*)(int, int, int));
  229. extern void glutSpaceballRotateFunc (void (*)(int, int, int));
  230. extern void glutSpaceballButtonFunc (void (*)(int, int));
  231. extern void glutButtonBoxFunc (void (*)(int, int));
  232. extern void glutDialsFunc (void (*)(int, int));
  233. extern void glutTabletMotionFunc (void (*)(int, int));
  234. extern void glutTabletButtonFunc (void (*)(int, int, int, int));
  235. #endif
  236. /* GLUT color index sub-api */
  237. extern void glutSetColor (int, GLfloat, GLfloat, GLfloat);
  238. extern GLfloat glutGetColor (int, int);
  239. extern void glutCopyColormap (int);
  240. /* GLUT state retrieval sub-api */
  241. extern int glutGet (GLenum);
  242. extern int glutDeviceGet (GLenum);
  243. /* GLUT font sub-API */
  244. extern void glutStrokeCharacter (void *, int);
  245. extern void glutBitmapCharacter (void *, int);
  246. /* GLUT pre-built models sub-API */
  247. extern void glutWireSphere (GLdouble, GLint, GLint);
  248. extern void glutSolidSphere (GLdouble, GLint, GLint);
  249. extern void glutWireCone (GLdouble, GLdouble, GLint, GLint);
  250. extern void glutSolidCone (GLdouble, GLdouble, GLint, GLint);
  251. extern void glutWireCube (GLdouble);
  252. extern void glutSolidCube (GLdouble);
  253. extern void glutWireTorus (GLdouble, GLdouble, GLint, GLint);
  254. extern void glutSolidTorus (GLdouble, GLdouble, GLint, GLint);
  255. extern void glutWireDodecahedron (void);
  256. extern void glutSolidDodecahedron (void);
  257. extern void glutWireTeapot (GLdouble);
  258. extern void glutSolidTeapot (GLdouble);
  259. extern void glutWireOctahedron (void);
  260. extern void glutSolidOctahedron (void);
  261. extern void glutWireTetrahedron (void);
  262. extern void glutSolidTetrahedron (void);
  263. extern void glutWireIcosahedron (void);
  264. extern void glutSolidIcosahedron (void);
  265. #if (GLUT_API_VERSION >= 2)
  266. /* GLUT extension support sub-API */
  267. extern int glutExtensionSupported (char *);
  268. #endif
  269. #ifdef __cplusplus
  270. }
  271. #endif
  272. #endif /* __glut_h__ */