ruby-opengl 0.33.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/Rakefile +42 -15
  2. data/doc/build_install.txt +70 -25
  3. data/doc/history.txt +4 -0
  4. data/doc/requirements_and_design.txt +2 -3
  5. data/doc/roadmap.txt +15 -2
  6. data/doc/screenshots.txt +23 -0
  7. data/doc/supplies/page_template.html +2 -1
  8. data/doc/thanks.txt +3 -0
  9. data/doc/tutorial.txt +5 -3
  10. data/examples/README +57 -7
  11. data/examples/legacy/COPYRIGHT +8 -0
  12. data/examples/{aaindex.rb → legacy/aaindex.rb} +6 -5
  13. data/examples/legacy/aapoly.rb +153 -0
  14. data/examples/legacy/aargb.rb +139 -0
  15. data/examples/legacy/accanti.rb +159 -0
  16. data/examples/legacy/accpersp.rb +216 -0
  17. data/examples/legacy/alpha.rb +133 -0
  18. data/examples/legacy/alpha3D.rb +165 -0
  19. data/examples/legacy/bezcurve.rb +107 -0
  20. data/examples/legacy/bezmesh.rb +131 -0
  21. data/examples/legacy/checker.rb +121 -0
  22. data/examples/legacy/clip.rb +104 -0
  23. data/examples/legacy/colormat.rb +145 -0
  24. data/examples/legacy/cube.rb +73 -0
  25. data/examples/legacy/depthcue.rb +101 -0
  26. data/examples/legacy/dof.rb +212 -0
  27. data/examples/legacy/double.rb +104 -0
  28. data/examples/legacy/drawf.rb +98 -0
  29. data/examples/legacy/feedback.rb +152 -0
  30. data/examples/legacy/fog.rb +172 -0
  31. data/examples/legacy/font-glut.rb +41 -0
  32. data/examples/legacy/font.rb +158 -0
  33. data/examples/legacy/hello.rb +75 -0
  34. data/examples/legacy/image.rb +145 -0
  35. data/examples/legacy/jitter.rb +209 -0
  36. data/examples/legacy/lines.rb +135 -0
  37. data/examples/legacy/list.rb +120 -0
  38. data/examples/legacy/material.rb +290 -0
  39. data/examples/legacy/mipmap.rb +159 -0
  40. data/examples/legacy/model.rb +119 -0
  41. data/examples/legacy/movelight.rb +140 -0
  42. data/examples/legacy/pickdepth.rb +180 -0
  43. data/examples/legacy/planet.rb +112 -0
  44. data/examples/legacy/quadric.rb +180 -0
  45. data/examples/legacy/readpixel.rb +59 -0
  46. data/examples/legacy/robot.rb +120 -0
  47. data/examples/legacy/select.rb +207 -0
  48. data/examples/{smooth_prev.rb → legacy/smooth.rb} +3 -2
  49. data/examples/legacy/stencil.rb +154 -0
  50. data/examples/legacy/stroke.rb +170 -0
  51. data/examples/legacy/surface.rb +170 -0
  52. data/examples/legacy/teaambient.rb +132 -0
  53. data/examples/legacy/teapots.rb +188 -0
  54. data/examples/legacy/tess.rb +222 -0
  55. data/examples/legacy/texbind.rb +157 -0
  56. data/examples/legacy/texgen.rb +171 -0
  57. data/examples/legacy/texturesurf.rb +128 -0
  58. data/examples/legacy/varray.rb +167 -0
  59. data/examples/legacy/wrap.rb +158 -0
  60. data/examples/nehe_lesson02.rb +117 -0
  61. data/examples/nehe_lesson03.rb +122 -0
  62. data/examples/nehe_lesson04.rb +133 -0
  63. data/examples/nehe_lesson05.rb +186 -0
  64. data/examples/plane.rb +1 -1
  65. data/examples/smooth.rb +4 -2
  66. data/examples/test.rb +3 -2
  67. data/ext/common/{rbogl.c → common.h} +99 -32
  68. data/ext/common/gl-enums.h +39 -1
  69. data/ext/gl/gl-1.0-1.1.c +350 -305
  70. data/ext/gl/gl-1.2.c +933 -38
  71. data/ext/gl/gl-1.3.c +725 -0
  72. data/ext/gl/gl-1.4.c +647 -0
  73. data/ext/gl/gl-1.5.c +362 -0
  74. data/ext/gl/gl-2.0.c +1632 -0
  75. data/ext/gl/gl-2.1.c +154 -0
  76. data/ext/gl/gl-enums.c +1 -2
  77. data/ext/gl/gl.c +58 -2
  78. data/ext/gl/mkrf_conf.rb +4 -1
  79. data/ext/glu/glu.c +5 -4
  80. data/ext/glu/mkrf_conf.rb +4 -1
  81. data/ext/glut/glut.c +7 -1
  82. data/ext/glut/mkrf_conf.rb +5 -0
  83. data/lib/gl_prev.rb +4 -3
  84. data/lib/glu_prev.rb +4 -3
  85. data/lib/glut_prev.rb +3 -3
  86. data/{examples/all_tests.rb → lib/opengl.rb} +9 -12
  87. data/test/README +5 -18
  88. data/test/tc_common.rb +79 -0
  89. data/test/tc_func_10_11.rb +1255 -0
  90. data/test/tc_func_12.rb +186 -0
  91. data/test/tc_func_13.rb +203 -0
  92. data/test/tc_func_14.rb +197 -0
  93. data/test/tc_func_15.rb +82 -0
  94. data/test/tc_func_20.rb +320 -0
  95. data/test/tc_func_21.rb +67 -0
  96. data/test/tc_include_gl.rb +1 -1
  97. data/test/{tc_opengl_namespace.rb → tc_misc.rb} +20 -20
  98. data/test/tc_require_gl.rb +1 -1
  99. metadata +99 -27
  100. data/ext/common/Rakefile +0 -39
  101. data/ext/common/rbogl.h +0 -52
  102. data/test/runtests.sh +0 -7
  103. data/test/tc_gl_vertex.rb +0 -180
