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