freeglut_std.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. #ifndef __FREEGLUT_STD_H__
  2. #define __FREEGLUT_STD_H__
  3. /*
  4. * freeglut_std.h
  5. *
  6. * The GLUT-compatible part of the freeglut library include file
  7. *
  8. * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
  9. * Written by Pawel W. Olszta, <olszta@sourceforge.net>
  10. * Creation date: Thu Dec 2 1999
  11. *
  12. * Permission is hereby granted, free of charge, to any person obtaining a
  13. * copy of this software and associated documentation files (the "Software"),
  14. * to deal in the Software without restriction, including without limitation
  15. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  16. * and/or sell copies of the Software, and to permit persons to whom the
  17. * Software is furnished to do so, subject to the following conditions:
  18. *
  19. * The above copyright notice and this permission notice shall be included
  20. * in all copies or substantial portions of the Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  23. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  25. * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. */
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /*
  33. * Under windows, we have to differentiate between static and dynamic libraries
  34. */
  35. #ifdef _WIN32
  36. /* #pragma may not be supported by some compilers.
  37. * Discussion by FreeGLUT developers suggests that
  38. * Visual C++ specific code involving pragmas may
  39. * need to move to a separate header. 24th Dec 2003
  40. */
  41. /* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
  42. * pragmas or to 0 to exclude library pragmas.
  43. * The default behavior depends on the compiler/platform.
  44. */
  45. # ifndef FREEGLUT_LIB_PRAGMAS
  46. # if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
  47. # define FREEGLUT_LIB_PRAGMAS 1
  48. # else
  49. # define FREEGLUT_LIB_PRAGMAS 0
  50. # endif
  51. # endif
  52. # ifndef WIN32_LEAN_AND_MEAN
  53. # define WIN32_LEAN_AND_MEAN 1
  54. # endif
  55. # ifndef NOMINMAX
  56. # define NOMINMAX
  57. # endif
  58. # include <windows.h>
  59. /* Windows static library */
  60. # ifdef FREEGLUT_STATIC
  61. # define FGAPI
  62. # define FGAPIENTRY
  63. /* Link with Win32 static freeglut lib */
  64. # if FREEGLUT_LIB_PRAGMAS
  65. # ifdef NDEBUG
  66. # pragma comment (lib, "freeglut_static.lib")
  67. # else
  68. # pragma comment (lib, "freeglut_staticd.lib")
  69. # endif
  70. # endif
  71. /* Windows shared library (DLL) */
  72. # else
  73. # define FGAPIENTRY __stdcall
  74. # if defined(FREEGLUT_EXPORTS)
  75. # define FGAPI __declspec(dllexport)
  76. # else
  77. # define FGAPI __declspec(dllimport)
  78. /* Link with Win32 shared freeglut lib */
  79. # if FREEGLUT_LIB_PRAGMAS
  80. # ifdef NDEBUG
  81. # pragma comment (lib, "freeglut.lib")
  82. # else
  83. # pragma comment (lib, "freeglutd.lib")
  84. # endif
  85. # endif
  86. # endif
  87. # endif
  88. /* Drag in other Windows libraries as required by FreeGLUT */
  89. # if FREEGLUT_LIB_PRAGMAS
  90. # pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
  91. # pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
  92. # pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
  93. # pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
  94. # pragma comment (lib, "user32.lib") /* link Windows user lib */
  95. # endif
  96. #else
  97. /* Non-Windows definition of FGAPI and FGAPIENTRY */
  98. # define FGAPI
  99. # define FGAPIENTRY
  100. #endif
  101. /*
  102. * The freeglut and GLUT API versions
  103. */
  104. #define FREEGLUT 1
  105. #define GLUT_API_VERSION 6
  106. #define GLUT_XLIB_IMPLEMENTATION 13
  107. /* Deprecated:
  108. cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
  109. #define FREEGLUT_VERSION_2_0 1
  110. /*
  111. * Always include OpenGL and GLU headers
  112. */
  113. /* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers
  114. inclusion here; use GLES constants directly
  115. (e.g. GL_ES_VERSION_2_0) for all other needs */
  116. #ifdef FREEGLUT_GLES
  117. # include <EGL/egl.h>
  118. # include <GLES/gl.h>
  119. # include <GLES2/gl2.h>
  120. #elif __APPLE__
  121. # include <OpenGL/gl.h>
  122. # include <OpenGL/glu.h>
  123. #else
  124. # include <GL/gl.h>
  125. # include <GL/glu.h>
  126. #endif
  127. /*
  128. * GLUT API macro definitions -- the special key codes:
  129. */
  130. #define GLUT_KEY_F1 0x0001
  131. #define GLUT_KEY_F2 0x0002
  132. #define GLUT_KEY_F3 0x0003
  133. #define GLUT_KEY_F4 0x0004
  134. #define GLUT_KEY_F5 0x0005
  135. #define GLUT_KEY_F6 0x0006
  136. #define GLUT_KEY_F7 0x0007
  137. #define GLUT_KEY_F8 0x0008
  138. #define GLUT_KEY_F9 0x0009
  139. #define GLUT_KEY_F10 0x000A
  140. #define GLUT_KEY_F11 0x000B
  141. #define GLUT_KEY_F12 0x000C
  142. #define GLUT_KEY_LEFT 0x0064
  143. #define GLUT_KEY_UP 0x0065
  144. #define GLUT_KEY_RIGHT 0x0066
  145. #define GLUT_KEY_DOWN 0x0067
  146. #define GLUT_KEY_PAGE_UP 0x0068
  147. #define GLUT_KEY_PAGE_DOWN 0x0069
  148. #define GLUT_KEY_HOME 0x006A
  149. #define GLUT_KEY_END 0x006B
  150. #define GLUT_KEY_INSERT 0x006C
  151. /*
  152. * GLUT API macro definitions -- mouse state definitions
  153. */
  154. #define GLUT_LEFT_BUTTON 0x0000
  155. #define GLUT_MIDDLE_BUTTON 0x0001
  156. #define GLUT_RIGHT_BUTTON 0x0002
  157. #define GLUT_DOWN 0x0000
  158. #define GLUT_UP 0x0001
  159. #define GLUT_LEFT 0x0000
  160. #define GLUT_ENTERED 0x0001
  161. /*
  162. * GLUT API macro definitions -- the display mode definitions
  163. */
  164. #define GLUT_RGB 0x0000
  165. #define GLUT_RGBA 0x0000
  166. #define GLUT_INDEX 0x0001
  167. #define GLUT_SINGLE 0x0000
  168. #define GLUT_DOUBLE 0x0002
  169. #define GLUT_ACCUM 0x0004
  170. #define GLUT_ALPHA 0x0008
  171. #define GLUT_DEPTH 0x0010
  172. #define GLUT_STENCIL 0x0020
  173. #define GLUT_MULTISAMPLE 0x0080
  174. #define GLUT_STEREO 0x0100
  175. #define GLUT_LUMINANCE 0x0200
  176. /*
  177. * GLUT API macro definitions -- windows and menu related definitions
  178. */
  179. #define GLUT_MENU_NOT_IN_USE 0x0000
  180. #define GLUT_MENU_IN_USE 0x0001
  181. #define GLUT_NOT_VISIBLE 0x0000
  182. #define GLUT_VISIBLE 0x0001
  183. #define GLUT_HIDDEN 0x0000
  184. #define GLUT_FULLY_RETAINED 0x0001
  185. #define GLUT_PARTIALLY_RETAINED 0x0002
  186. #define GLUT_FULLY_COVERED 0x0003
  187. /*
  188. * GLUT API macro definitions -- fonts definitions
  189. *
  190. * Steve Baker suggested to make it binary compatible with GLUT:
  191. */
  192. #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
  193. # define GLUT_STROKE_ROMAN ((void *)0x0000)
  194. # define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
  195. # define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
  196. # define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
  197. # define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
  198. # define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
  199. # define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
  200. # define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
  201. # define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
  202. #else
  203. /*
  204. * I don't really know if it's a good idea... But here it goes:
  205. */
  206. extern void* glutStrokeRoman;
  207. extern void* glutStrokeMonoRoman;
  208. extern void* glutBitmap9By15;
  209. extern void* glutBitmap8By13;
  210. extern void* glutBitmapTimesRoman10;
  211. extern void* glutBitmapTimesRoman24;
  212. extern void* glutBitmapHelvetica10;
  213. extern void* glutBitmapHelvetica12;
  214. extern void* glutBitmapHelvetica18;
  215. /*
  216. * Those pointers will be used by following definitions:
  217. */
  218. # define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
  219. # define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
  220. # define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
  221. # define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
  222. # define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
  223. # define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
  224. # define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
  225. # define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
  226. # define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
  227. #endif
  228. /*
  229. * GLUT API macro definitions -- the glutGet parameters
  230. */
  231. #define GLUT_WINDOW_X 0x0064
  232. #define GLUT_WINDOW_Y 0x0065
  233. #define GLUT_WINDOW_WIDTH 0x0066
  234. #define GLUT_WINDOW_HEIGHT 0x0067
  235. #define GLUT_WINDOW_BUFFER_SIZE 0x0068
  236. #define GLUT_WINDOW_STENCIL_SIZE 0x0069
  237. #define GLUT_WINDOW_DEPTH_SIZE 0x006A
  238. #define GLUT_WINDOW_RED_SIZE 0x006B
  239. #define GLUT_WINDOW_GREEN_SIZE 0x006C
  240. #define GLUT_WINDOW_BLUE_SIZE 0x006D
  241. #define GLUT_WINDOW_ALPHA_SIZE 0x006E
  242. #define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
  243. #define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
  244. #define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
  245. #define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
  246. #define GLUT_WINDOW_DOUBLEBUFFER 0x0073
  247. #define GLUT_WINDOW_RGBA 0x0074
  248. #define GLUT_WINDOW_PARENT 0x0075
  249. #define GLUT_WINDOW_NUM_CHILDREN 0x0076
  250. #define GLUT_WINDOW_COLORMAP_SIZE 0x0077
  251. #define GLUT_WINDOW_NUM_SAMPLES 0x0078
  252. #define GLUT_WINDOW_STEREO 0x0079
  253. #define GLUT_WINDOW_CURSOR 0x007A
  254. #define GLUT_SCREEN_WIDTH 0x00C8
  255. #define GLUT_SCREEN_HEIGHT 0x00C9
  256. #define GLUT_SCREEN_WIDTH_MM 0x00CA
  257. #define GLUT_SCREEN_HEIGHT_MM 0x00CB
  258. #define GLUT_MENU_NUM_ITEMS 0x012C
  259. #define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
  260. #define GLUT_INIT_WINDOW_X 0x01F4
  261. #define GLUT_INIT_WINDOW_Y 0x01F5
  262. #define GLUT_INIT_WINDOW_WIDTH 0x01F6
  263. #define GLUT_INIT_WINDOW_HEIGHT 0x01F7
  264. #define GLUT_INIT_DISPLAY_MODE 0x01F8
  265. #define GLUT_ELAPSED_TIME 0x02BC
  266. #define GLUT_WINDOW_FORMAT_ID 0x007B
  267. /*
  268. * GLUT API macro definitions -- the glutDeviceGet parameters
  269. */
  270. #define GLUT_HAS_KEYBOARD 0x0258
  271. #define GLUT_HAS_MOUSE 0x0259
  272. #define GLUT_HAS_SPACEBALL 0x025A
  273. #define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
  274. #define GLUT_HAS_TABLET 0x025C
  275. #define GLUT_NUM_MOUSE_BUTTONS 0x025D
  276. #define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
  277. #define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
  278. #define GLUT_NUM_DIALS 0x0260
  279. #define GLUT_NUM_TABLET_BUTTONS 0x0261
  280. #define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
  281. #define GLUT_DEVICE_KEY_REPEAT 0x0263
  282. #define GLUT_HAS_JOYSTICK 0x0264
  283. #define GLUT_OWNS_JOYSTICK 0x0265
  284. #define GLUT_JOYSTICK_BUTTONS 0x0266
  285. #define GLUT_JOYSTICK_AXES 0x0267
  286. #define GLUT_JOYSTICK_POLL_RATE 0x0268
  287. /*
  288. * GLUT API macro definitions -- the glutLayerGet parameters
  289. */
  290. #define GLUT_OVERLAY_POSSIBLE 0x0320
  291. #define GLUT_LAYER_IN_USE 0x0321
  292. #define GLUT_HAS_OVERLAY 0x0322
  293. #define GLUT_TRANSPARENT_INDEX 0x0323
  294. #define GLUT_NORMAL_DAMAGED 0x0324
  295. #define GLUT_OVERLAY_DAMAGED 0x0325
  296. /*
  297. * GLUT API macro definitions -- the glutVideoResizeGet parameters
  298. */
  299. #define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
  300. #define GLUT_VIDEO_RESIZE_IN_USE 0x0385
  301. #define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
  302. #define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
  303. #define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
  304. #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
  305. #define GLUT_VIDEO_RESIZE_X 0x038A
  306. #define GLUT_VIDEO_RESIZE_Y 0x038B
  307. #define GLUT_VIDEO_RESIZE_WIDTH 0x038C
  308. #define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
  309. /*
  310. * GLUT API macro definitions -- the glutUseLayer parameters
  311. */
  312. #define GLUT_NORMAL 0x0000
  313. #define GLUT_OVERLAY 0x0001
  314. /*
  315. * GLUT API macro definitions -- the glutGetModifiers parameters
  316. */
  317. #define GLUT_ACTIVE_SHIFT 0x0001
  318. #define GLUT_ACTIVE_CTRL 0x0002
  319. #define GLUT_ACTIVE_ALT 0x0004
  320. /*
  321. * GLUT API macro definitions -- the glutSetCursor parameters
  322. */
  323. #define GLUT_CURSOR_RIGHT_ARROW 0x0000
  324. #define GLUT_CURSOR_LEFT_ARROW 0x0001
  325. #define GLUT_CURSOR_INFO 0x0002
  326. #define GLUT_CURSOR_DESTROY 0x0003
  327. #define GLUT_CURSOR_HELP 0x0004
  328. #define GLUT_CURSOR_CYCLE 0x0005
  329. #define GLUT_CURSOR_SPRAY 0x0006
  330. #define GLUT_CURSOR_WAIT 0x0007
  331. #define GLUT_CURSOR_TEXT 0x0008
  332. #define GLUT_CURSOR_CROSSHAIR 0x0009
  333. #define GLUT_CURSOR_UP_DOWN 0x000A
  334. #define GLUT_CURSOR_LEFT_RIGHT 0x000B
  335. #define GLUT_CURSOR_TOP_SIDE 0x000C
  336. #define GLUT_CURSOR_BOTTOM_SIDE 0x000D
  337. #define GLUT_CURSOR_LEFT_SIDE 0x000E
  338. #define GLUT_CURSOR_RIGHT_SIDE 0x000F
  339. #define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
  340. #define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
  341. #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
  342. #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
  343. #define GLUT_CURSOR_INHERIT 0x0064
  344. #define GLUT_CURSOR_NONE 0x0065
  345. #define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
  346. /*
  347. * GLUT API macro definitions -- RGB color component specification definitions
  348. */
  349. #define GLUT_RED 0x0000
  350. #define GLUT_GREEN 0x0001
  351. #define GLUT_BLUE 0x0002
  352. /*
  353. * GLUT API macro definitions -- additional keyboard and joystick definitions
  354. */
  355. #define GLUT_KEY_REPEAT_OFF 0x0000
  356. #define GLUT_KEY_REPEAT_ON 0x0001
  357. #define GLUT_KEY_REPEAT_DEFAULT 0x0002
  358. #define GLUT_JOYSTICK_BUTTON_A 0x0001
  359. #define GLUT_JOYSTICK_BUTTON_B 0x0002
  360. #define GLUT_JOYSTICK_BUTTON_C 0x0004
  361. #define GLUT_JOYSTICK_BUTTON_D 0x0008
  362. /*
  363. * GLUT API macro definitions -- game mode definitions
  364. */
  365. #define GLUT_GAME_MODE_ACTIVE 0x0000
  366. #define GLUT_GAME_MODE_POSSIBLE 0x0001
  367. #define GLUT_GAME_MODE_WIDTH 0x0002
  368. #define GLUT_GAME_MODE_HEIGHT 0x0003
  369. #define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
  370. #define GLUT_GAME_MODE_REFRESH_RATE 0x0005
  371. #define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
  372. /*
  373. * Initialization functions, see fglut_init.c
  374. */
  375. FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
  376. FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
  377. FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
  378. FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
  379. FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
  380. /*
  381. * Process loop function, see fg_main.c
  382. */
  383. FGAPI void FGAPIENTRY glutMainLoop( void );
  384. /*
  385. * Window management functions, see fg_window.c
  386. */
  387. FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
  388. FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
  389. FGAPI void FGAPIENTRY glutDestroyWindow( int window );
  390. FGAPI void FGAPIENTRY glutSetWindow( int window );
  391. FGAPI int FGAPIENTRY glutGetWindow( void );
  392. FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
  393. FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
  394. FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
  395. FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
  396. FGAPI void FGAPIENTRY glutShowWindow( void );
  397. FGAPI void FGAPIENTRY glutHideWindow( void );
  398. FGAPI void FGAPIENTRY glutIconifyWindow( void );
  399. FGAPI void FGAPIENTRY glutPushWindow( void );
  400. FGAPI void FGAPIENTRY glutPopWindow( void );
  401. FGAPI void FGAPIENTRY glutFullScreen( void );
  402. /*
  403. * Display-related functions, see fg_display.c
  404. */
  405. FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
  406. FGAPI void FGAPIENTRY glutPostRedisplay( void );
  407. FGAPI void FGAPIENTRY glutSwapBuffers( void );
  408. /*
  409. * Mouse cursor functions, see fg_cursor.c
  410. */
  411. FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
  412. FGAPI void FGAPIENTRY glutSetCursor( int cursor );
  413. /*
  414. * Overlay stuff, see fg_overlay.c
  415. */
  416. FGAPI void FGAPIENTRY glutEstablishOverlay( void );
  417. FGAPI void FGAPIENTRY glutRemoveOverlay( void );
  418. FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
  419. FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
  420. FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
  421. FGAPI void FGAPIENTRY glutShowOverlay( void );
  422. FGAPI void FGAPIENTRY glutHideOverlay( void );
  423. /*
  424. * Menu stuff, see fg_menu.c
  425. */
  426. FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
  427. FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
  428. FGAPI int FGAPIENTRY glutGetMenu( void );
  429. FGAPI void FGAPIENTRY glutSetMenu( int menu );
  430. FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
  431. FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
  432. FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
  433. FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
  434. FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
  435. FGAPI void FGAPIENTRY glutAttachMenu( int button );
  436. FGAPI void FGAPIENTRY glutDetachMenu( int button );
  437. /*
  438. * Global callback functions, see fg_callbacks.c
  439. */
  440. FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
  441. FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
  442. /*
  443. * Window-specific callback functions, see fg_callbacks.c
  444. */
  445. FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
  446. FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
  447. FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
  448. FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
  449. FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
  450. FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
  451. FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
  452. FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
  453. FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
  454. FGAPI void FGAPIENTRY glutKeyboardDownFunc( void (* callback)( unsigned char, int, int ) );
  455. FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
  456. FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
  457. FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
  458. FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
  459. FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
  460. FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
  461. FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
  462. FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
  463. FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
  464. FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
  465. FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
  466. FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
  467. FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
  468. FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
  469. /*
  470. * State setting and retrieval functions, see fg_state.c
  471. */
  472. FGAPI int FGAPIENTRY glutGet( GLenum query );
  473. FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
  474. FGAPI int FGAPIENTRY glutGetModifiers( void );
  475. FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
  476. /*
  477. * Font stuff, see fg_font.c
  478. */
  479. FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
  480. FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
  481. FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
  482. FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
  483. FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
  484. FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
  485. FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
  486. FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
  487. /*
  488. * Geometry functions, see fg_geometry.c
  489. */
  490. FGAPI void FGAPIENTRY glutWireCube( double size );
  491. FGAPI void FGAPIENTRY glutSolidCube( double size );
  492. FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
  493. FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
  494. FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
  495. FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
  496. FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
  497. FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
  498. FGAPI void FGAPIENTRY glutWireDodecahedron( void );
  499. FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
  500. FGAPI void FGAPIENTRY glutWireOctahedron( void );
  501. FGAPI void FGAPIENTRY glutSolidOctahedron( void );
  502. FGAPI void FGAPIENTRY glutWireTetrahedron( void );
  503. FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
  504. FGAPI void FGAPIENTRY glutWireIcosahedron( void );
  505. FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
  506. /*
  507. * Teapot rendering functions, found in fg_teapot.c
  508. * NB: front facing polygons have clockwise winding, not counter clockwise
  509. */
  510. FGAPI void FGAPIENTRY glutWireTeapot( double size );
  511. FGAPI void FGAPIENTRY glutSolidTeapot( double size );
  512. /*
  513. * Game mode functions, see fg_gamemode.c
  514. */
  515. FGAPI void FGAPIENTRY glutGameModeString( const char* string );
  516. FGAPI int FGAPIENTRY glutEnterGameMode( void );
  517. FGAPI void FGAPIENTRY glutLeaveGameMode( void );
  518. FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
  519. /*
  520. * Video resize functions, see fg_videoresize.c
  521. */
  522. FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
  523. FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
  524. FGAPI void FGAPIENTRY glutStopVideoResizing( void );
  525. FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
  526. FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
  527. /*
  528. * Colormap functions, see fg_misc.c
  529. */
  530. FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
  531. FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
  532. FGAPI void FGAPIENTRY glutCopyColormap( int window );
  533. /*
  534. * Misc keyboard and joystick functions, see fg_misc.c
  535. */
  536. FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
  537. FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
  538. FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
  539. /*
  540. * Misc functions, see fg_misc.c
  541. */
  542. FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
  543. FGAPI void FGAPIENTRY glutReportErrors( void );
  544. /* Comment from glut.h of classic GLUT:
  545. Win32 has an annoying issue where there are multiple C run-time
  546. libraries (CRTs). If the executable is linked with a different CRT
  547. from the GLUT DLL, the GLUT DLL will not share the same CRT static
  548. data seen by the executable. In particular, atexit callbacks registered
  549. in the executable will not be called if GLUT calls its (different)
  550. exit routine). GLUT is typically built with the
  551. "/MD" option (the CRT with multithreading DLL support), but the Visual
  552. C++ linker default is "/ML" (the single threaded CRT).
  553. One workaround to this issue is requiring users to always link with
  554. the same CRT as GLUT is compiled with. That requires users supply a
  555. non-standard option. GLUT 3.7 has its own built-in workaround where
  556. the executable's "exit" function pointer is covertly passed to GLUT.
  557. GLUT then calls the executable's exit function pointer to ensure that
  558. any "atexit" calls registered by the application are called if GLUT
  559. needs to exit.
  560. Note that the __glut*WithExit routines should NEVER be called directly.
  561. To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
  562. /* to get the prototype for exit() */
  563. #include <stdlib.h>
  564. #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
  565. FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
  566. FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
  567. FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
  568. #ifndef FREEGLUT_BUILDING_LIB
  569. #if defined(__GNUC__)
  570. #define FGUNUSED __attribute__((unused))
  571. #else
  572. #define FGUNUSED
  573. #endif
  574. static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
  575. #define glutInit glutInit_ATEXIT_HACK
  576. static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
  577. #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
  578. static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
  579. #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
  580. #endif
  581. #endif
  582. #ifdef __cplusplus
  583. }
  584. #endif
  585. /*** END OF FILE ***/
  586. #endif /* __FREEGLUT_STD_H__ */