932a16ba6316df949092120ce1aad4e406f4948f
[freeglut] / include / GL / freeglut_ext.h
1 #ifndef  __FREEGLUT_EXT_H__
2 #define  __FREEGLUT_EXT_H__
3
4 /*
5  * freeglut_ext.h
6  *
7  * The non-GLUT-compatible extensions to 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  * Additional GLUT Key definitions for the Special key function
37  */
38 #define GLUT_KEY_NUM_LOCK           0x006D
39 #define GLUT_KEY_BEGIN              0x006E
40 #define GLUT_KEY_DELETE             0x006F
41 #define GLUT_KEY_SHIFT_L            0x0070
42 #define GLUT_KEY_SHIFT_R            0x0071
43 #define GLUT_KEY_CTRL_L             0x0072
44 #define GLUT_KEY_CTRL_R             0x0073
45 #define GLUT_KEY_ALT_L              0x0074
46 #define GLUT_KEY_ALT_R              0x0075
47
48 /*
49  * GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
50  */
51 #define GLUT_ACTION_EXIT                         0
52 #define GLUT_ACTION_GLUTMAINLOOP_RETURNS         1
53 #define GLUT_ACTION_CONTINUE_EXECUTION           2
54
55 /*
56  * Create a new rendering context when the user opens a new window?
57  */
58 #define GLUT_CREATE_NEW_CONTEXT                  0
59 #define GLUT_USE_CURRENT_CONTEXT                 1
60
61 /*
62  * Direct/Indirect rendering context options (has meaning only in Unix/X11)
63  */
64 #define GLUT_FORCE_INDIRECT_CONTEXT              0
65 #define GLUT_ALLOW_DIRECT_CONTEXT                1
66 #define GLUT_TRY_DIRECT_CONTEXT                  2
67 #define GLUT_FORCE_DIRECT_CONTEXT                3
68
69 /*
70  * GLUT API Extension macro definitions -- the glutGet parameters
71  */
72 #define  GLUT_INIT_STATE                    0x007C
73
74 #define  GLUT_ACTION_ON_WINDOW_CLOSE        0x01F9
75
76 #define  GLUT_WINDOW_BORDER_WIDTH           0x01FA
77 #define  GLUT_WINDOW_BORDER_HEIGHT          0x01FB
78 #define  GLUT_WINDOW_HEADER_HEIGHT          0x01FB  /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
79
80 #define  GLUT_VERSION                       0x01FC
81
82 #define  GLUT_RENDERING_CONTEXT             0x01FD
83 #define  GLUT_DIRECT_RENDERING              0x01FE
84
85 #define  GLUT_FULL_SCREEN                   0x01FF
86
87 #define  GLUT_SKIP_STALE_MOTION_EVENTS      0x0204
88
89 #define  GLUT_GEOMETRY_VISUALIZE_NORMALS    0x0205
90
91 #define  GLUT_STROKE_FONT_DRAW_JOIN_DOTS    0x0206  /* Draw dots between line segments of stroke fonts? */
92
93 #define  GLUT_ALLOW_NEGATIVE_WINDOW_POSITION 0x0207 /* GLUT doesn't allow negative window positions by default */
94
95 #define  GLUT_WINDOW_SRGB                   0x007D
96
97 /*
98  * New tokens for glutInitDisplayMode.
99  * Only one GLUT_AUXn bit may be used at a time.
100  * Value 0x0400 is defined in OpenGLUT.
101  */
102 #define  GLUT_AUX                           0x1000
103
104 #define  GLUT_AUX1                          0x1000
105 #define  GLUT_AUX2                          0x2000
106 #define  GLUT_AUX3                          0x4000
107 #define  GLUT_AUX4                          0x8000
108
109 /*
110  * Context-related flags, see fg_state.c
111  * Set the requested OpenGL version
112  */
113 #define  GLUT_INIT_MAJOR_VERSION            0x0200
114 #define  GLUT_INIT_MINOR_VERSION            0x0201
115 #define  GLUT_INIT_FLAGS                    0x0202
116 #define  GLUT_INIT_PROFILE                  0x0203
117
118 /*
119  * Flags for glutInitContextFlags, see fg_init.c
120  */
121 #define  GLUT_DEBUG                         0x0001
122 #define  GLUT_FORWARD_COMPATIBLE            0x0002
123
124
125 /*
126  * Flags for glutInitContextProfile, see fg_init.c
127  */
128 #define GLUT_CORE_PROFILE                   0x0001
129 #define GLUT_COMPATIBILITY_PROFILE          0x0002
130
131 /*
132 * GLUT API Extension macro definitions -- Spaceball button definitions
133 */
134
135 #define  GLUT_SPACEBALL_BUTTON_A            0x0001
136 #define  GLUT_SPACEBALL_BUTTON_B            0x0002
137 #define  GLUT_SPACEBALL_BUTTON_C            0x0004
138 #define  GLUT_SPACEBALL_BUTTON_D            0x0008
139 #define  GLUT_SPACEBALL_BUTTON_E            0x0010
140
141 /*
142  * Process loop function, see fg_main.c
143  */
144 FGAPI void    FGAPIENTRY glutMainLoopEvent( void );
145 FGAPI void    FGAPIENTRY glutLeaveMainLoop( void );
146 FGAPI void    FGAPIENTRY glutExit         ( void );
147
148 /*
149  * Window management functions, see fg_window.c
150  */
151 FGAPI void    FGAPIENTRY glutFullScreenToggle( void );
152 FGAPI void    FGAPIENTRY glutLeaveFullScreen( void );
153
154 /*
155  * Menu functions
156  */
157 FGAPI void    FGAPIENTRY glutSetMenuFont( int menuID, void* font );
158
159 /*
160  * Window-specific callback functions, see fg_callbacks.c
161  */
162 FGAPI void    FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
163 FGAPI void    FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
164 FGAPI void    FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
165 FGAPI void    FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
166 /* And also a destruction callback for menus */
167 FGAPI void    FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
168
169 /*
170  * State setting and retrieval functions, see fg_state.c
171  */
172 FGAPI void    FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
173 FGAPI int *   FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
174 /* A.Donev: User-data manipulation */
175 FGAPI void*   FGAPIENTRY glutGetWindowData( void );
176 FGAPI void    FGAPIENTRY glutSetWindowData(void* data);
177 FGAPI void*   FGAPIENTRY glutGetMenuData( void );
178 FGAPI void    FGAPIENTRY glutSetMenuData(void* data);
179
180 /*
181  * Font stuff, see fg_font.c
182  */
183 FGAPI int     FGAPIENTRY glutBitmapHeight( void* font );
184 FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
185 FGAPI void    FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
186 FGAPI void    FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
187
188 /*
189  * Geometry functions, see fg_geometry.c
190  */
191 FGAPI void    FGAPIENTRY glutWireRhombicDodecahedron( void );
192 FGAPI void    FGAPIENTRY glutSolidRhombicDodecahedron( void );
193 FGAPI void    FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
194 FGAPI void    FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
195 FGAPI void    FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
196 FGAPI void    FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
197
198 /*
199  * Rest of functions for rendering Newell's teaset, found in fg_teapot.c
200  * NB: front facing polygons have clockwise winding, not counter clockwise
201  */
202 FGAPI void    FGAPIENTRY glutWireTeacup( double size );
203 FGAPI void    FGAPIENTRY glutSolidTeacup( double size );
204 FGAPI void    FGAPIENTRY glutWireTeaspoon( double size );
205 FGAPI void    FGAPIENTRY glutSolidTeaspoon( double size );
206
207 /*
208  * Extension functions, see fg_ext.c
209  */
210 typedef void (*GLUTproc)();
211 FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
212
213 /*
214  * Multi-touch/multi-pointer extensions
215  */
216
217 #define GLUT_HAS_MULTI 1
218
219 /* TODO: add device_id parameter,
220    cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
221 FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
222 FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
223 FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
224 FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
225
226 /*
227  * Joystick functions, see fg_joystick.c
228  */
229 /* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
230 /* If you have a serious need for these functions in your application, please either
231  * contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
232  * switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
233  * "js" library.
234  */
235 int     glutJoystickGetNumAxes( int ident );
236 int     glutJoystickGetNumButtons( int ident );
237 int     glutJoystickNotWorking( int ident );
238 float   glutJoystickGetDeadBand( int ident, int axis );
239 void    glutJoystickSetDeadBand( int ident, int axis, float db );
240 float   glutJoystickGetSaturation( int ident, int axis );
241 void    glutJoystickSetSaturation( int ident, int axis, float st );
242 void    glutJoystickSetMinRange( int ident, float *axes );
243 void    glutJoystickSetMaxRange( int ident, float *axes );
244 void    glutJoystickSetCenter( int ident, float *axes );
245 void    glutJoystickGetMinRange( int ident, float *axes );
246 void    glutJoystickGetMaxRange( int ident, float *axes );
247 void    glutJoystickGetCenter( int ident, float *axes );
248
249 /*
250  * Initialization functions, see fg_init.c
251  */
252 /* to get the typedef for va_list */
253 #include <stdarg.h>
254 FGAPI void    FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
255 FGAPI void    FGAPIENTRY glutInitContextFlags( int flags );
256 FGAPI void    FGAPIENTRY glutInitContextProfile( int profile );
257 FGAPI void    FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
258 FGAPI void    FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
259
260 /* OpenGL >= 2.0 support */
261 FGAPI void    FGAPIENTRY glutSetVertexAttribCoord3( GLint attrib );
262 FGAPI void    FGAPIENTRY glutSetVertexAttribNormal( GLint attrib );
263 FGAPI void    FGAPIENTRY glutSetVertexAttribTexCoord2( GLint attrib );
264
265 /* Mobile platforms lifecycle */
266 FGAPI void    FGAPIENTRY glutInitContextFunc( void (* callback)( void ) );
267 FGAPI void    FGAPIENTRY glutAppStatusFunc( void (* callback)( int ) );
268 /* state flags that can be passed to callback set by glutAppStatusFunc */
269 #define GLUT_APPSTATUS_PAUSE                0x0001
270 #define GLUT_APPSTATUS_RESUME               0x0002
271
272 /*
273  * GLUT API macro definitions -- the display mode definitions
274  */
275 #define  GLUT_CAPTIONLESS                   0x0400
276 #define  GLUT_BORDERLESS                    0x0800
277 #define  GLUT_SRGB                          0x1000
278
279 /* User-argument callbacks and implementation */
280 #include "freeglut_ucall.h"
281
282 #ifdef __cplusplus
283     }
284 #endif
285
286 /*** END OF FILE ***/
287
288 #endif /* __FREEGLUT_EXT_H__ */