remogatto-ffi-opengl 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/interfaces/gl.i ADDED
@@ -0,0 +1,17 @@
1
+ %module opengl
2
+
3
+ %{
4
+ require 'ffi'
5
+ module GL
6
+ extend FFI::Library
7
+ ffi_lib 'GL'
8
+ %}
9
+
10
+ #define GL_MESA_program_debug
11
+ #define GL_ATI_blend_equation_separate
12
+
13
+ %include gl.h
14
+
15
+ %{
16
+ end
17
+ %}
data/interfaces/glu.h ADDED
@@ -0,0 +1,349 @@
1
+ /*
2
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a
6
+ * copy of this software and associated documentation files (the "Software"),
7
+ * to deal in the Software without restriction, including without limitation
8
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ * and/or sell copies of the Software, and to permit persons to whom the
10
+ * Software is furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice including the dates of first publication and
13
+ * either this permission notice or a reference to
14
+ * http://oss.sgi.com/projects/FreeB/
15
+ * shall be included in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ *
25
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
26
+ * shall not be used in advertising or otherwise to promote the sale, use or
27
+ * other dealings in this Software without prior written authorization from
28
+ * Silicon Graphics, Inc.
29
+ */
30
+
31
+ #ifndef __glu_h__
32
+ #define __glu_h__
33
+
34
+ #if defined(USE_MGL_NAMESPACE)
35
+ #include "glu_mangle.h"
36
+ #endif
37
+
38
+ #include <GL/gl.h>
39
+
40
+ #ifndef GLAPIENTRY
41
+ #define GLAPIENTRY
42
+ #endif
43
+
44
+ #ifndef GLAPIENTRYP
45
+ #define GLAPIENTRYP GLAPIENTRY *
46
+ #endif
47
+
48
+ #if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
49
+ # undef GLAPI
50
+ # define GLAPI __declspec(dllexport)
51
+ #elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL)
52
+ /* tag specifying we're building for DLL runtime support */
53
+ # undef GLAPI
54
+ # define GLAPI __declspec(dllimport)
55
+ #elif !defined(GLAPI)
56
+ /* for use with static link lib build of Win32 edition only */
57
+ # define GLAPI extern
58
+ #endif /* _STATIC_MESA support */
59
+
60
+ #ifdef __cplusplus
61
+ extern "C" {
62
+ #endif
63
+
64
+ /*************************************************************/
65
+
66
+ /* Extensions */
67
+ #define GLU_EXT_object_space_tess 1
68
+ #define GLU_EXT_nurbs_tessellator 1
69
+
70
+ /* Boolean */
71
+ #define GLU_FALSE 0
72
+ #define GLU_TRUE 1
73
+
74
+ /* Version */
75
+ #define GLU_VERSION_1_1 1
76
+ #define GLU_VERSION_1_2 1
77
+ #define GLU_VERSION_1_3 1
78
+
79
+ /* StringName */
80
+ #define GLU_VERSION 100800
81
+ #define GLU_EXTENSIONS 100801
82
+
83
+ /* ErrorCode */
84
+ #define GLU_INVALID_ENUM 100900
85
+ #define GLU_INVALID_VALUE 100901
86
+ #define GLU_OUT_OF_MEMORY 100902
87
+ #define GLU_INCOMPATIBLE_GL_VERSION 100903
88
+ #define GLU_INVALID_OPERATION 100904
89
+
90
+ /* NurbsDisplay */
91
+ /* GLU_FILL */
92
+ #define GLU_OUTLINE_POLYGON 100240
93
+ #define GLU_OUTLINE_PATCH 100241
94
+
95
+ /* NurbsCallback */
96
+ #define GLU_NURBS_ERROR 100103
97
+ #define GLU_ERROR 100103
98
+ #define GLU_NURBS_BEGIN 100164
99
+ #define GLU_NURBS_BEGIN_EXT 100164
100
+ #define GLU_NURBS_VERTEX 100165
101
+ #define GLU_NURBS_VERTEX_EXT 100165
102
+ #define GLU_NURBS_NORMAL 100166
103
+ #define GLU_NURBS_NORMAL_EXT 100166
104
+ #define GLU_NURBS_COLOR 100167
105
+ #define GLU_NURBS_COLOR_EXT 100167
106
+ #define GLU_NURBS_TEXTURE_COORD 100168
107
+ #define GLU_NURBS_TEX_COORD_EXT 100168
108
+ #define GLU_NURBS_END 100169
109
+ #define GLU_NURBS_END_EXT 100169
110
+ #define GLU_NURBS_BEGIN_DATA 100170
111
+ #define GLU_NURBS_BEGIN_DATA_EXT 100170
112
+ #define GLU_NURBS_VERTEX_DATA 100171
113
+ #define GLU_NURBS_VERTEX_DATA_EXT 100171
114
+ #define GLU_NURBS_NORMAL_DATA 100172
115
+ #define GLU_NURBS_NORMAL_DATA_EXT 100172
116
+ #define GLU_NURBS_COLOR_DATA 100173
117
+ #define GLU_NURBS_COLOR_DATA_EXT 100173
118
+ #define GLU_NURBS_TEXTURE_COORD_DATA 100174
119
+ #define GLU_NURBS_TEX_COORD_DATA_EXT 100174
120
+ #define GLU_NURBS_END_DATA 100175
121
+ #define GLU_NURBS_END_DATA_EXT 100175
122
+
123
+ /* NurbsError */
124
+ #define GLU_NURBS_ERROR1 100251
125
+ #define GLU_NURBS_ERROR2 100252
126
+ #define GLU_NURBS_ERROR3 100253
127
+ #define GLU_NURBS_ERROR4 100254
128
+ #define GLU_NURBS_ERROR5 100255
129
+ #define GLU_NURBS_ERROR6 100256
130
+ #define GLU_NURBS_ERROR7 100257
131
+ #define GLU_NURBS_ERROR8 100258
132
+ #define GLU_NURBS_ERROR9 100259
133
+ #define GLU_NURBS_ERROR10 100260
134
+ #define GLU_NURBS_ERROR11 100261
135
+ #define GLU_NURBS_ERROR12 100262
136
+ #define GLU_NURBS_ERROR13 100263
137
+ #define GLU_NURBS_ERROR14 100264
138
+ #define GLU_NURBS_ERROR15 100265
139
+ #define GLU_NURBS_ERROR16 100266
140
+ #define GLU_NURBS_ERROR17 100267
141
+ #define GLU_NURBS_ERROR18 100268
142
+ #define GLU_NURBS_ERROR19 100269
143
+ #define GLU_NURBS_ERROR20 100270
144
+ #define GLU_NURBS_ERROR21 100271
145
+ #define GLU_NURBS_ERROR22 100272
146
+ #define GLU_NURBS_ERROR23 100273
147
+ #define GLU_NURBS_ERROR24 100274
148
+ #define GLU_NURBS_ERROR25 100275
149
+ #define GLU_NURBS_ERROR26 100276
150
+ #define GLU_NURBS_ERROR27 100277
151
+ #define GLU_NURBS_ERROR28 100278
152
+ #define GLU_NURBS_ERROR29 100279
153
+ #define GLU_NURBS_ERROR30 100280
154
+ #define GLU_NURBS_ERROR31 100281
155
+ #define GLU_NURBS_ERROR32 100282
156
+ #define GLU_NURBS_ERROR33 100283
157
+ #define GLU_NURBS_ERROR34 100284
158
+ #define GLU_NURBS_ERROR35 100285
159
+ #define GLU_NURBS_ERROR36 100286
160
+ #define GLU_NURBS_ERROR37 100287
161
+
162
+ /* NurbsProperty */
163
+ #define GLU_AUTO_LOAD_MATRIX 100200
164
+ #define GLU_CULLING 100201
165
+ #define GLU_SAMPLING_TOLERANCE 100203
166
+ #define GLU_DISPLAY_MODE 100204
167
+ #define GLU_PARAMETRIC_TOLERANCE 100202
168
+ #define GLU_SAMPLING_METHOD 100205
169
+ #define GLU_U_STEP 100206
170
+ #define GLU_V_STEP 100207
171
+ #define GLU_NURBS_MODE 100160
172
+ #define GLU_NURBS_MODE_EXT 100160
173
+ #define GLU_NURBS_TESSELLATOR 100161
174
+ #define GLU_NURBS_TESSELLATOR_EXT 100161
175
+ #define GLU_NURBS_RENDERER 100162
176
+ #define GLU_NURBS_RENDERER_EXT 100162
177
+
178
+ /* NurbsSampling */
179
+ #define GLU_OBJECT_PARAMETRIC_ERROR 100208
180
+ #define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
181
+ #define GLU_OBJECT_PATH_LENGTH 100209
182
+ #define GLU_OBJECT_PATH_LENGTH_EXT 100209
183
+ #define GLU_PATH_LENGTH 100215
184
+ #define GLU_PARAMETRIC_ERROR 100216
185
+ #define GLU_DOMAIN_DISTANCE 100217
186
+
187
+ /* NurbsTrim */
188
+ #define GLU_MAP1_TRIM_2 100210
189
+ #define GLU_MAP1_TRIM_3 100211
190
+
191
+ /* QuadricDrawStyle */
192
+ #define GLU_POINT 100010
193
+ #define GLU_LINE 100011
194
+ #define GLU_FILL 100012
195
+ #define GLU_SILHOUETTE 100013
196
+
197
+ /* QuadricCallback */
198
+ /* GLU_ERROR */
199
+
200
+ /* QuadricNormal */
201
+ #define GLU_SMOOTH 100000
202
+ #define GLU_FLAT 100001
203
+ #define GLU_NONE 100002
204
+
205
+ /* QuadricOrientation */
206
+ #define GLU_OUTSIDE 100020
207
+ #define GLU_INSIDE 100021
208
+
209
+ /* TessCallback */
210
+ #define GLU_TESS_BEGIN 100100
211
+ #define GLU_BEGIN 100100
212
+ #define GLU_TESS_VERTEX 100101
213
+ #define GLU_VERTEX 100101
214
+ #define GLU_TESS_END 100102
215
+ #define GLU_END 100102
216
+ #define GLU_TESS_ERROR 100103
217
+ #define GLU_TESS_EDGE_FLAG 100104
218
+ #define GLU_EDGE_FLAG 100104
219
+ #define GLU_TESS_COMBINE 100105
220
+ #define GLU_TESS_BEGIN_DATA 100106
221
+ #define GLU_TESS_VERTEX_DATA 100107
222
+ #define GLU_TESS_END_DATA 100108
223
+ #define GLU_TESS_ERROR_DATA 100109
224
+ #define GLU_TESS_EDGE_FLAG_DATA 100110
225
+ #define GLU_TESS_COMBINE_DATA 100111
226
+
227
+ /* TessContour */
228
+ #define GLU_CW 100120
229
+ #define GLU_CCW 100121
230
+ #define GLU_INTERIOR 100122
231
+ #define GLU_EXTERIOR 100123
232
+ #define GLU_UNKNOWN 100124
233
+
234
+ /* TessProperty */
235
+ #define GLU_TESS_WINDING_RULE 100140
236
+ #define GLU_TESS_BOUNDARY_ONLY 100141
237
+ #define GLU_TESS_TOLERANCE 100142
238
+
239
+ /* TessError */
240
+ #define GLU_TESS_ERROR1 100151
241
+ #define GLU_TESS_ERROR2 100152
242
+ #define GLU_TESS_ERROR3 100153
243
+ #define GLU_TESS_ERROR4 100154
244
+ #define GLU_TESS_ERROR5 100155
245
+ #define GLU_TESS_ERROR6 100156
246
+ #define GLU_TESS_ERROR7 100157
247
+ #define GLU_TESS_ERROR8 100158
248
+ #define GLU_TESS_MISSING_BEGIN_POLYGON 100151
249
+ #define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
250
+ #define GLU_TESS_MISSING_END_POLYGON 100153
251
+ #define GLU_TESS_MISSING_END_CONTOUR 100154
252
+ #define GLU_TESS_COORD_TOO_LARGE 100155
253
+ #define GLU_TESS_NEED_COMBINE_CALLBACK 100156
254
+
255
+ /* TessWinding */
256
+ #define GLU_TESS_WINDING_ODD 100130
257
+ #define GLU_TESS_WINDING_NONZERO 100131
258
+ #define GLU_TESS_WINDING_POSITIVE 100132
259
+ #define GLU_TESS_WINDING_NEGATIVE 100133
260
+ #define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
261
+
262
+ /*************************************************************/
263
+
264
+
265
+ #ifdef __cplusplus
266
+ class GLUnurbs;
267
+ class GLUquadric;
268
+ class GLUtesselator;
269
+ #else
270
+ typedef struct GLUnurbs GLUnurbs;
271
+ typedef struct GLUquadric GLUquadric;
272
+ typedef struct GLUtesselator GLUtesselator;
273
+ #endif
274
+
275
+ typedef GLUnurbs GLUnurbsObj;
276
+ typedef GLUquadric GLUquadricObj;
277
+ typedef GLUtesselator GLUtesselatorObj;
278
+ typedef GLUtesselator GLUtriangulatorObj;
279
+
280
+ #define GLU_TESS_MAX_COORD 1.0e150
281
+
282
+ /* Internal convenience typedefs */
283
+ typedef void (GLAPIENTRYP _GLUfuncptr)();
284
+
285
+ GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
286
+ GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
287
+ GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb);
288
+ GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb);
289
+ GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
290
+ GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
291
+ GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
292
+ GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
293
+ GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
294
+ GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
295
+ GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
296
+ GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
297
+ GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
298
+ GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad);
299
+ GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess);
300
+ GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
301
+ GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb);
302
+ GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess);
303
+ GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb);
304
+ GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb);
305
+ GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error);
306
+ GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
307
+ GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name);
308
+ GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
309
+ GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
310
+ GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
311
+ GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void);
312
+ GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void);
313
+ GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void);
314
+ GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
315
+ GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
316
+ GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
317
+ GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
318
+ GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
319
+ GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
320
+ GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
321
+ GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
322
+ GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
323
+ GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
324
+ GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
325
+ GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
326
+ GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
327
+ GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
328
+ GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
329
+ GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
330
+ GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
331
+ GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
332
+ GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
333
+ GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
334
+ GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess);
335
+ GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
336
+ GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
337
+ GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess);
338
+ GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess);
339
+ GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
340
+ GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
341
+ GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
342
+ GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
343
+ GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
344
+
345
+ #ifdef __cplusplus
346
+ }
347
+ #endif
348
+
349
+ #endif /* __glu_h__ */
data/interfaces/glu.i ADDED
@@ -0,0 +1,33 @@
1
+ %module glu
2
+
3
+ %{
4
+ require 'ffi'
5
+ module GLU
6
+ extend FFI::Library
7
+ ffi_lib 'GLU'
8
+ %}
9
+
10
+ /*
11
+ * Datatypes
12
+ */
13
+ typedef unsigned int GLenum;
14
+ typedef unsigned char GLboolean;
15
+ typedef unsigned int GLbitfield;
16
+ typedef void GLvoid;
17
+ typedef signed char GLbyte; /* 1-byte signed */
18
+ typedef short GLshort; /* 2-byte signed */
19
+ typedef int GLint; /* 4-byte signed */
20
+ typedef unsigned char GLubyte; /* 1-byte unsigned */
21
+ typedef unsigned short GLushort; /* 2-byte unsigned */
22
+ typedef unsigned int GLuint; /* 4-byte unsigned */
23
+ typedef int GLsizei; /* 4-byte signed */
24
+ typedef float GLfloat; /* single precision float */
25
+ typedef float GLclampf; /* single precision float in [0,1] */
26
+ typedef double GLdouble; /* double precision float */
27
+ typedef double GLclampd; /* double precision float in [0,1] */
28
+
29
+ %include glu.h
30
+
31
+ %{
32
+ end
33
+ %}
data/interfaces/glut.i ADDED
@@ -0,0 +1,34 @@
1
+ %module opengl
2
+
3
+ %{
4
+ require 'ffi'
5
+ module GLUT
6
+ extend FFI::Library
7
+ ffi_lib 'glut'
8
+ %}
9
+
10
+ /*
11
+ * Datatypes
12
+ */
13
+ typedef unsigned int GLenum;
14
+ typedef unsigned char GLboolean;
15
+ typedef unsigned int GLbitfield;
16
+ typedef void GLvoid;
17
+ typedef signed char GLbyte; /* 1-byte signed */
18
+ typedef short GLshort; /* 2-byte signed */
19
+ typedef int GLint; /* 4-byte signed */
20
+ typedef unsigned char GLubyte; /* 1-byte unsigned */
21
+ typedef unsigned short GLushort; /* 2-byte unsigned */
22
+ typedef unsigned int GLuint; /* 4-byte unsigned */
23
+ typedef int GLsizei; /* 4-byte signed */
24
+ typedef float GLfloat; /* single precision float */
25
+ typedef float GLclampf; /* single precision float in [0,1] */
26
+ typedef double GLdouble; /* double precision float */
27
+ typedef double GLclampd; /* double precision float in [0,1] */
28
+
29
+
30
+ %include freeglut_std.h
31
+
32
+ %{
33
+ end
34
+ %}
data/lib/ffi-opengl.rb ADDED
@@ -0,0 +1,55 @@
1
+ module FFIOpenGL
2
+
3
+ # :stopdoc:
4
+ VERSION = '0.1.0'
5
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
+ # :startdoc:
8
+
9
+ # Returns the version string for the library.
10
+ #
11
+ def self.version
12
+ VERSION
13
+ end
14
+
15
+ # Returns the library path for the module. If any arguments are given,
16
+ # they will be joined to the end of the libray path using
17
+ # <tt>File.join</tt>.
18
+ #
19
+ def self.libpath( *args )
20
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
21
+ end
22
+
23
+ # Returns the lpath for the module. If any arguments are given,
24
+ # they will be joined to the end of the path using
25
+ # <tt>File.join</tt>.
26
+ #
27
+ def self.path( *args )
28
+ args.empty? ? PATH : ::File.join(PATH, args.flatten)
29
+ end
30
+
31
+ # Utility method used to require all files ending in .rb that lie in the
32
+ # directory below this file that has the same name as the filename passed
33
+ # in. Optionally, a specific _directory_ name can be passed in such that
34
+ # the _filename_ does not have to be equivalent to the directory.
35
+ #
36
+ def self.require_all_libs_relative_to( fname, dir = nil )
37
+ dir ||= ::File.basename(fname, '.*')
38
+ search_me = ::File.expand_path(
39
+ ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
40
+
41
+ Dir.glob(search_me).sort.each {|rb| require rb}
42
+ end
43
+
44
+ end
45
+
46
+ begin
47
+ require 'rubygems'
48
+ rescue
49
+ nil # try without it
50
+ end
51
+ require 'ffi'
52
+ require "#{FFIOpenGL.libpath('ffi-opengl/platform')}"
53
+ FFIOpenGL.require_all_libs_relative_to(__FILE__)
54
+
55
+ # EOF