data/ext/gl/gl-1.4.c ADDED
@@ -0,0 +1,647 @@
1
+ /*
2
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
3
+ *
4
+ * This program is distributed under the terms of the MIT license.
5
+ * See the included MIT-LICENSE file for the terms of this license.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
12
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
13
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ */
15
+
16
+ #ifdef __APPLE__
17
+ #include <OpenGL/gl.h>
18
+ #elif defined WIN32
19
+ #include <windows.h>
20
+ #include <GL/gl.h>
21
+ #else
22
+ #include <GL/gl.h>
23
+ #endif
24
+ #include "../common/common.h"
25
+
26
+ /* OpenGL 1.4 functions */
27
+
28
+ static void (APIENTRY * fptr_glBlendFuncSeparate)(GLenum,GLenum,GLenum,GLenum);
29
+ static VALUE
30
+ gl_BlendFuncSeparate(obj,arg1,arg2,arg3,arg4)
31
+ VALUE obj,arg1,arg2,arg3,arg4;
32
+ {
33
+ GLenum srcRGB;
34
+ GLenum dstRGB;
35
+ GLenum srcAlpha;
36
+ GLenum dstAlpha;
37
+ LOAD_GL_FUNC(glBlendFuncSeparate)
38
+ srcRGB = (GLenum)NUM2INT(arg1);
39
+ dstRGB = (GLenum)NUM2INT(arg2);
40
+ srcAlpha = (GLenum)NUM2INT(arg3);
41
+ dstAlpha = (GLenum)NUM2INT(arg4);
42
+ fptr_glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
43
+ return Qnil;
44
+ }
45
+
46
+ static void (APIENTRY * fptr_glFogCoordf)(GLfloat);
47
+ static VALUE
48
+ gl_FogCoordf(obj,arg1)
49
+ VALUE obj,arg1;
50
+ {
51
+ GLfloat coord;
52
+ LOAD_GL_FUNC(glFogCoordf)
53
+ coord=(GLfloat)NUM2DBL(arg1);
54
+ fptr_glFogCoordf(coord);
55
+ return Qnil;
56
+ }
57
+
58
+ static void (APIENTRY * fptr_glFogCoordfv)(GLfloat *);
59
+ static VALUE
60
+ gl_FogCoordfv(obj,arg1)
61
+ VALUE obj,arg1;
62
+ {
63
+ GLfloat coord;
64
+ LOAD_GL_FUNC(glFogCoordfv)
65
+ Check_Type(arg1,T_ARRAY);
66
+ ary2cflt(arg1,&coord,1);
67
+ fptr_glFogCoordfv(&coord);
68
+ return Qnil;
69
+ }
70
+
71
+ static void (APIENTRY * fptr_glFogCoordd)(GLdouble);
72
+ static VALUE
73
+ gl_FogCoordd(obj,arg1)
74
+ VALUE obj,arg1;
75
+ {
76
+ GLdouble coord;
77
+ LOAD_GL_FUNC(glFogCoordd)
78
+ coord=(GLdouble)NUM2DBL(arg1);
79
+ fptr_glFogCoordd(coord);
80
+ return Qnil;
81
+ }
82
+
83
+ static void (APIENTRY * fptr_glFogCoorddv)(GLdouble *);
84
+ static VALUE
85
+ gl_FogCoorddv(obj,arg1)
86
+ VALUE obj,arg1;
87
+ {
88
+ GLdouble coord;
89
+ LOAD_GL_FUNC(glFogCoorddv)
90
+ Check_Type(arg1,T_ARRAY);
91
+ ary2cdbl(arg1,&coord,1);
92
+ fptr_glFogCoorddv(&coord);
93
+ return Qnil;
94
+ }
95
+
96
+ extern VALUE g_FogCoord_ptr;
97
+ static void (APIENTRY * fptr_glFogCoordPointer)(GLenum,GLsizei,const GLvoid *);
98
+ static VALUE
99
+ gl_FogCoordPointer(obj,arg1,arg2,arg3)
100
+ VALUE obj,arg1,arg2,arg3;
101
+ {
102
+ GLenum type;
103
+ GLsizei stride;
104
+ LOAD_GL_FUNC(glFogCoordPointer)
105
+ type = (GLenum)NUM2INT(arg1);
106
+ stride = (GLsizei)NUM2UINT(arg2);
107
+ Check_Type(arg3, T_STRING);
108
+ rb_str_freeze(arg3);
109
+ g_FogCoord_ptr = arg3;
110
+ fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING(arg3)->ptr);
111
+ return Qnil;
112
+ }
113
+
114
+ static void (APIENTRY * fptr_glMultiDrawArrays)(GLenum,GLint*,GLsizei*,GLsizei);
115
+ static VALUE
116
+ gl_MultiDrawArrays(obj,arg1,arg2,arg3,arg4)
117
+ VALUE obj,arg1,arg2,arg3,arg4;
118
+ {
119
+ /* TODO: check ary1,ary2 if len < primcount then raise */
120
+ /* stringy ? */
121
+ GLenum mode;
122
+ GLsizei primcount;
123
+ GLint *ary1;
124
+ GLsizei *ary2;
125
+ LOAD_GL_FUNC(glMultiDrawArrays)
126
+ mode = (GLenum)NUM2INT(arg1);
127
+ primcount = (GLsizei)NUM2UINT(arg4);
128
+ ary1 = ALLOC_N(GLint,primcount);
129
+ ary2 = ALLOC_N(GLsizei,primcount);
130
+ ary2cint(arg2,ary1,primcount);
131
+ ary2cint(arg3,ary2,primcount);
132
+ fptr_glMultiDrawArrays(mode,ary1,ary2,primcount);
133
+ xfree(ary1);
134
+ xfree(ary2);
135
+ return Qnil;
136
+ }
137
+
138
+ static void (APIENTRY * fptr_glMultiDrawElements)(GLenum,const GLsizei *,GLenum,GLvoid **,GLsizei);
139
+ static VALUE
140
+ gl_MultiDrawElements(obj,arg1,arg2,arg3)
141
+ VALUE obj,arg1,arg2,arg3;
142
+ {
143
+ GLenum mode;
144
+ GLenum type;
145
+ GLsizei *counts;
146
+ GLvoid **indices;
147
+ GLint size;
148
+ RArray *ary;
149
+ int i;
150
+ LOAD_GL_FUNC(glMultiDrawElements)
151
+ mode = (GLenum)NUM2INT(arg1);
152
+ type = (GLenum)NUM2INT(arg2);
153
+ Check_Type(arg3,T_ARRAY);
154
+ ary = RARRAY(arg3);
155
+ size = ary->len;
156
+ counts = ALLOC_N(GLsizei,size);
157
+ indices = ALLOC_N(GLvoid*,size);
158
+ for (i=0;i<size;i++) {
159
+ indices[i] = RSTRING(ary->ptr[i])->ptr;
160
+ counts[i] = RSTRING(ary->ptr[i])->len;
161
+ }
162
+ fptr_glMultiDrawElements(mode,counts,type,indices,size);
163
+ xfree(counts);
164
+ xfree(indices);
165
+ return Qnil;
166
+ }
167
+
168
+ static void (APIENTRY * fptr_glPointParameterf)(GLenum,GLfloat);
169
+ static VALUE
170
+ gl_PointParameterf(obj,arg1,arg2)
171
+ VALUE obj,arg1,arg2;
172
+ {
173
+ GLenum pname;
174
+ GLfloat param;
175
+ LOAD_GL_FUNC(glPointParameterf)
176
+ pname = (GLenum)NUM2INT(arg1);
177
+ param = (GLfloat)NUM2INT(arg2);
178
+ fptr_glPointParameterf(pname,param);
179
+ return Qnil;
180
+ }
181
+
182
+ static void (APIENTRY * fptr_glPointParameterfv)(GLenum,GLfloat *);
183
+ static VALUE
184
+ gl_PointParameterfv(obj,arg1,arg2)
185
+ VALUE obj,arg1,arg2;
186
+ {
187
+ GLenum pname;
188
+ GLfloat params[3] = {0.0,0.0,0.0};
189
+ GLint size;
190
+ LOAD_GL_FUNC(glPointParameterfv)
191
+ pname = (GLenum)NUM2INT(arg1);
192
+ Check_Type(arg2,T_ARRAY);
193
+ if (pname==GL_POINT_DISTANCE_ATTENUATION)
194
+ size = 3;
195
+ else
196
+ size = 1;
197
+ ary2cflt(arg2,params,size);
198
+ fptr_glPointParameterfv(pname,params);
199
+ return Qnil;
200
+ }
201
+
202
+ static void (APIENTRY * fptr_glPointParameteri)(GLenum,GLint);
203
+ static VALUE
204
+ gl_PointParameteri(obj,arg1,arg2)
205
+ VALUE obj,arg1,arg2;
206
+ {
207
+ GLenum pname;
208
+ GLint param;
209
+ LOAD_GL_FUNC(glPointParameteri)
210
+ pname = (GLenum)NUM2INT(arg1);
211
+ param = (GLint)NUM2INT(arg2);
212
+ fptr_glPointParameteri(pname,param);
213
+ return Qnil;
214
+ }
215
+
216
+ static void (APIENTRY * fptr_glPointParameteriv)(GLenum,GLint *);
217
+ static VALUE
218
+ gl_PointParameteriv(obj,arg1,arg2)
219
+ VALUE obj,arg1,arg2;
220
+ {
221
+ GLenum pname;
222
+ GLint params[3] = {0.0,0.0,0.0};
223
+ GLint size;
224
+ LOAD_GL_FUNC(glPointParameteriv)
225
+ pname = (GLenum)NUM2INT(arg1);
226
+ Check_Type(arg2,T_ARRAY);
227
+ if (pname==GL_POINT_DISTANCE_ATTENUATION)
228
+ size = 3;
229
+ else
230
+ size = 1;
231
+ ary2cint(arg2,params,size);
232
+ fptr_glPointParameteriv(pname,params);
233
+ return Qnil;
234
+ }
235
+
236
+ static void (APIENTRY * fptr_glSecondaryColor3b)(GLbyte,GLbyte,GLbyte);
237
+ static VALUE
238
+ gl_SecondaryColor3b(obj,arg1,arg2,arg3)
239
+ VALUE obj,arg1,arg2,arg3;
240
+ {
241
+ GLbyte red;
242
+ GLbyte green;
243
+ GLbyte blue;
244
+ LOAD_GL_FUNC(glSecondaryColor3b)
245
+ red = (GLbyte)NUM2INT(arg1);
246
+ green = (GLbyte)NUM2INT(arg2);
247
+ blue = (GLbyte)NUM2INT(arg3);
248
+ fptr_glSecondaryColor3b(red,green,blue);
249
+ return Qnil;
250
+ }
251
+
252
+ static void (APIENTRY * fptr_glSecondaryColor3d)(GLdouble,GLdouble,GLdouble);
253
+ static VALUE
254
+ gl_SecondaryColor3d(obj,arg1,arg2,arg3)
255
+ VALUE obj,arg1,arg2,arg3;
256
+ {
257
+ GLdouble red;
258
+ GLdouble green;
259
+ GLdouble blue;
260
+ LOAD_GL_FUNC(glSecondaryColor3d)
261
+ red = (GLdouble)NUM2DBL(arg1);
262
+ green = (GLdouble)NUM2DBL(arg2);
263
+ blue = (GLdouble)NUM2DBL(arg3);
264
+ fptr_glSecondaryColor3d(red,green,blue);
265
+ return Qnil;
266
+ }
267
+
268
+ static void (APIENTRY * fptr_glSecondaryColor3f)(GLfloat,GLfloat,GLfloat);
269
+ static VALUE
270
+ gl_SecondaryColor3f(obj,arg1,arg2,arg3)
271
+ VALUE obj,arg1,arg2,arg3;
272
+ {
273
+ GLfloat red;
274
+ GLfloat green;
275
+ GLfloat blue;
276
+ LOAD_GL_FUNC(glSecondaryColor3f)
277
+ red = (GLfloat)NUM2DBL(arg1);
278
+ green = (GLfloat)NUM2DBL(arg2);
279
+ blue = (GLfloat)NUM2DBL(arg3);
280
+ fptr_glSecondaryColor3f(red,green,blue);
281
+ return Qnil;
282
+ }
283
+
284
+ static void (APIENTRY * fptr_glSecondaryColor3i)(GLint,GLint,GLint);
285
+ static VALUE
286
+ gl_SecondaryColor3i(obj,arg1,arg2,arg3)
287
+ VALUE obj,arg1,arg2,arg3;
288
+ {
289
+ GLint red;
290
+ GLint green;
291
+ GLint blue;
292
+ LOAD_GL_FUNC(glSecondaryColor3i)
293
+ red = (GLint)NUM2INT(arg1);
294
+ green = (GLint)NUM2INT(arg2);
295
+ blue = (GLint)NUM2INT(arg3);
296
+ fptr_glSecondaryColor3i(red,green,blue);
297
+ return Qnil;
298
+ }
299
+
300
+ static void (APIENTRY * fptr_glSecondaryColor3s)(GLshort,GLshort,GLshort);
301
+ static VALUE
302
+ gl_SecondaryColor3s(obj,arg1,arg2,arg3)
303
+ VALUE obj,arg1,arg2,arg3;
304
+ {
305
+ GLshort red;
306
+ GLshort green;
307
+ GLshort blue;
308
+ LOAD_GL_FUNC(glSecondaryColor3s)
309
+ red = (GLshort)NUM2INT(arg1);
310
+ green = (GLshort)NUM2INT(arg2);
311
+ blue = (GLshort)NUM2INT(arg3);
312
+ fptr_glSecondaryColor3s(red,green,blue);
313
+ return Qnil;
314
+ }
315
+
316
+ static void (APIENTRY * fptr_glSecondaryColor3ub)(GLubyte,GLubyte,GLubyte);
317
+ static VALUE
318
+ gl_SecondaryColor3ub(obj,arg1,arg2,arg3)
319
+ VALUE obj,arg1,arg2,arg3;
320
+ {
321
+ GLubyte red;
322
+ GLubyte green;
323
+ GLubyte blue;
324
+ LOAD_GL_FUNC(glSecondaryColor3ub)
325
+ red = (GLubyte)NUM2INT(arg1);
326
+ green = (GLubyte)NUM2INT(arg2);
327
+ blue = (GLubyte)NUM2INT(arg3);
328
+ fptr_glSecondaryColor3ub(red,green,blue);
329
+ return Qnil;
330
+ }
331
+
332
+ static void (APIENTRY * fptr_glSecondaryColor3ui)(GLuint,GLuint,GLuint);
333
+ static VALUE
334
+ gl_SecondaryColor3ui(obj,arg1,arg2,arg3)
335
+ VALUE obj,arg1,arg2,arg3;
336
+ {
337
+ GLuint red;
338
+ GLuint green;
339
+ GLuint blue;
340
+ LOAD_GL_FUNC(glSecondaryColor3ui)
341
+ red = (GLuint)NUM2UINT(arg1);
342
+ green = (GLuint)NUM2UINT(arg2);
343
+ blue = (GLuint)NUM2UINT(arg3);
344
+ fptr_glSecondaryColor3ui(red,green,blue);
345
+ return Qnil;
346
+ }
347
+
348
+ static void (APIENTRY * fptr_glSecondaryColor3us)(GLushort,GLushort,GLushort);
349
+ static VALUE
350
+ gl_SecondaryColor3us(obj,arg1,arg2,arg3)
351
+ VALUE obj,arg1,arg2,arg3;
352
+ {
353
+ GLushort red;
354
+ GLushort green;
355
+ GLushort blue;
356
+ LOAD_GL_FUNC(glSecondaryColor3us)
357
+ red = (GLushort)NUM2INT(arg1);
358
+ green = (GLushort)NUM2INT(arg2);
359
+ blue = (GLushort)NUM2INT(arg3);
360
+ fptr_glSecondaryColor3us(red,green,blue);
361
+ return Qnil;
362
+ }
363
+
364
+ #define GLSECONDARYCOLOR_VFUNC(_type_) \
365
+ static VALUE \
366
+ gl_SecondaryColor##_type_##v(argc,argv,obj) \
367
+ int argc; \
368
+ VALUE *argv; \
369
+ VALUE obj; \
370
+ { \
371
+ int num; \
372
+ VALUE args[3]; \
373
+ RArray *ary; \
374
+ switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \
375
+ case 1: \
376
+ if (TYPE(args[0]) == T_ARRAY) { \
377
+ ary = RARRAY(args[0]); \
378
+ switch (ary->len) { \
379
+ case 3: \
380
+ gl_SecondaryColor3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
381
+ break; \
382
+ default: \
383
+ rb_raise(rb_eArgError, "array length:%d", num); \
384
+ } \
385
+ } \
386
+ else \
387
+ rb_raise(rb_eArgError, "array length:%d", num); \
388
+ break; \
389
+ case 3: \
390
+ gl_SecondaryColor3##_type_(obj,args[0], args[1], args[2]); \
391
+ break; \
392
+ default: \
393
+ rb_raise(rb_eArgError, "too many arguments"); \
394
+ break; \
395
+ } \
396
+ return Qnil; \
397
+ }
398
+
399
+ GLSECONDARYCOLOR_VFUNC(b)
400
+ GLSECONDARYCOLOR_VFUNC(d)
401
+ GLSECONDARYCOLOR_VFUNC(f)
402
+ GLSECONDARYCOLOR_VFUNC(i)
403
+ GLSECONDARYCOLOR_VFUNC(s)
404
+ GLSECONDARYCOLOR_VFUNC(ui)
405
+ GLSECONDARYCOLOR_VFUNC(ub)
406
+ GLSECONDARYCOLOR_VFUNC(us)
407
+ #undef GLSECONDARYCOLOR_VFUNC
408
+
409
+ extern VALUE g_SecondaryColor_ptr;
410
+ static void (APIENTRY * fptr_glSecondaryColorPointer)(GLint,GLenum,GLsizei,const GLvoid *);
411
+ static VALUE
412
+ gl_SecondaryColorPointer(obj,arg1,arg2,arg3,arg4)
413
+ VALUE obj,arg1,arg2,arg3,arg4;
414
+ {
415
+ GLint size;
416
+ GLenum type;
417
+ GLsizei stride;
418
+ LOAD_GL_FUNC(glSecondaryColorPointer)
419
+ size = (GLint)NUM2INT(arg1);
420
+ type = (GLenum)NUM2INT(arg2);
421
+ stride = (GLsizei)NUM2UINT(arg3);
422
+ Check_Type(arg4, T_STRING);
423
+ rb_str_freeze(arg4);
424
+ g_SecondaryColor_ptr = arg4;
425
+ fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING(arg4)->ptr);
426
+ return Qnil;
427
+ }
428
+
429
+ static void (APIENTRY * fptr_glWindowPos2d)(GLdouble,GLdouble);
430
+ static VALUE
431
+ gl_WindowPos2d(obj,arg1,arg2)
432
+ VALUE obj,arg1,arg2;
433
+ {
434
+ GLdouble x;
435
+ GLdouble y;
436
+ LOAD_GL_FUNC(glWindowPos2d)
437
+ x = (GLdouble)NUM2DBL(arg1);
438
+ y = (GLdouble)NUM2DBL(arg2);
439
+ fptr_glWindowPos2d(x,y);
440
+ return Qnil;
441
+ }
442
+
443
+ static void (APIENTRY * fptr_glWindowPos2f)(GLfloat,GLfloat);
444
+ static VALUE
445
+ gl_WindowPos2f(obj,arg1,arg2)
446
+ VALUE obj,arg1,arg2;
447
+ {
448
+ GLfloat x;
449
+ GLfloat y;
450
+ LOAD_GL_FUNC(glWindowPos2f)
451
+ x = (GLfloat)NUM2DBL(arg1);
452
+ y = (GLfloat)NUM2DBL(arg2);
453
+ fptr_glWindowPos2f(x,y);
454
+ return Qnil;
455
+ }
456
+
457
+ static void (APIENTRY * fptr_glWindowPos2i)(GLint,GLint);
458
+ static VALUE
459
+ gl_WindowPos2i(obj,arg1,arg2)
460
+ VALUE obj,arg1,arg2;
461
+ {
462
+ GLint x;
463
+ GLint y;
464
+ LOAD_GL_FUNC(glWindowPos2i)
465
+ x = (GLint)NUM2INT(arg1);
466
+ y = (GLint)NUM2INT(arg2);
467
+ fptr_glWindowPos2i(x,y);
468
+ return Qnil;
469
+ }
470
+
471
+ static void (APIENTRY * fptr_glWindowPos2s)(GLshort,GLshort);
472
+ static VALUE
473
+ gl_WindowPos2s(obj,arg1,arg2)
474
+ VALUE obj,arg1,arg2;
475
+ {
476
+ GLshort x;
477
+ GLshort y;
478
+ LOAD_GL_FUNC(glWindowPos2s)
479
+ x = (GLshort)NUM2INT(arg1);
480
+ y = (GLshort)NUM2INT(arg2);
481
+ fptr_glWindowPos2s(x,y);
482
+ return Qnil;
483
+ }
484
+
485
+ static void (APIENTRY * fptr_glWindowPos3d)(GLdouble,GLdouble,GLdouble);
486
+ static VALUE
487
+ gl_WindowPos3d(obj,arg1,arg2,arg3)
488
+ VALUE obj,arg1,arg2,arg3;
489
+ {
490
+ GLdouble x;
491
+ GLdouble y;
492
+ GLdouble z;
493
+ LOAD_GL_FUNC(glWindowPos3d)
494
+ x = (GLdouble)NUM2DBL(arg1);
495
+ y = (GLdouble)NUM2DBL(arg2);
496
+ z = (GLdouble)NUM2DBL(arg3);
497
+ fptr_glWindowPos3d(x,y,z);
498
+ return Qnil;
499
+ }
500
+
501
+ static void (APIENTRY * fptr_glWindowPos3f)(GLfloat,GLfloat,GLfloat);
502
+ static VALUE
503
+ gl_WindowPos3f(obj,arg1,arg2,arg3)
504
+ VALUE obj,arg1,arg2,arg3;
505
+ {
506
+ GLfloat x;
507
+ GLfloat y;
508
+ GLfloat z;
509
+ LOAD_GL_FUNC(glWindowPos3f)
510
+ x = (GLfloat)NUM2DBL(arg1);
511
+ y = (GLfloat)NUM2DBL(arg2);
512
+ z = (GLfloat)NUM2DBL(arg3);
513
+ fptr_glWindowPos3f(x,y,z);
514
+ return Qnil;
515
+ }
516
+
517
+ static void (APIENTRY * fptr_glWindowPos3i)(GLint,GLint,GLint);
518
+ static VALUE
519
+ gl_WindowPos3i(obj,arg1,arg2,arg3)
520
+ VALUE obj,arg1,arg2,arg3;
521
+ {
522
+ GLint x;
523
+ GLint y;
524
+ GLint z;
525
+ LOAD_GL_FUNC(glWindowPos3i)
526
+ x = (GLint)NUM2INT(arg1);
527
+ y = (GLint)NUM2INT(arg2);
528
+ z = (GLint)NUM2INT(arg3);
529
+ fptr_glWindowPos3i(x,y,z);
530
+ return Qnil;
531
+ }
532
+
533
+ static void (APIENTRY * fptr_glWindowPos3s)(GLshort,GLshort,GLshort);
534
+ static VALUE
535
+ gl_WindowPos3s(obj,arg1,arg2,arg3)
536
+ VALUE obj,arg1,arg2,arg3;
537
+ {
538
+ GLshort x;
539
+ GLshort y;
540
+ GLshort z;
541
+ LOAD_GL_FUNC(glWindowPos3s)
542
+ x = (GLshort)NUM2INT(arg1);
543
+ y = (GLshort)NUM2INT(arg2);
544
+ z = (GLshort)NUM2INT(arg3);
545
+ fptr_glWindowPos3s(x,y,z);
546
+ return Qnil;
547
+ }
548
+
549
+ #define GLWINDOWPOS_VFUNC(_type_) \
550
+ static VALUE \
551
+ gl_WindowPos##_type_##v(argc,argv,obj) \
552
+ int argc; \
553
+ VALUE *argv; \
554
+ VALUE obj; \
555
+ { \
556
+ int num; \
557
+ VALUE args[3]; \
558
+ RArray *ary; \
559
+ switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \
560
+ case 1: \
561
+ if (TYPE(args[0]) == T_ARRAY) { \
562
+ ary = RARRAY(args[0]); \
563
+ switch (ary->len) { \
564
+ case 2: \
565
+ gl_WindowPos2##_type_(obj,ary->ptr[0],ary->ptr[1]); \
566
+ break; \
567
+ case 3: \
568
+ gl_WindowPos3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
569
+ break; \
570
+ default: \
571
+ rb_raise(rb_eArgError, "array length:%d", num); \
572
+ } \
573
+ } \
574
+ else \
575
+ rb_raise(rb_eArgError, "array length:%d", num); \
576
+ break; \
577
+ case 2: \
578
+ gl_WindowPos2##_type_(obj,args[0], args[1]); \
579
+ break; \
580
+ case 3: \
581
+ gl_WindowPos3##_type_(obj,args[0], args[1], args[2]); \
582
+ break; \
583
+ default: \
584
+ rb_raise(rb_eArgError, "too many arguments"); \
585
+ break; \
586
+ } \
587
+ return Qnil; \
588
+ }
589
+
590
+ GLWINDOWPOS_VFUNC(d)
591
+ GLWINDOWPOS_VFUNC(f)
592
+ GLWINDOWPOS_VFUNC(i)
593
+ GLWINDOWPOS_VFUNC(s)
594
+ #undef GLWINDOWPOS_VFUNC
595
+
596
+
597
+ void gl_init_functions_1_4(VALUE module)
598
+ {
599
+ rb_define_module_function(module, "glBlendFuncSeparate", gl_BlendFuncSeparate, 4);
600
+ rb_define_module_function(module, "glFogCoordf", gl_FogCoordf, 1);
601
+ rb_define_module_function(module, "glFogCoordfv", gl_FogCoordfv, 1);
602
+ rb_define_module_function(module, "glFogCoordd", gl_FogCoordd, 1);
603
+ rb_define_module_function(module, "glFogCoorddv", gl_FogCoorddv, 1);
604
+ rb_define_module_function(module, "glFogCoordPointer", gl_FogCoordPointer, 3);
605
+ rb_define_module_function(module, "glMultiDrawArrays", gl_MultiDrawArrays, 4);
606
+ rb_define_module_function(module, "glMultiDrawElements", gl_MultiDrawElements, 3);
607
+ rb_define_module_function(module, "glPointParameterf", gl_PointParameterf, 2);
608
+ rb_define_module_function(module, "glPointParameterfv", gl_PointParameterfv, 2);
609
+ rb_define_module_function(module, "glPointParameteri", gl_PointParameteri, 2);
610
+ rb_define_module_function(module, "glPointParameteriv", gl_PointParameteriv, 2);
611
+ rb_define_module_function(module, "glSecondaryColor3b", gl_SecondaryColor3b, 3);
612
+ rb_define_module_function(module, "glSecondaryColor3d", gl_SecondaryColor3d, 3);
613
+ rb_define_module_function(module, "glSecondaryColor3f", gl_SecondaryColor3f, 3);
614
+ rb_define_module_function(module, "glSecondaryColor3i", gl_SecondaryColor3i, 3);
615
+ rb_define_module_function(module, "glSecondaryColor3s", gl_SecondaryColor3s, 3);
616
+ rb_define_module_function(module, "glSecondaryColor3ub", gl_SecondaryColor3ub, 3);
617
+ rb_define_module_function(module, "glSecondaryColor3ui", gl_SecondaryColor3ui, 3);
618
+ rb_define_module_function(module, "glSecondaryColor3us", gl_SecondaryColor3us, 3);
619
+ rb_define_module_function(module, "glSecondaryColorPointer", gl_SecondaryColorPointer, 4);
620
+ rb_define_module_function(module, "glWindowPos2d", gl_WindowPos2d, 2);
621
+ rb_define_module_function(module, "glWindowPos2f", gl_WindowPos2f, 2);
622
+ rb_define_module_function(module, "glWindowPos2i", gl_WindowPos2i, 2);
623
+ rb_define_module_function(module, "glWindowPos2s", gl_WindowPos2s, 2);
624
+ rb_define_module_function(module, "glWindowPos3d", gl_WindowPos3d, 3);
625
+ rb_define_module_function(module, "glWindowPos3f", gl_WindowPos3f, 3);
626
+ rb_define_module_function(module, "glWindowPos3i", gl_WindowPos3i, 3);
627
+ rb_define_module_function(module, "glWindowPos3s", gl_WindowPos3s, 3);
628
+
629
+ /* Additional Functions */
630
+ rb_define_module_function(module, "glSecondaryColor3bv", gl_SecondaryColorbv, -1);
631
+ rb_define_module_function(module, "glSecondaryColor3dv", gl_SecondaryColordv, -1);
632
+ rb_define_module_function(module, "glSecondaryColor3fv", gl_SecondaryColorfv, -1);
633
+ rb_define_module_function(module, "glSecondaryColor3iv", gl_SecondaryColoriv, -1);
634
+ rb_define_module_function(module, "glSecondaryColor3sv", gl_SecondaryColorsv, -1);
635
+ rb_define_module_function(module, "glSecondaryColor3ubv", gl_SecondaryColorubv, -1);
636
+ rb_define_module_function(module, "glSecondaryColor3uiv", gl_SecondaryColoruiv, -1);
637
+ rb_define_module_function(module, "glSecondaryColor3usv", gl_SecondaryColorusv, -1);
638
+
639
+ rb_define_module_function(module, "glWindowPos2dv", gl_WindowPosdv, -1);
640
+ rb_define_module_function(module, "glWindowPos2fv", gl_WindowPosfv, -1);
641
+ rb_define_module_function(module, "glWindowPos2iv", gl_WindowPosiv, -1);
642
+ rb_define_module_function(module, "glWindowPos2sv", gl_WindowPossv, -1);
643
+ rb_define_module_function(module, "glWindowPos3dv", gl_WindowPosdv, -1);
644
+ rb_define_module_function(module, "glWindowPos3fv", gl_WindowPosfv, -1);
645
+ rb_define_module_function(module, "glWindowPos3iv", gl_WindowPosiv, -1);
646
+ rb_define_module_function(module, "glWindowPos3sv", gl_WindowPossv, -1);
647
+ }