ffi-opengl 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ #
2
+ # Based on OpenGL CodeColòny tutorial
3
+ # http://www.codecolony.de/
4
+ #
5
+
6
+ class SpinningCube
7
+ attr_accessor :light_diffuse, :light_position
8
+ attr_reader :max_frames
9
+
10
+ def initialize(max_frames = 0)
11
+ @x_rotated, @y_rotated, @z_rotated = 0.0, 0.0, 0.0
12
+ @frames, @max_frames = 0, max_frames
13
+ glut_init
14
+ end
15
+
16
+ def glut_init
17
+ glutInit(MemoryPointer.new(:int, 1).put_int(0, 0),
18
+ MemoryPointer.new(:pointer, 1).put_pointer(0, nil))
19
+ end
20
+
21
+ def display
22
+ glClear(GL_COLOR_BUFFER_BIT)
23
+ glLoadIdentity()
24
+ glTranslatef(0.0, 0.0, -5.0)
25
+ glRotatef(@x_rotated, 1.0, 0.0, 0.0)
26
+ glRotatef(@y_rotated, 0.0, 1.0, 0.0)
27
+ glRotatef(@z_rotated, 0.0, 0.0, 1.0)
28
+ glScalef(2.0, 1.0, 1.0)
29
+ glutSolidCube(1.0)
30
+ glFlush
31
+ glutSwapBuffers
32
+ exit if (@max_frames > 0 and (@frames += 1) > @max_frames)
33
+ end
34
+
35
+ def reshape(x, y)
36
+ exit if (y == 0 || x == 0)
37
+ glMatrixMode(GL_PROJECTION)
38
+ glLoadIdentity
39
+ gluPerspective(30.0, x / y, 0.5, 20.0)
40
+ glMatrixMode(GL_MODELVIEW)
41
+ glViewport(0, 0, x, y)
42
+ end
43
+
44
+ def idle
45
+ @x_rotated += 0.3
46
+ @y_rotated += 0.1
47
+ @z_rotated += -0.4
48
+ display
49
+ end
50
+
51
+ def start
52
+ glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
53
+ glutInitWindowSize(300, 300)
54
+ glutCreateWindow("Cube example")
55
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, @light_diffuse)
56
+ glLightfv(GL_LIGHT0, GL_POSITION, @light_position)
57
+ glEnable(GL_LIGHT0)
58
+ glEnable(GL_LIGHTING)
59
+ glEnable(GL_CULL_FACE)
60
+ glShadeModel(GL_SMOOTH)
61
+ glClearColor(0.0, 0.0, 0.0, 0.0)
62
+ glutDisplayFunc(method(:display).to_proc)
63
+ glutIdleFunc(method(:idle).to_proc)
64
+ glutReshapeFunc(method(:reshape).to_proc)
65
+ glutMainLoop
66
+ end
67
+ end
68
+
69
+ if __FILE__ == $0
70
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
71
+ require 'ffi-opengl'
72
+ include FFI, GL, GLU, GLUT
73
+ app = SpinningCube.new
74
+ app.light_diffuse = MemoryPointer.new(:float, 4).put_array_of_float(0, [1.0, 0.0, 0.0, 1.0])
75
+ app.light_position = MemoryPointer.new(:float, 4).put_array_of_float(0, [1.0, 1.0, 1.0, 0.0])
76
+ app.start
77
+ end
@@ -0,0 +1,577 @@
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
+ #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
39
+
40
+ /* #pragma may not be supported by some compilers.
41
+ * Discussion by FreeGLUT developers suggests that
42
+ * Visual C++ specific code involving pragmas may
43
+ * need to move to a separate header. 24th Dec 2003
44
+ */
45
+
46
+ # define WIN32_LEAN_AND_MEAN
47
+ # define NO_MIN_MAX
48
+ # include <windows.h>
49
+ # undef min
50
+ # undef max
51
+
52
+ /* Windows static library */
53
+ # ifdef FREEGLUT_STATIC
54
+
55
+ # define FGAPI
56
+ # define FGAPIENTRY
57
+
58
+ /* Link with Win32 static freeglut lib */
59
+ # if defined(_MSC_VER)
60
+ # pragma comment (lib, "freeglut_static.lib")
61
+ # endif
62
+
63
+ /* Windows shared library (DLL) */
64
+ # else
65
+
66
+ # if defined(FREEGLUT_EXPORTS)
67
+ # define FGAPI __declspec(dllexport)
68
+ # else
69
+ # define FGAPI __declspec(dllimport)
70
+
71
+ /* link with Win32 shared freeglut lib */
72
+ # if defined(_MSC_VER)
73
+ # ifndef _WIN32_WCE
74
+ # pragma comment (lib, "freeglut.lib")
75
+ # endif
76
+ # endif
77
+
78
+ # endif
79
+
80
+ # define FGAPIENTRY __stdcall
81
+
82
+ # endif
83
+
84
+ /* Drag in other Windows libraries as required by FreeGLUT */
85
+ # if defined(_MSC_VER)
86
+ # ifndef _WIN32_WCE
87
+ # pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
88
+ # pragma comment (lib, "user32.lib") /* link Windows user lib */
89
+ # pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
90
+ # pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
91
+ # pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
92
+ # endif /* _WIN32_WCE */
93
+ # endif
94
+
95
+ #else
96
+
97
+ /* Non-Windows definition of FGAPI and FGAPIENTRY */
98
+ # define FGAPI
99
+ # define FGAPIENTRY
100
+
101
+ #endif
102
+
103
+ /*
104
+ * The freeglut and GLUT API versions
105
+ */
106
+ #define FREEGLUT 1
107
+ #define GLUT_API_VERSION 4
108
+ #define FREEGLUT_VERSION_2_0 1
109
+ #define GLUT_XLIB_IMPLEMENTATION 13
110
+
111
+ /*
112
+ * Always include OpenGL and GLU headers
113
+ */
114
+ #include <GL/gl.h>
115
+ #include <GL/glu.h>
116
+
117
+ /*
118
+ * GLUT API macro definitions -- the special key codes:
119
+ */
120
+ #define GLUT_KEY_F1 0x0001
121
+ #define GLUT_KEY_F2 0x0002
122
+ #define GLUT_KEY_F3 0x0003
123
+ #define GLUT_KEY_F4 0x0004
124
+ #define GLUT_KEY_F5 0x0005
125
+ #define GLUT_KEY_F6 0x0006
126
+ #define GLUT_KEY_F7 0x0007
127
+ #define GLUT_KEY_F8 0x0008
128
+ #define GLUT_KEY_F9 0x0009
129
+ #define GLUT_KEY_F10 0x000A
130
+ #define GLUT_KEY_F11 0x000B
131
+ #define GLUT_KEY_F12 0x000C
132
+ #define GLUT_KEY_LEFT 0x0064
133
+ #define GLUT_KEY_UP 0x0065
134
+ #define GLUT_KEY_RIGHT 0x0066
135
+ #define GLUT_KEY_DOWN 0x0067
136
+ #define GLUT_KEY_PAGE_UP 0x0068
137
+ #define GLUT_KEY_PAGE_DOWN 0x0069
138
+ #define GLUT_KEY_HOME 0x006A
139
+ #define GLUT_KEY_END 0x006B
140
+ #define GLUT_KEY_INSERT 0x006C
141
+
142
+ /*
143
+ * GLUT API macro definitions -- mouse state definitions
144
+ */
145
+ #define GLUT_LEFT_BUTTON 0x0000
146
+ #define GLUT_MIDDLE_BUTTON 0x0001
147
+ #define GLUT_RIGHT_BUTTON 0x0002
148
+ #define GLUT_DOWN 0x0000
149
+ #define GLUT_UP 0x0001
150
+ #define GLUT_LEFT 0x0000
151
+ #define GLUT_ENTERED 0x0001
152
+
153
+ /*
154
+ * GLUT API macro definitions -- the display mode definitions
155
+ */
156
+ #define GLUT_RGB 0x0000
157
+ #define GLUT_RGBA 0x0000
158
+ #define GLUT_INDEX 0x0001
159
+ #define GLUT_SINGLE 0x0000
160
+ #define GLUT_DOUBLE 0x0002
161
+ #define GLUT_ACCUM 0x0004
162
+ #define GLUT_ALPHA 0x0008
163
+ #define GLUT_DEPTH 0x0010
164
+ #define GLUT_STENCIL 0x0020
165
+ #define GLUT_MULTISAMPLE 0x0080
166
+ #define GLUT_STEREO 0x0100
167
+ #define GLUT_LUMINANCE 0x0200
168
+
169
+ /*
170
+ * GLUT API macro definitions -- windows and menu related definitions
171
+ */
172
+ #define GLUT_MENU_NOT_IN_USE 0x0000
173
+ #define GLUT_MENU_IN_USE 0x0001
174
+ #define GLUT_NOT_VISIBLE 0x0000
175
+ #define GLUT_VISIBLE 0x0001
176
+ #define GLUT_HIDDEN 0x0000
177
+ #define GLUT_FULLY_RETAINED 0x0001
178
+ #define GLUT_PARTIALLY_RETAINED 0x0002
179
+ #define GLUT_FULLY_COVERED 0x0003
180
+
181
+ /*
182
+ * GLUT API macro definitions -- fonts definitions
183
+ *
184
+ * Steve Baker suggested to make it binary compatible with GLUT:
185
+ */
186
+ #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
187
+ # define GLUT_STROKE_ROMAN ((void *)0x0000)
188
+ # define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
189
+ # define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
190
+ # define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
191
+ # define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
192
+ # define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
193
+ # define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
194
+ # define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
195
+ # define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
196
+ #else
197
+ /*
198
+ * I don't really know if it's a good idea... But here it goes:
199
+ */
200
+ extern void* glutStrokeRoman;
201
+ extern void* glutStrokeMonoRoman;
202
+ extern void* glutBitmap9By15;
203
+ extern void* glutBitmap8By13;
204
+ extern void* glutBitmapTimesRoman10;
205
+ extern void* glutBitmapTimesRoman24;
206
+ extern void* glutBitmapHelvetica10;
207
+ extern void* glutBitmapHelvetica12;
208
+ extern void* glutBitmapHelvetica18;
209
+
210
+ /*
211
+ * Those pointers will be used by following definitions:
212
+ */
213
+ # define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
214
+ # define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
215
+ # define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
216
+ # define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
217
+ # define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
218
+ # define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
219
+ # define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
220
+ # define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
221
+ # define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
222
+ #endif
223
+
224
+ /*
225
+ * GLUT API macro definitions -- the glutGet parameters
226
+ */
227
+ #define GLUT_WINDOW_X 0x0064
228
+ #define GLUT_WINDOW_Y 0x0065
229
+ #define GLUT_WINDOW_WIDTH 0x0066
230
+ #define GLUT_WINDOW_HEIGHT 0x0067
231
+ #define GLUT_WINDOW_BUFFER_SIZE 0x0068
232
+ #define GLUT_WINDOW_STENCIL_SIZE 0x0069
233
+ #define GLUT_WINDOW_DEPTH_SIZE 0x006A
234
+ #define GLUT_WINDOW_RED_SIZE 0x006B
235
+ #define GLUT_WINDOW_GREEN_SIZE 0x006C
236
+ #define GLUT_WINDOW_BLUE_SIZE 0x006D
237
+ #define GLUT_WINDOW_ALPHA_SIZE 0x006E
238
+ #define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
239
+ #define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
240
+ #define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
241
+ #define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
242
+ #define GLUT_WINDOW_DOUBLEBUFFER 0x0073
243
+ #define GLUT_WINDOW_RGBA 0x0074
244
+ #define GLUT_WINDOW_PARENT 0x0075
245
+ #define GLUT_WINDOW_NUM_CHILDREN 0x0076
246
+ #define GLUT_WINDOW_COLORMAP_SIZE 0x0077
247
+ #define GLUT_WINDOW_NUM_SAMPLES 0x0078
248
+ #define GLUT_WINDOW_STEREO 0x0079
249
+ #define GLUT_WINDOW_CURSOR 0x007A
250
+
251
+ #define GLUT_SCREEN_WIDTH 0x00C8
252
+ #define GLUT_SCREEN_HEIGHT 0x00C9
253
+ #define GLUT_SCREEN_WIDTH_MM 0x00CA
254
+ #define GLUT_SCREEN_HEIGHT_MM 0x00CB
255
+ #define GLUT_MENU_NUM_ITEMS 0x012C
256
+ #define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
257
+ #define GLUT_INIT_WINDOW_X 0x01F4
258
+ #define GLUT_INIT_WINDOW_Y 0x01F5
259
+ #define GLUT_INIT_WINDOW_WIDTH 0x01F6
260
+ #define GLUT_INIT_WINDOW_HEIGHT 0x01F7
261
+ #define GLUT_INIT_DISPLAY_MODE 0x01F8
262
+ #define GLUT_ELAPSED_TIME 0x02BC
263
+ #define GLUT_WINDOW_FORMAT_ID 0x007B
264
+ #define GLUT_INIT_STATE 0x007C
265
+
266
+ /*
267
+ * GLUT API macro definitions -- the glutDeviceGet parameters
268
+ */
269
+ #define GLUT_HAS_KEYBOARD 0x0258
270
+ #define GLUT_HAS_MOUSE 0x0259
271
+ #define GLUT_HAS_SPACEBALL 0x025A
272
+ #define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
273
+ #define GLUT_HAS_TABLET 0x025C
274
+ #define GLUT_NUM_MOUSE_BUTTONS 0x025D
275
+ #define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
276
+ #define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
277
+ #define GLUT_NUM_DIALS 0x0260
278
+ #define GLUT_NUM_TABLET_BUTTONS 0x0261
279
+ #define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
280
+ #define GLUT_DEVICE_KEY_REPEAT 0x0263
281
+ #define GLUT_HAS_JOYSTICK 0x0264
282
+ #define GLUT_OWNS_JOYSTICK 0x0265
283
+ #define GLUT_JOYSTICK_BUTTONS 0x0266
284
+ #define GLUT_JOYSTICK_AXES 0x0267
285
+ #define GLUT_JOYSTICK_POLL_RATE 0x0268
286
+
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
+ /*
298
+ * GLUT API macro definitions -- the glutVideoResizeGet parameters
299
+ */
300
+ #define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
301
+ #define GLUT_VIDEO_RESIZE_IN_USE 0x0385
302
+ #define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
303
+ #define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
304
+ #define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
305
+ #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
306
+ #define GLUT_VIDEO_RESIZE_X 0x038A
307
+ #define GLUT_VIDEO_RESIZE_Y 0x038B
308
+ #define GLUT_VIDEO_RESIZE_WIDTH 0x038C
309
+ #define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
310
+
311
+ /*
312
+ * GLUT API macro definitions -- the glutUseLayer parameters
313
+ */
314
+ #define GLUT_NORMAL 0x0000
315
+ #define GLUT_OVERLAY 0x0001
316
+
317
+ /*
318
+ * GLUT API macro definitions -- the glutGetModifiers parameters
319
+ */
320
+ #define GLUT_ACTIVE_SHIFT 0x0001
321
+ #define GLUT_ACTIVE_CTRL 0x0002
322
+ #define GLUT_ACTIVE_ALT 0x0004
323
+
324
+ /*
325
+ * GLUT API macro definitions -- the glutSetCursor parameters
326
+ */
327
+ #define GLUT_CURSOR_RIGHT_ARROW 0x0000
328
+ #define GLUT_CURSOR_LEFT_ARROW 0x0001
329
+ #define GLUT_CURSOR_INFO 0x0002
330
+ #define GLUT_CURSOR_DESTROY 0x0003
331
+ #define GLUT_CURSOR_HELP 0x0004
332
+ #define GLUT_CURSOR_CYCLE 0x0005
333
+ #define GLUT_CURSOR_SPRAY 0x0006
334
+ #define GLUT_CURSOR_WAIT 0x0007
335
+ #define GLUT_CURSOR_TEXT 0x0008
336
+ #define GLUT_CURSOR_CROSSHAIR 0x0009
337
+ #define GLUT_CURSOR_UP_DOWN 0x000A
338
+ #define GLUT_CURSOR_LEFT_RIGHT 0x000B
339
+ #define GLUT_CURSOR_TOP_SIDE 0x000C
340
+ #define GLUT_CURSOR_BOTTOM_SIDE 0x000D
341
+ #define GLUT_CURSOR_LEFT_SIDE 0x000E
342
+ #define GLUT_CURSOR_RIGHT_SIDE 0x000F
343
+ #define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
344
+ #define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
345
+ #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
346
+ #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
347
+ #define GLUT_CURSOR_INHERIT 0x0064
348
+ #define GLUT_CURSOR_NONE 0x0065
349
+ #define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
350
+
351
+ /*
352
+ * GLUT API macro definitions -- RGB color component specification definitions
353
+ */
354
+ #define GLUT_RED 0x0000
355
+ #define GLUT_GREEN 0x0001
356
+ #define GLUT_BLUE 0x0002
357
+
358
+ /*
359
+ * GLUT API macro definitions -- additional keyboard and joystick definitions
360
+ */
361
+ #define GLUT_KEY_REPEAT_OFF 0x0000
362
+ #define GLUT_KEY_REPEAT_ON 0x0001
363
+ #define GLUT_KEY_REPEAT_DEFAULT 0x0002
364
+
365
+ #define GLUT_JOYSTICK_BUTTON_A 0x0001
366
+ #define GLUT_JOYSTICK_BUTTON_B 0x0002
367
+ #define GLUT_JOYSTICK_BUTTON_C 0x0004
368
+ #define GLUT_JOYSTICK_BUTTON_D 0x0008
369
+
370
+ /*
371
+ * GLUT API macro definitions -- game mode definitions
372
+ */
373
+ #define GLUT_GAME_MODE_ACTIVE 0x0000
374
+ #define GLUT_GAME_MODE_POSSIBLE 0x0001
375
+ #define GLUT_GAME_MODE_WIDTH 0x0002
376
+ #define GLUT_GAME_MODE_HEIGHT 0x0003
377
+ #define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
378
+ #define GLUT_GAME_MODE_REFRESH_RATE 0x0005
379
+ #define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
380
+
381
+ /*
382
+ * Initialization functions, see fglut_init.c
383
+ */
384
+ FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
385
+ FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
386
+ FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
387
+ FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
388
+ FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
389
+
390
+ /*
391
+ * Process loop function, see freeglut_main.c
392
+ */
393
+ FGAPI void FGAPIENTRY glutMainLoop( void );
394
+
395
+ /*
396
+ * Window management functions, see freeglut_window.c
397
+ */
398
+ FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
399
+ FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
400
+ FGAPI void FGAPIENTRY glutDestroyWindow( int window );
401
+ FGAPI void FGAPIENTRY glutSetWindow( int window );
402
+ FGAPI int FGAPIENTRY glutGetWindow( void );
403
+ FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
404
+ FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
405
+ FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
406
+ FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
407
+ FGAPI void FGAPIENTRY glutShowWindow( void );
408
+ FGAPI void FGAPIENTRY glutHideWindow( void );
409
+ FGAPI void FGAPIENTRY glutIconifyWindow( void );
410
+ FGAPI void FGAPIENTRY glutPushWindow( void );
411
+ FGAPI void FGAPIENTRY glutPopWindow( void );
412
+ FGAPI void FGAPIENTRY glutFullScreen( void );
413
+
414
+ /*
415
+ * Display-connected functions, see freeglut_display.c
416
+ */
417
+ FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
418
+ FGAPI void FGAPIENTRY glutPostRedisplay( void );
419
+ FGAPI void FGAPIENTRY glutSwapBuffers( void );
420
+
421
+ /*
422
+ * Mouse cursor functions, see freeglut_cursor.c
423
+ */
424
+ FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
425
+ FGAPI void FGAPIENTRY glutSetCursor( int cursor );
426
+
427
+ /*
428
+ * Overlay stuff, see freeglut_overlay.c
429
+ */
430
+ FGAPI void FGAPIENTRY glutEstablishOverlay( void );
431
+ FGAPI void FGAPIENTRY glutRemoveOverlay( void );
432
+ FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
433
+ FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
434
+ FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
435
+ FGAPI void FGAPIENTRY glutShowOverlay( void );
436
+ FGAPI void FGAPIENTRY glutHideOverlay( void );
437
+
438
+ /*
439
+ * Menu stuff, see freeglut_menu.c
440
+ */
441
+ FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
442
+ FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
443
+ FGAPI int FGAPIENTRY glutGetMenu( void );
444
+ FGAPI void FGAPIENTRY glutSetMenu( int menu );
445
+ FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
446
+ FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
447
+ FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
448
+ FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
449
+ FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
450
+ FGAPI void FGAPIENTRY glutAttachMenu( int button );
451
+ FGAPI void FGAPIENTRY glutDetachMenu( int button );
452
+
453
+ /*
454
+ * Global callback functions, see freeglut_callbacks.c
455
+ */
456
+ FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
457
+ FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
458
+
459
+ /*
460
+ * Window-specific callback functions, see freeglut_callbacks.c
461
+ */
462
+ FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
463
+ FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
464
+ FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
465
+ FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
466
+ FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
467
+ FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
468
+ FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
469
+ FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
470
+ FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
471
+
472
+ FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
473
+ FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
474
+ FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
475
+ FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
476
+ FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
477
+ FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
478
+ FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
479
+
480
+ FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
481
+ FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
482
+ FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
483
+ FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
484
+ FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
485
+ FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
486
+ FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
487
+
488
+ /*
489
+ * State setting and retrieval functions, see freeglut_state.c
490
+ */
491
+ FGAPI int FGAPIENTRY glutGet( GLenum query );
492
+ FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
493
+ FGAPI int FGAPIENTRY glutGetModifiers( void );
494
+ FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
495
+
496
+ /*
497
+ * Font stuff, see freeglut_font.c
498
+ */
499
+ FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
500
+ FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
501
+ FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
502
+ FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
503
+ FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
504
+ FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
505
+
506
+ /*
507
+ * Geometry functions, see freeglut_geometry.c
508
+ */
509
+ FGAPI void FGAPIENTRY glutWireCube( GLdouble size );
510
+ FGAPI void FGAPIENTRY glutSolidCube( GLdouble size );
511
+ FGAPI void FGAPIENTRY glutWireSphere( GLdouble radius, GLint slices, GLint stacks );
512
+ FGAPI void FGAPIENTRY glutSolidSphere( GLdouble radius, GLint slices, GLint stacks );
513
+ FGAPI void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLint stacks );
514
+ FGAPI void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLint stacks );
515
+
516
+ FGAPI void FGAPIENTRY glutWireTorus( GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings );
517
+ FGAPI void FGAPIENTRY glutSolidTorus( GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings );
518
+ FGAPI void FGAPIENTRY glutWireDodecahedron( void );
519
+ FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
520
+ FGAPI void FGAPIENTRY glutWireOctahedron( void );
521
+ FGAPI void FGAPIENTRY glutSolidOctahedron( void );
522
+ FGAPI void FGAPIENTRY glutWireTetrahedron( void );
523
+ FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
524
+ FGAPI void FGAPIENTRY glutWireIcosahedron( void );
525
+ FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
526
+
527
+ /*
528
+ * Teapot rendering functions, found in freeglut_teapot.c
529
+ */
530
+ FGAPI void FGAPIENTRY glutWireTeapot( GLdouble size );
531
+ FGAPI void FGAPIENTRY glutSolidTeapot( GLdouble size );
532
+
533
+ /*
534
+ * Game mode functions, see freeglut_gamemode.c
535
+ */
536
+ FGAPI void FGAPIENTRY glutGameModeString( const char* string );
537
+ FGAPI int FGAPIENTRY glutEnterGameMode( void );
538
+ FGAPI void FGAPIENTRY glutLeaveGameMode( void );
539
+ FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
540
+
541
+ /*
542
+ * Video resize functions, see freeglut_videoresize.c
543
+ */
544
+ FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
545
+ FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
546
+ FGAPI void FGAPIENTRY glutStopVideoResizing( void );
547
+ FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
548
+ FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
549
+
550
+ /*
551
+ * Colormap functions, see freeglut_misc.c
552
+ */
553
+ FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
554
+ FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
555
+ FGAPI void FGAPIENTRY glutCopyColormap( int window );
556
+
557
+ /*
558
+ * Misc keyboard and joystick functions, see freeglut_misc.c
559
+ */
560
+ FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
561
+ FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
562
+ FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
563
+
564
+ /*
565
+ * Misc functions, see freeglut_misc.c
566
+ */
567
+ FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
568
+ FGAPI void FGAPIENTRY glutReportErrors( void );
569
+
570
+ #ifdef __cplusplus
571
+ }
572
+ #endif
573
+
574
+ /*** END OF FILE ***/
575
+
576
+ #endif /* __FREEGLUT_STD_H__ */
577
+