opengl-bindings 1.6.10 → 1.6.11

Sign up to get free protection for your applications and to get access to all the features.
data/lib/glu.rb CHANGED
@@ -1,366 +1,366 @@
1
- # -*- coding: utf-8 -*-
2
- require 'fiddle/import'
3
- require_relative 'opengl_platform'
4
-
5
- module GLU
6
-
7
- extend Fiddle::Importer
8
-
9
- #
10
- # Fiddle's default 'extern' stores all methods into local variable '@func_map', that makes difficult to 'include GLFW'.
11
- # So I override it and replace '@func_map' into 'GLFW_FUNCTIONS_MAP'.
12
- # Ref.: /lib/ruby/2.0.0/fiddle/import.rb
13
- #
14
- GLU_FUNCTIONS_MAP = {}
15
- def self.extern(signature, *opts)
16
- symname, ctype, argtype = parse_signature(signature, @type_alias)
17
- opt = parse_bind_options(opts)
18
- f = import_function(symname, ctype, argtype, opt[:call_type])
19
- name = symname.gsub(/@.+/,'')
20
- GLU_FUNCTIONS_MAP[name] = f
21
- begin
22
- /^(.+?):(\d+)/ =~ caller.first
23
- file, line = $1, $2.to_i
24
- rescue
25
- file, line = __FILE__, __LINE__+3
26
- end
27
- args_str="*args"
28
- module_eval(<<-EOS, file, line)
29
- def #{name}(*args, &block)
30
- GLU_FUNCTIONS_MAP['#{name}'].call(*args,&block)
31
- end
32
- EOS
33
- module_function(name)
34
- f
35
- end
36
-
37
- # defines
38
-
39
- # Extensions
40
- GLU_EXT_object_space_tess = 1
41
- GLU_EXT_nurbs_tessellator = 1
42
-
43
- # Boolean
44
- GLU_FALSE = 0
45
- GLU_TRUE = 1
46
-
47
- # Version
48
- GLU_VERSION_1_1 = 1
49
- GLU_VERSION_1_2 = 1
50
- GLU_VERSION_1_3 = 1
51
-
52
- # StringName
53
- GLU_VERSION = 100800
54
- GLU_EXTENSIONS = 100801
55
-
56
- # ErrorCode
57
- GLU_INVALID_ENUM = 100900
58
- GLU_INVALID_VALUE = 100901
59
- GLU_OUT_OF_MEMORY = 100902
60
- GLU_INCOMPATIBLE_GL_VERSION = 100903
61
- GLU_INVALID_OPERATION = 100904
62
-
63
-
64
- # NurbsDisplay
65
- # GLU_FILL
66
- GLU_OUTLINE_POLYGON = 100240
67
- GLU_OUTLINE_PATCH = 100241
68
-
69
- # NurbsCallback
70
- GLU_NURBS_ERROR = 100103
71
- GLU_ERROR = 100103
72
- GLU_NURBS_BEGIN = 100164
73
- GLU_NURBS_BEGIN_EXT = 100164
74
- GLU_NURBS_VERTEX = 100165
75
- GLU_NURBS_VERTEX_EXT = 100165
76
- GLU_NURBS_NORMAL = 100166
77
- GLU_NURBS_NORMAL_EXT = 100166
78
- GLU_NURBS_COLOR = 100167
79
- GLU_NURBS_COLOR_EXT = 100167
80
- GLU_NURBS_TEXTURE_COORD = 100168
81
- GLU_NURBS_TEX_COORD_EXT = 100168
82
- GLU_NURBS_END = 100169
83
- GLU_NURBS_END_EXT = 100169
84
- GLU_NURBS_BEGIN_DATA = 100170
85
- GLU_NURBS_BEGIN_DATA_EXT = 100170
86
- GLU_NURBS_VERTEX_DATA = 100171
87
- GLU_NURBS_VERTEX_DATA_EXT = 100171
88
- GLU_NURBS_NORMAL_DATA = 100172
89
- GLU_NURBS_NORMAL_DATA_EXT = 100172
90
- GLU_NURBS_COLOR_DATA = 100173
91
- GLU_NURBS_COLOR_DATA_EXT = 100173
92
- GLU_NURBS_TEXTURE_COORD_DATA = 100174
93
- GLU_NURBS_TEX_COORD_DATA_EXT = 100174
94
- GLU_NURBS_END_DATA = 100175
95
- GLU_NURBS_END_DATA_EXT = 100175
96
-
97
- # NurbsError
98
- GLU_NURBS_ERROR1 = 100251 # spline order un-supported
99
- GLU_NURBS_ERROR2 = 100252 # too few knots
100
- GLU_NURBS_ERROR3 = 100253 # valid knot range is empty
101
- GLU_NURBS_ERROR4 = 100254 # decreasing knot sequence
102
- GLU_NURBS_ERROR5 = 100255 # knot multiplicity > spline order
103
- GLU_NURBS_ERROR6 = 100256 # endcurve() must follow bgncurve()
104
- GLU_NURBS_ERROR7 = 100257 # bgncurve() must precede endcurve()
105
- GLU_NURBS_ERROR8 = 100258 # ctrlarray or knot vector is NULL
106
- GLU_NURBS_ERROR9 = 100259 # can't draw pwlcurves
107
- GLU_NURBS_ERROR10 = 100260 # missing gluNurbsCurve()
108
- GLU_NURBS_ERROR11 = 100261 # missing gluNurbsSurface()
109
- GLU_NURBS_ERROR12 = 100262 # endtrim() must precede endsurface()
110
- GLU_NURBS_ERROR13 = 100263 # bgnsurface() must precede endsurface()
111
- GLU_NURBS_ERROR14 = 100264 # curve of improper type passed as trim curve
112
- GLU_NURBS_ERROR15 = 100265 # bgnsurface() must precede bgntrim()
113
- GLU_NURBS_ERROR16 = 100266 # endtrim() must follow bgntrim()
114
- GLU_NURBS_ERROR17 = 100267 # bgntrim() must precede endtrim()
115
- GLU_NURBS_ERROR18 = 100268 # invalid or missing trim curve
116
- GLU_NURBS_ERROR19 = 100269 # bgntrim() must precede pwlcurve()
117
- GLU_NURBS_ERROR20 = 100270 # pwlcurve referenced twice
118
- GLU_NURBS_ERROR21 = 100271 # pwlcurve and nurbscurve mixed
119
- GLU_NURBS_ERROR22 = 100272 # improper usage of trim data type
120
- GLU_NURBS_ERROR23 = 100273 # nurbscurve referenced twice
121
- GLU_NURBS_ERROR24 = 100274 # nurbscurve and pwlcurve mixed
122
- GLU_NURBS_ERROR25 = 100275 # nurbssurface referenced twice
123
- GLU_NURBS_ERROR26 = 100276 # invalid property
124
- GLU_NURBS_ERROR27 = 100277 # endsurface() must follow bgnsurface()
125
- GLU_NURBS_ERROR28 = 100278 # intersecting or misoriented trim curves
126
- GLU_NURBS_ERROR29 = 100279 # intersecting trim curves
127
- GLU_NURBS_ERROR30 = 100280 # UNUSED
128
- GLU_NURBS_ERROR31 = 100281 # unconnected trim curves
129
- GLU_NURBS_ERROR32 = 100282 # unknown knot error
130
- GLU_NURBS_ERROR33 = 100283 # negative vertex count encountered
131
- GLU_NURBS_ERROR34 = 100284 # negative byte-stride
132
- GLU_NURBS_ERROR35 = 100285 # unknown type descriptor
133
- GLU_NURBS_ERROR36 = 100286 # null control point reference
134
- GLU_NURBS_ERROR37 = 100287 # duplicate point on pwlcurve
135
-
136
- # NurbsProperty
137
- GLU_AUTO_LOAD_MATRIX = 100200
138
- GLU_CULLING = 100201
139
- GLU_SAMPLING_TOLERANCE = 100203
140
- GLU_DISPLAY_MODE = 100204
141
- GLU_PARAMETRIC_TOLERANCE = 100202
142
- GLU_SAMPLING_METHOD = 100205
143
- GLU_U_STEP = 100206
144
- GLU_V_STEP = 100207
145
- GLU_NURBS_MODE = 100160
146
- GLU_NURBS_MODE_EXT = 100160
147
- GLU_NURBS_TESSELLATOR = 100161
148
- GLU_NURBS_TESSELLATOR_EXT = 100161
149
- GLU_NURBS_RENDERER = 100162
150
- GLU_NURBS_RENDERER_EXT = 100162
151
-
152
- # NurbsSampling
153
- GLU_OBJECT_PARAMETRIC_ERROR = 100208
154
- GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208
155
- GLU_OBJECT_PATH_LENGTH = 100209
156
- GLU_OBJECT_PATH_LENGTH_EXT = 100209
157
- GLU_PATH_LENGTH = 100215
158
- GLU_PARAMETRIC_ERROR = 100216
159
- GLU_DOMAIN_DISTANCE = 100217
160
-
161
- # NurbsTrim
162
- GLU_MAP1_TRIM_2 = 100210
163
- GLU_MAP1_TRIM_3 = 100211
164
-
165
- # QuadricDrawStyle
166
- GLU_POINT = 100010
167
- GLU_LINE = 100011
168
- GLU_FILL = 100012
169
- GLU_SILHOUETTE = 100013
170
-
171
- # QuadricCallback
172
- # GLU_ERROR
173
-
174
- # QuadricNormal
175
- GLU_SMOOTH = 100000
176
- GLU_FLAT = 100001
177
- GLU_NONE = 100002
178
-
179
- # QuadricOrientation
180
- GLU_OUTSIDE = 100020
181
- GLU_INSIDE = 100021
182
-
183
- # TessCallback
184
- GLU_TESS_BEGIN = 100100
185
- GLU_BEGIN = 100100
186
- GLU_TESS_VERTEX = 100101
187
- GLU_VERTEX = 100101
188
- GLU_TESS_END = 100102
189
- GLU_END = 100102
190
- GLU_TESS_ERROR = 100103
191
- GLU_TESS_EDGE_FLAG = 100104
192
- GLU_EDGE_FLAG = 100104
193
- GLU_TESS_COMBINE = 100105
194
- GLU_TESS_BEGIN_DATA = 100106
195
- GLU_TESS_VERTEX_DATA = 100107
196
- GLU_TESS_END_DATA = 100108
197
- GLU_TESS_ERROR_DATA = 100109
198
- GLU_TESS_EDGE_FLAG_DATA = 100110
199
- GLU_TESS_COMBINE_DATA = 100111
200
-
201
- # TessContour
202
- GLU_CW = 100120
203
- GLU_CCW = 100121
204
- GLU_INTERIOR = 100122
205
- GLU_EXTERIOR = 100123
206
- GLU_UNKNOWN = 100124
207
-
208
- # TessProperty
209
- GLU_TESS_WINDING_RULE = 100140
210
- GLU_TESS_BOUNDARY_ONLY = 100141
211
- GLU_TESS_TOLERANCE = 100142
212
-
213
- # TessError
214
- GLU_TESS_ERROR1 = 100151
215
- GLU_TESS_ERROR2 = 100152
216
- GLU_TESS_ERROR3 = 100153
217
- GLU_TESS_ERROR4 = 100154
218
- GLU_TESS_ERROR5 = 100155
219
- GLU_TESS_ERROR6 = 100156
220
- GLU_TESS_ERROR7 = 100157
221
- GLU_TESS_ERROR8 = 100158
222
- GLU_TESS_MISSING_BEGIN_POLYGON = 100151
223
- GLU_TESS_MISSING_BEGIN_CONTOUR = 100152
224
- GLU_TESS_MISSING_END_POLYGON = 100153
225
- GLU_TESS_MISSING_END_CONTOUR = 100154
226
- GLU_TESS_COORD_TOO_LARGE = 100155
227
- GLU_TESS_NEED_COMBINE_CALLBACK = 100156
228
-
229
- # TessWinding
230
- GLU_TESS_WINDING_ODD = 100130
231
- GLU_TESS_WINDING_NONZERO = 100131
232
- GLU_TESS_WINDING_POSITIVE = 100132
233
- GLU_TESS_WINDING_NEGATIVE = 100133
234
- GLU_TESS_WINDING_ABS_GEQ_TWO = 100134
235
-
236
- GLU_TESS_MAX_COORD = 1.0e150
237
-
238
- # typedefs
239
- @@glu_cb_signature = {
240
- :NurbsCallback => "void CallBackFunc()",
241
- :QuadricCallback => "void CallBackFunc()",
242
- :TessCallback => "void CallBackFunc()",
243
- }
244
- def self.create_callback( sym, *opts, &blk )
245
- return bind( @@glu_cb_signature[sym], opts, &blk )
246
- end
247
-
248
- # struct
249
-
250
- @@glu_import_done = false
251
-
252
- # Load native library.
253
- def self.load_lib(lib = nil, path = nil)
254
- if lib == nil && path == nil
255
- case OpenGL.get_platform
256
- when :OPENGL_PLATFORM_WINDOWS
257
- lib, path = 'GLU32.dll', 'C:/Windows/System32'
258
- when :OPENGL_PLATFORM_MACOSX
259
- lib, path = 'libGLU.dylib', '/System/Library/Frameworks/OpenGL.framework/Libraries'
260
- else
261
- lib = 'libGLU.so'
262
- end
263
- end
264
- if path
265
- dlload (path + '/' + lib)
266
- else
267
- dlload (lib)
268
- end
269
- import_symbols() unless @@glu_import_done
270
- end
271
-
272
- def self.load_dll(lib = nil, path = nil)
273
- puts "Warning GLU.load_dll is deprecated, use GLU.load_lib instead"
274
- self.load_lib(lib, path)
275
- end
276
-
277
- def self.import_symbols
278
- # function
279
- extern 'void gluBeginCurve (void*)'
280
- extern 'void gluBeginPolygon (void*)'
281
- extern 'void gluBeginSurface (void*)'
282
- extern 'void gluBeginTrim (void*)'
283
- # extern 'int gluBuild1DMipmapLevels (unsigned int, int, int, unsigned int, unsigned int, int, int, int, void*)' # Unavailable on Windows
284
- extern 'int gluBuild1DMipmaps (unsigned int, int, int, unsigned int, unsigned int, void*)'
285
- # extern 'int gluBuild2DMipmapLevels (unsigned int, int, int, int, unsigned int, unsigned int, int, int, int, void*)' # Unavailable on Windows
286
- extern 'int gluBuild2DMipmaps (unsigned int, int, int, int, unsigned int, unsigned int, void*)'
287
- # extern 'int gluBuild3DMipmapLevels (unsigned int, int, int, int, int, unsigned int, unsigned int, int, int, int, void*)' # Unavailable on Windows
288
- # extern 'int gluBuild3DMipmaps (unsigned int, int, int, int, int, unsigned int, unsigned int, void*)' # Unavailable on Windows
289
- # extern 'unsigned char gluCheckExtension ( unsigned char*, unsigned char*)' # Unavailable on Windows
290
- extern 'void gluCylinder (void*, double, double, double, int, int)'
291
- extern 'void gluDeleteNurbsRenderer (void*)'
292
- extern 'void gluDeleteQuadric (void*)'
293
- extern 'void gluDeleteTess (void*)'
294
- extern 'void gluDisk (void*, double, double, int, int)'
295
- extern 'void gluEndCurve (void*)'
296
- extern 'void gluEndPolygon (void*)'
297
- extern 'void gluEndSurface (void*)'
298
- extern 'void gluEndTrim (void*)'
299
- extern 'unsigned char* gluErrorString (unsigned int)'
300
- extern 'void gluGetNurbsProperty (void*, unsigned int, float*)'
301
- extern 'unsigned char* gluGetString (unsigned int)'
302
- extern 'void gluGetTessProperty (void*, unsigned int, double*)'
303
- extern 'void gluLoadSamplingMatrices (void*, float *, float *, int *)'
304
- extern 'void gluLookAt (double, double, double , double, double , double, double , double, double)'
305
- extern 'void* gluNewNurbsRenderer ()'
306
- extern 'void* gluNewQuadric ()'
307
- extern 'void* gluNewTess ()'
308
- extern 'void gluNextContour (void*, unsigned int)'
309
- extern 'void gluNurbsCallback (void*, unsigned int, void*)'
310
- # extern 'void gluNurbsCallbackData (void*, void*)' # Unavailable on Windows
311
- # extern 'void gluNurbsCallbackDataEXT (void*, void*)' # Unavailable on Windows
312
- extern 'void gluNurbsCurve (void*, int, float *, int, float* , int, unsigned int)'
313
- extern 'void gluNurbsProperty (void*, unsigned int, float)'
314
- extern 'void gluNurbsSurface (void*, int, float*, int, float*, int, int, float*, int, int, unsigned int)'
315
- extern 'void gluOrtho2D (double, double, double, double)'
316
- extern 'void gluPartialDisk (void*, double, double, int, int, double, double)'
317
- extern 'void gluPerspective (double, double, double, double)'
318
- extern 'void gluPickMatrix (double, double, double, double, int *)'
319
- extern 'int gluProject (double, double, double, double *, double *, int *, double*, double*, double*)'
320
- extern 'void gluPwlCurve (void*, int, float*, int, unsigned int)'
321
- extern 'void gluQuadricCallback (void*, unsigned int, void*)'
322
- extern 'void gluQuadricDrawStyle (void*, unsigned int)'
323
- extern 'void gluQuadricNormals (void*, unsigned int)'
324
- extern 'void gluQuadricOrientation (void*, unsigned int)'
325
- extern 'void gluQuadricTexture (void*, unsigned char)'
326
- extern 'int gluScaleImage (unsigned int, int, int, unsigned int, void*, int, int, unsigned int, void*)'
327
- extern 'void gluSphere (void*, double, int, int)'
328
- extern 'void gluTessBeginContour (void*)'
329
- extern 'void gluTessBeginPolygon (void*, void*)'
330
- extern 'void gluTessCallback (void*, unsigned int, void*)'
331
- extern 'void gluTessEndContour (void*)'
332
- extern 'void gluTessEndPolygon (void*)'
333
- extern 'void gluTessNormal (void*, double, double, double)'
334
- extern 'void gluTessProperty (void*, unsigned int, double)'
335
- extern 'void gluTessVertex (void*, double *, void*)'
336
- extern 'int gluUnProject (double, double, double, double *, double *, int *, double*, double*, double*)'
337
- # extern 'int gluUnProject4 (double, double, double, double, double *, double *, int *, double, double, double*, double*, double*, double*)' # Unavailable on Windows
338
-
339
- @@glu_import_done = true
340
- end
341
-
342
- end
343
-
344
- =begin
345
- Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
346
- Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
347
-
348
- This software is provided 'as-is', without any express or implied
349
- warranty. In no event will the authors be held liable for any damages
350
- arising from the use of this software.
351
-
352
- Permission is granted to anyone to use this software for any purpose,
353
- including commercial applications, and to alter it and redistribute it
354
- freely, subject to the following restrictions:
355
-
356
- 1. The origin of this software must not be misrepresented; you must not
357
- claim that you wrote the original software. If you use this software
358
- in a product, an acknowledgment in the product documentation would be
359
- appreciated but is not required.
360
-
361
- 2. Altered source versions must be plainly marked as such, and must not be
362
- misrepresented as being the original software.
363
-
364
- 3. This notice may not be removed or altered from any source
365
- distribution.
366
- =end
1
+ # -*- coding: utf-8 -*-
2
+ require 'fiddle/import'
3
+ require_relative 'opengl_platform'
4
+
5
+ module GLU
6
+
7
+ extend Fiddle::Importer
8
+
9
+ #
10
+ # Fiddle's default 'extern' stores all methods into local variable '@func_map', that makes difficult to 'include GLFW'.
11
+ # So I override it and replace '@func_map' into 'GLFW_FUNCTIONS_MAP'.
12
+ # Ref.: /lib/ruby/2.0.0/fiddle/import.rb
13
+ #
14
+ GLU_FUNCTIONS_MAP = {}
15
+ def self.extern(signature, *opts)
16
+ symname, ctype, argtype = parse_signature(signature, @type_alias)
17
+ opt = parse_bind_options(opts)
18
+ f = import_function(symname, ctype, argtype, opt[:call_type])
19
+ name = symname.gsub(/@.+/,'')
20
+ GLU_FUNCTIONS_MAP[name] = f
21
+ begin
22
+ /^(.+?):(\d+)/ =~ caller.first
23
+ file, line = $1, $2.to_i
24
+ rescue
25
+ file, line = __FILE__, __LINE__+3
26
+ end
27
+ args_str="*args"
28
+ module_eval(<<-EOS, file, line)
29
+ def #{name}(*args, &block)
30
+ GLU_FUNCTIONS_MAP['#{name}'].call(*args,&block)
31
+ end
32
+ EOS
33
+ module_function(name)
34
+ f
35
+ end
36
+
37
+ # defines
38
+
39
+ # Extensions
40
+ GLU_EXT_object_space_tess = 1
41
+ GLU_EXT_nurbs_tessellator = 1
42
+
43
+ # Boolean
44
+ GLU_FALSE = 0
45
+ GLU_TRUE = 1
46
+
47
+ # Version
48
+ GLU_VERSION_1_1 = 1
49
+ GLU_VERSION_1_2 = 1
50
+ GLU_VERSION_1_3 = 1
51
+
52
+ # StringName
53
+ GLU_VERSION = 100800
54
+ GLU_EXTENSIONS = 100801
55
+
56
+ # ErrorCode
57
+ GLU_INVALID_ENUM = 100900
58
+ GLU_INVALID_VALUE = 100901
59
+ GLU_OUT_OF_MEMORY = 100902
60
+ GLU_INCOMPATIBLE_GL_VERSION = 100903
61
+ GLU_INVALID_OPERATION = 100904
62
+
63
+
64
+ # NurbsDisplay
65
+ # GLU_FILL
66
+ GLU_OUTLINE_POLYGON = 100240
67
+ GLU_OUTLINE_PATCH = 100241
68
+
69
+ # NurbsCallback
70
+ GLU_NURBS_ERROR = 100103
71
+ GLU_ERROR = 100103
72
+ GLU_NURBS_BEGIN = 100164
73
+ GLU_NURBS_BEGIN_EXT = 100164
74
+ GLU_NURBS_VERTEX = 100165
75
+ GLU_NURBS_VERTEX_EXT = 100165
76
+ GLU_NURBS_NORMAL = 100166
77
+ GLU_NURBS_NORMAL_EXT = 100166
78
+ GLU_NURBS_COLOR = 100167
79
+ GLU_NURBS_COLOR_EXT = 100167
80
+ GLU_NURBS_TEXTURE_COORD = 100168
81
+ GLU_NURBS_TEX_COORD_EXT = 100168
82
+ GLU_NURBS_END = 100169
83
+ GLU_NURBS_END_EXT = 100169
84
+ GLU_NURBS_BEGIN_DATA = 100170
85
+ GLU_NURBS_BEGIN_DATA_EXT = 100170
86
+ GLU_NURBS_VERTEX_DATA = 100171
87
+ GLU_NURBS_VERTEX_DATA_EXT = 100171
88
+ GLU_NURBS_NORMAL_DATA = 100172
89
+ GLU_NURBS_NORMAL_DATA_EXT = 100172
90
+ GLU_NURBS_COLOR_DATA = 100173
91
+ GLU_NURBS_COLOR_DATA_EXT = 100173
92
+ GLU_NURBS_TEXTURE_COORD_DATA = 100174
93
+ GLU_NURBS_TEX_COORD_DATA_EXT = 100174
94
+ GLU_NURBS_END_DATA = 100175
95
+ GLU_NURBS_END_DATA_EXT = 100175
96
+
97
+ # NurbsError
98
+ GLU_NURBS_ERROR1 = 100251 # spline order un-supported
99
+ GLU_NURBS_ERROR2 = 100252 # too few knots
100
+ GLU_NURBS_ERROR3 = 100253 # valid knot range is empty
101
+ GLU_NURBS_ERROR4 = 100254 # decreasing knot sequence
102
+ GLU_NURBS_ERROR5 = 100255 # knot multiplicity > spline order
103
+ GLU_NURBS_ERROR6 = 100256 # endcurve() must follow bgncurve()
104
+ GLU_NURBS_ERROR7 = 100257 # bgncurve() must precede endcurve()
105
+ GLU_NURBS_ERROR8 = 100258 # ctrlarray or knot vector is NULL
106
+ GLU_NURBS_ERROR9 = 100259 # can't draw pwlcurves
107
+ GLU_NURBS_ERROR10 = 100260 # missing gluNurbsCurve()
108
+ GLU_NURBS_ERROR11 = 100261 # missing gluNurbsSurface()
109
+ GLU_NURBS_ERROR12 = 100262 # endtrim() must precede endsurface()
110
+ GLU_NURBS_ERROR13 = 100263 # bgnsurface() must precede endsurface()
111
+ GLU_NURBS_ERROR14 = 100264 # curve of improper type passed as trim curve
112
+ GLU_NURBS_ERROR15 = 100265 # bgnsurface() must precede bgntrim()
113
+ GLU_NURBS_ERROR16 = 100266 # endtrim() must follow bgntrim()
114
+ GLU_NURBS_ERROR17 = 100267 # bgntrim() must precede endtrim()
115
+ GLU_NURBS_ERROR18 = 100268 # invalid or missing trim curve
116
+ GLU_NURBS_ERROR19 = 100269 # bgntrim() must precede pwlcurve()
117
+ GLU_NURBS_ERROR20 = 100270 # pwlcurve referenced twice
118
+ GLU_NURBS_ERROR21 = 100271 # pwlcurve and nurbscurve mixed
119
+ GLU_NURBS_ERROR22 = 100272 # improper usage of trim data type
120
+ GLU_NURBS_ERROR23 = 100273 # nurbscurve referenced twice
121
+ GLU_NURBS_ERROR24 = 100274 # nurbscurve and pwlcurve mixed
122
+ GLU_NURBS_ERROR25 = 100275 # nurbssurface referenced twice
123
+ GLU_NURBS_ERROR26 = 100276 # invalid property
124
+ GLU_NURBS_ERROR27 = 100277 # endsurface() must follow bgnsurface()
125
+ GLU_NURBS_ERROR28 = 100278 # intersecting or misoriented trim curves
126
+ GLU_NURBS_ERROR29 = 100279 # intersecting trim curves
127
+ GLU_NURBS_ERROR30 = 100280 # UNUSED
128
+ GLU_NURBS_ERROR31 = 100281 # unconnected trim curves
129
+ GLU_NURBS_ERROR32 = 100282 # unknown knot error
130
+ GLU_NURBS_ERROR33 = 100283 # negative vertex count encountered
131
+ GLU_NURBS_ERROR34 = 100284 # negative byte-stride
132
+ GLU_NURBS_ERROR35 = 100285 # unknown type descriptor
133
+ GLU_NURBS_ERROR36 = 100286 # null control point reference
134
+ GLU_NURBS_ERROR37 = 100287 # duplicate point on pwlcurve
135
+
136
+ # NurbsProperty
137
+ GLU_AUTO_LOAD_MATRIX = 100200
138
+ GLU_CULLING = 100201
139
+ GLU_SAMPLING_TOLERANCE = 100203
140
+ GLU_DISPLAY_MODE = 100204
141
+ GLU_PARAMETRIC_TOLERANCE = 100202
142
+ GLU_SAMPLING_METHOD = 100205
143
+ GLU_U_STEP = 100206
144
+ GLU_V_STEP = 100207
145
+ GLU_NURBS_MODE = 100160
146
+ GLU_NURBS_MODE_EXT = 100160
147
+ GLU_NURBS_TESSELLATOR = 100161
148
+ GLU_NURBS_TESSELLATOR_EXT = 100161
149
+ GLU_NURBS_RENDERER = 100162
150
+ GLU_NURBS_RENDERER_EXT = 100162
151
+
152
+ # NurbsSampling
153
+ GLU_OBJECT_PARAMETRIC_ERROR = 100208
154
+ GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208
155
+ GLU_OBJECT_PATH_LENGTH = 100209
156
+ GLU_OBJECT_PATH_LENGTH_EXT = 100209
157
+ GLU_PATH_LENGTH = 100215
158
+ GLU_PARAMETRIC_ERROR = 100216
159
+ GLU_DOMAIN_DISTANCE = 100217
160
+
161
+ # NurbsTrim
162
+ GLU_MAP1_TRIM_2 = 100210
163
+ GLU_MAP1_TRIM_3 = 100211
164
+
165
+ # QuadricDrawStyle
166
+ GLU_POINT = 100010
167
+ GLU_LINE = 100011
168
+ GLU_FILL = 100012
169
+ GLU_SILHOUETTE = 100013
170
+
171
+ # QuadricCallback
172
+ # GLU_ERROR
173
+
174
+ # QuadricNormal
175
+ GLU_SMOOTH = 100000
176
+ GLU_FLAT = 100001
177
+ GLU_NONE = 100002
178
+
179
+ # QuadricOrientation
180
+ GLU_OUTSIDE = 100020
181
+ GLU_INSIDE = 100021
182
+
183
+ # TessCallback
184
+ GLU_TESS_BEGIN = 100100
185
+ GLU_BEGIN = 100100
186
+ GLU_TESS_VERTEX = 100101
187
+ GLU_VERTEX = 100101
188
+ GLU_TESS_END = 100102
189
+ GLU_END = 100102
190
+ GLU_TESS_ERROR = 100103
191
+ GLU_TESS_EDGE_FLAG = 100104
192
+ GLU_EDGE_FLAG = 100104
193
+ GLU_TESS_COMBINE = 100105
194
+ GLU_TESS_BEGIN_DATA = 100106
195
+ GLU_TESS_VERTEX_DATA = 100107
196
+ GLU_TESS_END_DATA = 100108
197
+ GLU_TESS_ERROR_DATA = 100109
198
+ GLU_TESS_EDGE_FLAG_DATA = 100110
199
+ GLU_TESS_COMBINE_DATA = 100111
200
+
201
+ # TessContour
202
+ GLU_CW = 100120
203
+ GLU_CCW = 100121
204
+ GLU_INTERIOR = 100122
205
+ GLU_EXTERIOR = 100123
206
+ GLU_UNKNOWN = 100124
207
+
208
+ # TessProperty
209
+ GLU_TESS_WINDING_RULE = 100140
210
+ GLU_TESS_BOUNDARY_ONLY = 100141
211
+ GLU_TESS_TOLERANCE = 100142
212
+
213
+ # TessError
214
+ GLU_TESS_ERROR1 = 100151
215
+ GLU_TESS_ERROR2 = 100152
216
+ GLU_TESS_ERROR3 = 100153
217
+ GLU_TESS_ERROR4 = 100154
218
+ GLU_TESS_ERROR5 = 100155
219
+ GLU_TESS_ERROR6 = 100156
220
+ GLU_TESS_ERROR7 = 100157
221
+ GLU_TESS_ERROR8 = 100158
222
+ GLU_TESS_MISSING_BEGIN_POLYGON = 100151
223
+ GLU_TESS_MISSING_BEGIN_CONTOUR = 100152
224
+ GLU_TESS_MISSING_END_POLYGON = 100153
225
+ GLU_TESS_MISSING_END_CONTOUR = 100154
226
+ GLU_TESS_COORD_TOO_LARGE = 100155
227
+ GLU_TESS_NEED_COMBINE_CALLBACK = 100156
228
+
229
+ # TessWinding
230
+ GLU_TESS_WINDING_ODD = 100130
231
+ GLU_TESS_WINDING_NONZERO = 100131
232
+ GLU_TESS_WINDING_POSITIVE = 100132
233
+ GLU_TESS_WINDING_NEGATIVE = 100133
234
+ GLU_TESS_WINDING_ABS_GEQ_TWO = 100134
235
+
236
+ GLU_TESS_MAX_COORD = 1.0e150
237
+
238
+ # typedefs
239
+ @@glu_cb_signature = {
240
+ :NurbsCallback => "void CallBackFunc()",
241
+ :QuadricCallback => "void CallBackFunc()",
242
+ :TessCallback => "void CallBackFunc()",
243
+ }
244
+ def self.create_callback( sym, *opts, &blk )
245
+ return bind( @@glu_cb_signature[sym], opts, &blk )
246
+ end
247
+
248
+ # struct
249
+
250
+ @@glu_import_done = false
251
+
252
+ # Load native library.
253
+ def self.load_lib(lib = nil, path = nil)
254
+ if lib == nil && path == nil
255
+ case OpenGL.get_platform
256
+ when :OPENGL_PLATFORM_WINDOWS
257
+ lib, path = 'GLU32.dll', 'C:/Windows/System32'
258
+ when :OPENGL_PLATFORM_MACOSX
259
+ lib, path = 'libGLU.dylib', '/System/Library/Frameworks/OpenGL.framework/Libraries'
260
+ else
261
+ lib = 'libGLU.so'
262
+ end
263
+ end
264
+ if path
265
+ dlload (path + '/' + lib)
266
+ else
267
+ dlload (lib)
268
+ end
269
+ import_symbols() unless @@glu_import_done
270
+ end
271
+
272
+ def self.load_dll(lib = nil, path = nil)
273
+ puts "Warning GLU.load_dll is deprecated, use GLU.load_lib instead"
274
+ self.load_lib(lib, path)
275
+ end
276
+
277
+ def self.import_symbols
278
+ # function
279
+ extern 'void gluBeginCurve (void*)'
280
+ extern 'void gluBeginPolygon (void*)'
281
+ extern 'void gluBeginSurface (void*)'
282
+ extern 'void gluBeginTrim (void*)'
283
+ # extern 'int gluBuild1DMipmapLevels (unsigned int, int, int, unsigned int, unsigned int, int, int, int, void*)' # Unavailable on Windows
284
+ extern 'int gluBuild1DMipmaps (unsigned int, int, int, unsigned int, unsigned int, void*)'
285
+ # extern 'int gluBuild2DMipmapLevels (unsigned int, int, int, int, unsigned int, unsigned int, int, int, int, void*)' # Unavailable on Windows
286
+ extern 'int gluBuild2DMipmaps (unsigned int, int, int, int, unsigned int, unsigned int, void*)'
287
+ # extern 'int gluBuild3DMipmapLevels (unsigned int, int, int, int, int, unsigned int, unsigned int, int, int, int, void*)' # Unavailable on Windows
288
+ # extern 'int gluBuild3DMipmaps (unsigned int, int, int, int, int, unsigned int, unsigned int, void*)' # Unavailable on Windows
289
+ # extern 'unsigned char gluCheckExtension ( unsigned char*, unsigned char*)' # Unavailable on Windows
290
+ extern 'void gluCylinder (void*, double, double, double, int, int)'
291
+ extern 'void gluDeleteNurbsRenderer (void*)'
292
+ extern 'void gluDeleteQuadric (void*)'
293
+ extern 'void gluDeleteTess (void*)'
294
+ extern 'void gluDisk (void*, double, double, int, int)'
295
+ extern 'void gluEndCurve (void*)'
296
+ extern 'void gluEndPolygon (void*)'
297
+ extern 'void gluEndSurface (void*)'
298
+ extern 'void gluEndTrim (void*)'
299
+ extern 'unsigned char* gluErrorString (unsigned int)'
300
+ extern 'void gluGetNurbsProperty (void*, unsigned int, float*)'
301
+ extern 'unsigned char* gluGetString (unsigned int)'
302
+ extern 'void gluGetTessProperty (void*, unsigned int, double*)'
303
+ extern 'void gluLoadSamplingMatrices (void*, float *, float *, int *)'
304
+ extern 'void gluLookAt (double, double, double , double, double , double, double , double, double)'
305
+ extern 'void* gluNewNurbsRenderer ()'
306
+ extern 'void* gluNewQuadric ()'
307
+ extern 'void* gluNewTess ()'
308
+ extern 'void gluNextContour (void*, unsigned int)'
309
+ extern 'void gluNurbsCallback (void*, unsigned int, void*)'
310
+ # extern 'void gluNurbsCallbackData (void*, void*)' # Unavailable on Windows
311
+ # extern 'void gluNurbsCallbackDataEXT (void*, void*)' # Unavailable on Windows
312
+ extern 'void gluNurbsCurve (void*, int, float *, int, float* , int, unsigned int)'
313
+ extern 'void gluNurbsProperty (void*, unsigned int, float)'
314
+ extern 'void gluNurbsSurface (void*, int, float*, int, float*, int, int, float*, int, int, unsigned int)'
315
+ extern 'void gluOrtho2D (double, double, double, double)'
316
+ extern 'void gluPartialDisk (void*, double, double, int, int, double, double)'
317
+ extern 'void gluPerspective (double, double, double, double)'
318
+ extern 'void gluPickMatrix (double, double, double, double, int *)'
319
+ extern 'int gluProject (double, double, double, double *, double *, int *, double*, double*, double*)'
320
+ extern 'void gluPwlCurve (void*, int, float*, int, unsigned int)'
321
+ extern 'void gluQuadricCallback (void*, unsigned int, void*)'
322
+ extern 'void gluQuadricDrawStyle (void*, unsigned int)'
323
+ extern 'void gluQuadricNormals (void*, unsigned int)'
324
+ extern 'void gluQuadricOrientation (void*, unsigned int)'
325
+ extern 'void gluQuadricTexture (void*, unsigned char)'
326
+ extern 'int gluScaleImage (unsigned int, int, int, unsigned int, void*, int, int, unsigned int, void*)'
327
+ extern 'void gluSphere (void*, double, int, int)'
328
+ extern 'void gluTessBeginContour (void*)'
329
+ extern 'void gluTessBeginPolygon (void*, void*)'
330
+ extern 'void gluTessCallback (void*, unsigned int, void*)'
331
+ extern 'void gluTessEndContour (void*)'
332
+ extern 'void gluTessEndPolygon (void*)'
333
+ extern 'void gluTessNormal (void*, double, double, double)'
334
+ extern 'void gluTessProperty (void*, unsigned int, double)'
335
+ extern 'void gluTessVertex (void*, double *, void*)'
336
+ extern 'int gluUnProject (double, double, double, double *, double *, int *, double*, double*, double*)'
337
+ # extern 'int gluUnProject4 (double, double, double, double, double *, double *, int *, double, double, double*, double*, double*, double*)' # Unavailable on Windows
338
+
339
+ @@glu_import_done = true
340
+ end
341
+
342
+ end
343
+
344
+ =begin
345
+ Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
346
+ Copyright (c) 2013-2021 vaiorabbit <http://twitter.com/vaiorabbit>
347
+
348
+ This software is provided 'as-is', without any express or implied
349
+ warranty. In no event will the authors be held liable for any damages
350
+ arising from the use of this software.
351
+
352
+ Permission is granted to anyone to use this software for any purpose,
353
+ including commercial applications, and to alter it and redistribute it
354
+ freely, subject to the following restrictions:
355
+
356
+ 1. The origin of this software must not be misrepresented; you must not
357
+ claim that you wrote the original software. If you use this software
358
+ in a product, an acknowledgment in the product documentation would be
359
+ appreciated but is not required.
360
+
361
+ 2. Altered source versions must be plainly marked as such, and must not be
362
+ misrepresented as being the original software.
363
+
364
+ 3. This notice may not be removed or altered from any source
365
+ distribution.
366
+ =end