ruby-opengl 0.40.1 → 0.50.0

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.
Files changed (154) hide show
  1. data/Rakefile +2 -2
  2. data/doc/build_install.txt +48 -28
  3. data/doc/extensions.txt +361 -0
  4. data/doc/history.txt +8 -2
  5. data/doc/requirements_and_design.txt +0 -13
  6. data/doc/roadmap.txt +11 -13
  7. data/doc/supplies/page_template.html +11 -5
  8. data/doc/thanks.txt +2 -4
  9. data/doc/tutorial.txt +1 -4
  10. data/examples/{nehe_lesson02.rb → NeHe/nehe_lesson02.rb} +0 -0
  11. data/examples/{nehe_lesson03.rb → NeHe/nehe_lesson03.rb} +0 -0
  12. data/examples/{nehe_lesson04.rb → NeHe/nehe_lesson04.rb} +0 -0
  13. data/examples/{nehe_lesson05.rb → NeHe/nehe_lesson05.rb} +0 -0
  14. data/examples/NeHe/nehe_lesson36.rb +303 -0
  15. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  16. data/examples/OrangeBook/brick.frag +36 -0
  17. data/examples/OrangeBook/brick.rb +388 -0
  18. data/examples/OrangeBook/brick.vert +41 -0
  19. data/examples/OrangeBook/particle.frag +17 -0
  20. data/examples/OrangeBook/particle.rb +424 -0
  21. data/examples/OrangeBook/particle.vert +38 -0
  22. data/examples/README +13 -83
  23. data/examples/RedBook/aaindex.rb +97 -0
  24. data/examples/RedBook/aapoly.rb +142 -0
  25. data/examples/RedBook/aargb.rb +119 -0
  26. data/examples/RedBook/accanti.rb +162 -0
  27. data/examples/RedBook/accpersp.rb +215 -0
  28. data/examples/RedBook/alpha.rb +123 -0
  29. data/examples/RedBook/alpha3D.rb +158 -0
  30. data/examples/RedBook/bezcurve.rb +105 -0
  31. data/examples/RedBook/bezmesh.rb +137 -0
  32. data/examples/RedBook/checker.rb +124 -0
  33. data/examples/RedBook/clip.rb +95 -0
  34. data/examples/RedBook/colormat.rb +135 -0
  35. data/examples/RedBook/cube.rb +69 -0
  36. data/examples/RedBook/depthcue.rb +99 -0
  37. data/examples/RedBook/dof.rb +205 -0
  38. data/examples/{legacy → RedBook}/double.rb +59 -58
  39. data/examples/{legacy → RedBook}/drawf.rb +47 -54
  40. data/examples/RedBook/feedback.rb +145 -0
  41. data/examples/RedBook/fog.rb +167 -0
  42. data/examples/RedBook/font.rb +151 -0
  43. data/examples/RedBook/hello.rb +79 -0
  44. data/examples/RedBook/image.rb +137 -0
  45. data/examples/{legacy → RedBook}/jitter.rb +60 -62
  46. data/examples/RedBook/lines.rb +128 -0
  47. data/examples/RedBook/list.rb +111 -0
  48. data/examples/RedBook/material.rb +275 -0
  49. data/examples/RedBook/mipmap.rb +156 -0
  50. data/examples/{legacy → RedBook}/model.rb +66 -72
  51. data/examples/{legacy → RedBook}/movelight.rb +67 -75
  52. data/examples/RedBook/pickdepth.rb +179 -0
  53. data/examples/{legacy → RedBook}/planet.rb +62 -66
  54. data/examples/RedBook/quadric.rb +158 -0
  55. data/examples/RedBook/robot.rb +115 -0
  56. data/examples/RedBook/select.rb +196 -0
  57. data/examples/RedBook/smooth.rb +95 -0
  58. data/examples/RedBook/stencil.rb +163 -0
  59. data/examples/RedBook/stroke.rb +167 -0
  60. data/examples/RedBook/surface.rb +166 -0
  61. data/examples/RedBook/teaambient.rb +132 -0
  62. data/examples/RedBook/teapots.rb +182 -0
  63. data/examples/RedBook/tess.rb +183 -0
  64. data/examples/RedBook/texbind.rb +147 -0
  65. data/examples/RedBook/texgen.rb +169 -0
  66. data/examples/RedBook/texturesurf.rb +128 -0
  67. data/examples/RedBook/varray.rb +159 -0
  68. data/examples/RedBook/wrap.rb +148 -0
  69. data/examples/misc/anisotropic.rb +194 -0
  70. data/examples/misc/font-glut.rb +46 -0
  71. data/examples/{plane.rb → misc/plane.rb} +0 -0
  72. data/examples/misc/readpixel.rb +65 -0
  73. data/examples/{smooth.rb → misc/smooth.rb} +0 -0
  74. data/examples/{test.rb → misc/test.rb} +0 -0
  75. data/ext/common/common.h +252 -70
  76. data/ext/common/gl-enums.h +6102 -7334
  77. data/ext/common/gl-types.h +47 -0
  78. data/ext/common/glu-enums.h +469 -0
  79. data/ext/gl/gl-1.0-1.1.c +842 -2464
  80. data/ext/gl/gl-1.2.c +217 -281
  81. data/ext/gl/gl-1.3.c +113 -133
  82. data/ext/gl/gl-1.4.c +98 -334
  83. data/ext/gl/gl-1.5.c +28 -34
  84. data/ext/gl/gl-2.0.c +26 -235
  85. data/ext/gl/gl-2.1.c +31 -124
  86. data/ext/gl/gl-enums.c +786 -631
  87. data/ext/gl/gl-ext-arb.c +66 -0
  88. data/ext/gl/gl-ext-ext.c +218 -0
  89. data/ext/gl/gl.c +138 -31
  90. data/ext/gl/mkrf_conf.rb +1 -0
  91. data/ext/glu/glu-enums.c +163 -0
  92. data/ext/glu/glu.c +1003 -1205
  93. data/ext/glu/mkrf_conf.rb +1 -0
  94. data/ext/glut/glut.c +1056 -1175
  95. data/lib/opengl.rb +90 -3
  96. data/test/tc_common.rb +26 -13
  97. data/test/tc_ext_arb.rb +73 -0
  98. data/test/tc_ext_ext.rb +74 -0
  99. data/test/tc_func_12.rb +8 -8
  100. data/test/tc_func_13.rb +17 -11
  101. data/test/tc_func_14.rb +8 -8
  102. data/test/tc_func_15.rb +190 -2
  103. data/test/tc_func_20.rb +36 -10
  104. data/test/tc_func_21.rb +445 -2
  105. data/test/tc_glu.rb +305 -0
  106. data/test/tc_misc.rb +1 -0
  107. metadata +84 -68
  108. data/doc/screenshots.txt +0 -23
  109. data/examples/legacy/COPYRIGHT +0 -8
  110. data/examples/legacy/aaindex.rb +0 -98
  111. data/examples/legacy/aapoly.rb +0 -153
  112. data/examples/legacy/aargb.rb +0 -139
  113. data/examples/legacy/accanti.rb +0 -159
  114. data/examples/legacy/accpersp.rb +0 -216
  115. data/examples/legacy/alpha.rb +0 -133
  116. data/examples/legacy/alpha3D.rb +0 -165
  117. data/examples/legacy/bezcurve.rb +0 -107
  118. data/examples/legacy/bezmesh.rb +0 -131
  119. data/examples/legacy/checker.rb +0 -121
  120. data/examples/legacy/clip.rb +0 -104
  121. data/examples/legacy/colormat.rb +0 -145
  122. data/examples/legacy/cube.rb +0 -73
  123. data/examples/legacy/depthcue.rb +0 -101
  124. data/examples/legacy/dof.rb +0 -212
  125. data/examples/legacy/feedback.rb +0 -152
  126. data/examples/legacy/fog.rb +0 -172
  127. data/examples/legacy/font-glut.rb +0 -41
  128. data/examples/legacy/font.rb +0 -158
  129. data/examples/legacy/hello.rb +0 -75
  130. data/examples/legacy/image.rb +0 -145
  131. data/examples/legacy/lines.rb +0 -135
  132. data/examples/legacy/list.rb +0 -120
  133. data/examples/legacy/material.rb +0 -290
  134. data/examples/legacy/mipmap.rb +0 -159
  135. data/examples/legacy/pickdepth.rb +0 -180
  136. data/examples/legacy/quadric.rb +0 -180
  137. data/examples/legacy/readpixel.rb +0 -59
  138. data/examples/legacy/robot.rb +0 -120
  139. data/examples/legacy/select.rb +0 -207
  140. data/examples/legacy/smooth.rb +0 -41
  141. data/examples/legacy/stencil.rb +0 -154
  142. data/examples/legacy/stroke.rb +0 -170
  143. data/examples/legacy/surface.rb +0 -170
  144. data/examples/legacy/teaambient.rb +0 -132
  145. data/examples/legacy/teapots.rb +0 -188
  146. data/examples/legacy/tess.rb +0 -222
  147. data/examples/legacy/texbind.rb +0 -157
  148. data/examples/legacy/texgen.rb +0 -171
  149. data/examples/legacy/texturesurf.rb +0 -128
  150. data/examples/legacy/varray.rb +0 -167
  151. data/examples/legacy/wrap.rb +0 -158
  152. data/lib/gl_prev.rb +0 -46
  153. data/lib/glu_prev.rb +0 -46
  154. data/lib/glut_prev.rb +0 -45
data/ext/gl/gl-1.3.c CHANGED
@@ -13,41 +13,12 @@
13
13
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  */
15
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
16
  #include "../common/common.h"
25
17
 
26
18
  /* OpenGL 1.3 functions */
27
19
 
28
- static void (APIENTRY * fptr_glActiveTexture)(GLenum);
29
- static VALUE
30
- gl_ActiveTexture(obj,arg1)
31
- VALUE obj,arg1;
32
- {
33
- GLenum texture;
34
- LOAD_GL_FUNC(glActiveTexture)
35
- texture = (GLenum)NUM2INT(arg1);
36
- fptr_glActiveTexture(texture);
37
- return Qnil;
38
- }
39
-
40
- static void (APIENTRY * fptr_glClientActiveTexture)(GLenum);
41
- static VALUE
42
- gl_ClientActiveTexture(obj,arg1)
43
- VALUE obj,arg1;
44
- {
45
- GLenum texture;
46
- LOAD_GL_FUNC(glClientActiveTexture)
47
- texture = (GLenum)NUM2INT(arg1);
48
- fptr_glClientActiveTexture(texture);
49
- return Qnil;
50
- }
20
+ GL_SIMPLE_FUNC_LOAD(ActiveTexture,1,GLenum,NUM2INT)
21
+ GL_SIMPLE_FUNC_LOAD(ClientActiveTexture,1,GLenum,NUM2INT)
51
22
 
52
23
  static void (APIENTRY * fptr_glMultiTexCoord1d)(GLenum,GLdouble);
53
24
  static VALUE
@@ -379,54 +350,25 @@ GLMULTITEXCOORD_VFUNC(i)
379
350
  GLMULTITEXCOORD_VFUNC(s)
380
351
  #undef GLTEXCOORD_VFUNC
381
352
 
382
-
383
- static void (APIENTRY * fptr_glLoadTransposeMatrixf)(const GLfloat[]);
384
- static VALUE
385
- gl_LoadTransposeMatrixf(obj,arg1)
386
- VALUE obj,arg1;
387
- {
388
- GLfloat m[4*4];
389
- LOAD_GL_FUNC(glLoadTransposeMatrixf)
390
- ary2cmat4x4flt(arg1, m);
391
- fptr_glLoadTransposeMatrixf(m);
392
- return Qnil;
393
- }
394
-
395
- static void (APIENTRY * fptr_glLoadTransposeMatrixd)(const GLdouble[]);
396
- static VALUE
397
- gl_LoadTransposeMatrixd(obj,arg1)
398
- VALUE obj,arg1;
399
- {
400
- GLdouble m[4*4];
401
- LOAD_GL_FUNC(glLoadTransposeMatrixd)
402
- ary2cmat4x4dbl(arg1, m);
403
- fptr_glLoadTransposeMatrixd(m);
404
- return Qnil;
353
+ #define TRANSPOSEMATRIX_FUNC(_name_,_type_,_shorttype_) \
354
+ static void (APIENTRY * fptr_gl##_name_)(const _type_[]); \
355
+ static VALUE \
356
+ gl_##_name_(obj,arg1) \
357
+ VALUE obj,arg1; \
358
+ { \
359
+ _type_ m[4*4]; \
360
+ LOAD_GL_FUNC(gl##_name_) \
361
+ ary2cmat4x4##_shorttype_(arg1, m); \
362
+ fptr_gl##_name_(m); \
363
+ return Qnil; \
405
364
  }
406
365
 
407
- static void (APIENTRY * fptr_glMultTransposeMatrixf)(const GLfloat[]);
408
- static VALUE
409
- gl_MultTransposeMatrixf(obj,arg1)
410
- VALUE obj,arg1;
411
- {
412
- GLfloat m[4*4];
413
- LOAD_GL_FUNC(glMultTransposeMatrixf)
414
- ary2cmat4x4flt(arg1, m);
415
- fptr_glMultTransposeMatrixf(m);
416
- return Qnil;
417
- }
366
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixf,GLfloat,flt)
367
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixd,GLdouble,dbl)
368
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixf,GLfloat,flt)
369
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixd,GLdouble,dbl)
418
370
 
419
- static void (APIENTRY * fptr_glMultTransposeMatrixd)(const GLdouble[]);
420
- static VALUE
421
- gl_MultTransposeMatrixd(obj,arg1)
422
- VALUE obj,arg1;
423
- {
424
- GLdouble m[4*4];
425
- LOAD_GL_FUNC(glMultTransposeMatrixd)
426
- ary2cmat4x4dbl(arg1, m);
427
- fptr_glMultTransposeMatrixd(m);
428
- return Qnil;
429
- }
371
+ #undef TRANSPOSEMATRIX_FUNC
430
372
 
431
373
  static void (APIENTRY * fptr_glSampleCoverage)(GLclampf,GLboolean);
432
374
  static VALUE
@@ -465,17 +407,21 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
465
407
  depth = (GLsizei)NUM2UINT(arg6);
466
408
  border = (GLint)NUM2INT(arg7);
467
409
  imagesize = (GLsizei)NUM2UINT(arg8);
468
- if (TYPE(arg9) == T_STRING) {
469
- if (RSTRING(arg9)->len < imagesize)
470
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
471
- pixels = RSTRING(arg9)->ptr;
472
- } else if (NIL_P(arg9)) {
473
- pixels = NULL;
410
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
411
+ fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,(GLvoid *)NUM2INT(arg9));
474
412
  } else {
475
- Check_Type(arg9,T_STRING); /* force exception */
476
- return Qnil;
413
+ if (TYPE(arg9) == T_STRING) {
414
+ if (RSTRING(arg9)->len < imagesize)
415
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
416
+ pixels = RSTRING(arg9)->ptr;
417
+ } else if (NIL_P(arg9)) {
418
+ pixels = NULL;
419
+ } else {
420
+ Check_Type(arg9,T_STRING); /* force exception */
421
+ return Qnil;
422
+ }
423
+ fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels);
477
424
  }
478
- fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels);
479
425
  return Qnil;
480
426
  }
481
427
 
@@ -500,17 +446,21 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
500
446
  height = (GLsizei)NUM2UINT(arg5);
501
447
  border = (GLint)NUM2INT(arg6);
502
448
  imagesize = (GLsizei)NUM2UINT(arg7);
503
- if (TYPE(arg8) == T_STRING) {
504
- if (RSTRING(arg8)->len < imagesize)
505
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len);
506
- pixels = RSTRING(arg8)->ptr;
507
- } else if (NIL_P(arg8)) {
508
- pixels = NULL;
449
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
450
+ fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,(GLvoid *)NUM2INT(arg8));
509
451
  } else {
510
- Check_Type(arg8,T_STRING); /* force exception */
511
- return Qnil;
452
+ if (TYPE(arg8) == T_STRING) {
453
+ if (RSTRING(arg8)->len < imagesize)
454
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len);
455
+ pixels = RSTRING(arg8)->ptr;
456
+ } else if (NIL_P(arg8)) {
457
+ pixels = NULL;
458
+ } else {
459
+ Check_Type(arg8,T_STRING); /* force exception */
460
+ return Qnil;
461
+ }
462
+ fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels);
512
463
  }
513
- fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels);
514
464
  return Qnil;
515
465
  }
516
466
 
@@ -533,17 +483,21 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
533
483
  width = (GLsizei)NUM2UINT(arg4);
534
484
  border = (GLint)NUM2INT(arg5);
535
485
  imagesize = (GLsizei)NUM2UINT(arg6);
536
- if (TYPE(arg7) == T_STRING) {
537
- if (RSTRING(arg7)->len < imagesize)
538
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
539
- pixels = RSTRING(arg7)->ptr;
540
- } else if (NIL_P(arg7)) {
541
- pixels = NULL;
486
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
487
+ fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,(GLvoid *)NUM2INT(arg7));
542
488
  } else {
543
- Check_Type(arg7,T_STRING); /* force exception */
544
- return Qnil;
489
+ if (TYPE(arg7) == T_STRING) {
490
+ if (RSTRING(arg7)->len < imagesize)
491
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
492
+ pixels = RSTRING(arg7)->ptr;
493
+ } else if (NIL_P(arg7)) {
494
+ pixels = NULL;
495
+ } else {
496
+ Check_Type(arg7,T_STRING); /* force exception */
497
+ return Qnil;
498
+ }
499
+ fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels);
545
500
  }
546
- fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels);
547
501
  return Qnil;
548
502
  }
549
503
 
@@ -574,15 +528,19 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
574
528
  depth = (GLsizei)NUM2UINT(arg8);
575
529
  format = (GLenum)NUM2INT(arg9);
576
530
  imagesize = (GLsizei)NUM2UINT(arg10);
577
- if (TYPE(arg11) == T_STRING) {
578
- if (RSTRING(arg11)->len < imagesize)
579
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len);
580
- pixels = RSTRING(arg11)->ptr;
531
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
532
+ fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,(GLvoid *)NUM2INT(arg11));
581
533
  } else {
582
- Check_Type(arg11,T_STRING); /* force exception */
583
- return Qnil;
534
+ if (TYPE(arg11) == T_STRING) {
535
+ if (RSTRING(arg11)->len < imagesize)
536
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len);
537
+ pixels = RSTRING(arg11)->ptr;
538
+ } else {
539
+ Check_Type(arg11,T_STRING); /* force exception */
540
+ return Qnil;
541
+ }
542
+ fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels);
584
543
  }
585
- fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels);
586
544
  return Qnil;
587
545
  }
588
546
 
@@ -609,15 +567,19 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
609
567
  height = (GLsizei)NUM2UINT(arg6);
610
568
  format = (GLenum)NUM2INT(arg7);
611
569
  imagesize = (GLsizei)NUM2UINT(arg8);
612
- if (TYPE(arg9) == T_STRING) {
613
- if (RSTRING(arg9)->len < imagesize)
614
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
615
- pixels = RSTRING(arg9)->ptr;
570
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
571
+ fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,(GLvoid *)NUM2INT(arg9));
616
572
  } else {
617
- Check_Type(arg9,T_STRING); /* force exception */
618
- return Qnil;
573
+ if (TYPE(arg9) == T_STRING) {
574
+ if (RSTRING(arg9)->len < imagesize)
575
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
576
+ pixels = RSTRING(arg9)->ptr;
577
+ } else {
578
+ Check_Type(arg9,T_STRING); /* force exception */
579
+ return Qnil;
580
+ }
581
+ fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels);
619
582
  }
620
- fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels);
621
583
  return Qnil;
622
584
  }
623
585
 
@@ -640,34 +602,52 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
640
602
  width = (GLsizei)NUM2UINT(arg4);
641
603
  format = (GLenum)NUM2INT(arg5);
642
604
  imagesize = (GLsizei)NUM2UINT(arg6);
643
- if (TYPE(arg7) == T_STRING) {
644
- if (RSTRING(arg7)->len < imagesize)
645
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
646
- pixels = RSTRING(arg7)->ptr;
605
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
606
+ fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,(GLvoid *)NUM2INT(arg7));
647
607
  } else {
648
- Check_Type(arg7,T_STRING); /* force exception */
649
- return Qnil;
608
+ if (TYPE(arg7) == T_STRING) {
609
+ if (RSTRING(arg7)->len < imagesize)
610
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
611
+ pixels = RSTRING(arg7)->ptr;
612
+ } else {
613
+ Check_Type(arg7,T_STRING); /* force exception */
614
+ return Qnil;
615
+ }
616
+ fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels);
650
617
  }
651
- fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels);
652
618
  return Qnil;
653
619
  }
654
620
 
655
621
  static void (APIENTRY * fptr_glGetCompressedTexImage)(GLenum,GLint,GLvoid*);
656
622
  static VALUE
657
- gl_GetCompressedTexImage(obj,arg1,arg2)
658
- VALUE obj,arg1,arg2;
623
+ gl_GetCompressedTexImage(argc,argv,obj)
624
+ int argc;
625
+ VALUE *argv;
626
+ VALUE obj;
659
627
  {
660
628
  GLenum target;
661
629
  GLint lod;
662
630
  GLsizei size = 0;
663
631
  VALUE data;
632
+ VALUE args[3];
633
+ int numargs;
664
634
  LOAD_GL_FUNC(glGetCompressedTexImage)
665
- target = (GLenum)NUM2INT(arg1);
666
- lod = (GLenum)NUM2INT(arg2);
667
- glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */
668
- data = allocate_buffer_with_string(size);
669
- fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING(data)->ptr);
670
- return data;
635
+ numargs = rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2]);
636
+ target = (GLenum)NUM2INT(args[0]);
637
+ lod = (GLenum)NUM2INT(args[1]);
638
+ switch(numargs) {
639
+ default:
640
+ case 2:
641
+ if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
642
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
643
+ glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */
644
+ data = allocate_buffer_with_string(size);
645
+ fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING(data)->ptr);
646
+ return data;
647
+ case 3:
648
+ fptr_glGetCompressedTexImage(target,lod,(GLvoid*)NUM2INT(args[2]));
649
+ return Qnil;
650
+ }
671
651
  }
672
652
 
673
653
  void gl_init_functions_1_3(VALUE module)
@@ -701,7 +681,7 @@ void gl_init_functions_1_3(VALUE module)
701
681
  rb_define_module_function(module, "glCompressedTexSubImage3D", gl_CompressedTexSubImage3D, 11);
702
682
  rb_define_module_function(module, "glCompressedTexSubImage2D", gl_CompressedTexSubImage2D, 9);
703
683
  rb_define_module_function(module, "glCompressedTexSubImage1D", gl_CompressedTexSubImage1D, 7);
704
- rb_define_module_function(module, "glGetCompressedTexImage", gl_GetCompressedTexImage, 2);
684
+ rb_define_module_function(module, "glGetCompressedTexImage", gl_GetCompressedTexImage, -1);
705
685
 
706
686
  /* Additional functions */
707
687
 
data/ext/gl/gl-1.4.c CHANGED
@@ -13,47 +13,28 @@
13
13
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  */
15
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
16
  #include "../common/common.h"
25
17
 
26
18
  /* 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
- }
19
+ GL_SIMPLE_FUNC_LOAD(BlendFuncSeparate,4,GLenum,NUM2INT)
20
+ GL_SIMPLE_FUNC_LOAD(FogCoordf,1,GLfloat,NUM2DBL)
21
+ GL_SIMPLE_FUNC_LOAD(FogCoordd,1,GLdouble,NUM2DBL)
22
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3b,3,GLbyte,NUM2INT)
23
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3d,3,GLdouble,NUM2DBL)
24
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3f,3,GLfloat,NUM2DBL)
25
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3i,3,GLint,NUM2INT)
26
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3s,3,GLshort,NUM2INT)
27
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3ub,3,GLubyte,NUM2INT)
28
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3ui,3,GLuint,NUM2UINT)
29
+ GL_SIMPLE_FUNC_LOAD(SecondaryColor3us,3,GLushort,NUM2INT)
30
+ GL_SIMPLE_FUNC_LOAD(WindowPos2d,2,GLdouble,NUM2DBL)
31
+ GL_SIMPLE_FUNC_LOAD(WindowPos2f,2,GLfloat,NUM2DBL)
32
+ GL_SIMPLE_FUNC_LOAD(WindowPos2i,2,GLint,NUM2INT)
33
+ GL_SIMPLE_FUNC_LOAD(WindowPos2s,2,GLshort,NUM2INT)
34
+ GL_SIMPLE_FUNC_LOAD(WindowPos3d,3,GLdouble,NUM2DBL)
35
+ GL_SIMPLE_FUNC_LOAD(WindowPos3f,3,GLfloat,NUM2DBL)
36
+ GL_SIMPLE_FUNC_LOAD(WindowPos3i,3,GLint,NUM2INT)
37
+ GL_SIMPLE_FUNC_LOAD(WindowPos3s,3,GLshort,NUM2INT)
57
38
 
58
39
  static void (APIENTRY * fptr_glFogCoordfv)(GLfloat *);
59
40
  static VALUE
@@ -68,18 +49,6 @@ VALUE obj,arg1;
68
49
  return Qnil;
69
50
  }
70
51
 
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
52
  static void (APIENTRY * fptr_glFogCoorddv)(GLdouble *);
84
53
  static VALUE
85
54
  gl_FogCoorddv(obj,arg1)
@@ -104,32 +73,38 @@ VALUE obj,arg1,arg2,arg3;
104
73
  LOAD_GL_FUNC(glFogCoordPointer)
105
74
  type = (GLenum)NUM2INT(arg1);
106
75
  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);
76
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
77
+ g_FogCoord_ptr = arg3;
78
+ fptr_glFogCoordPointer(type, stride, (const GLvoid*)NUM2INT(arg3));
79
+ } else {
80
+ Check_Type(arg3, T_STRING);
81
+ rb_str_freeze(arg3);
82
+ g_FogCoord_ptr = arg3;
83
+ fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING(arg3)->ptr);
84
+ }
111
85
  return Qnil;
112
86
  }
113
87
 
114
88
  static void (APIENTRY * fptr_glMultiDrawArrays)(GLenum,GLint*,GLsizei*,GLsizei);
115
89
  static VALUE
116
- gl_MultiDrawArrays(obj,arg1,arg2,arg3,arg4)
117
- VALUE obj,arg1,arg2,arg3,arg4;
90
+ gl_MultiDrawArrays(obj,arg1,arg2,arg3)
91
+ VALUE obj,arg1,arg2,arg3;
118
92
  {
119
- /* TODO: check ary1,ary2 if len < primcount then raise */
120
- /* stringy ? */
121
93
  GLenum mode;
122
- GLsizei primcount;
123
94
  GLint *ary1;
124
95
  GLsizei *ary2;
96
+ int len1,len2;
125
97
  LOAD_GL_FUNC(glMultiDrawArrays)
98
+ len1 = RARRAY(arg2)->len;
99
+ len2 = RARRAY(arg3)->len;
100
+ if (len1!=len2)
101
+ rb_raise(rb_eArgError, "Passed arrays must have same length");
126
102
  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);
103
+ ary1 = ALLOC_N(GLint,len1);
104
+ ary2 = ALLOC_N(GLsizei,len2);
105
+ ary2cint(arg2,ary1,len1);
106
+ ary2cint(arg3,ary2,len2);
107
+ fptr_glMultiDrawArrays(mode,ary1,ary2,len1);
133
108
  xfree(ary1);
134
109
  xfree(ary2);
135
110
  return Qnil;
@@ -137,8 +112,10 @@ VALUE obj,arg1,arg2,arg3,arg4;
137
112
 
138
113
  static void (APIENTRY * fptr_glMultiDrawElements)(GLenum,const GLsizei *,GLenum,GLvoid **,GLsizei);
139
114
  static VALUE
140
- gl_MultiDrawElements(obj,arg1,arg2,arg3)
141
- VALUE obj,arg1,arg2,arg3;
115
+ gl_MultiDrawElements(argc,argv,obj)
116
+ int argc;
117
+ VALUE *argv;
118
+ VALUE obj;
142
119
  {
143
120
  GLenum mode;
144
121
  GLenum type;
@@ -147,21 +124,51 @@ VALUE obj,arg1,arg2,arg3;
147
124
  GLint size;
148
125
  RArray *ary;
149
126
  int i;
127
+ VALUE args[4];
150
128
  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;
129
+ switch (rb_scan_args(argc, argv, "31", &args[0], &args[1], &args[2],&args[3])) {
130
+ default:
131
+ case 3:
132
+ if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING))
133
+ rb_raise(rb_eArgError, "Element array buffer bound, but offsets array missing");
134
+ mode = (GLenum)NUM2INT(args[0]);
135
+ type = (GLenum)NUM2INT(args[1]);
136
+ Check_Type(args[2],T_ARRAY);
137
+ ary = RARRAY(args[2]);
138
+ size = ary->len;
139
+ counts = ALLOC_N(GLsizei,size);
140
+ indices = ALLOC_N(GLvoid*,size);
141
+ for (i=0;i<size;i++) {
142
+ indices[i] = RSTRING(ary->ptr[i])->ptr;
143
+ counts[i] = RSTRING(ary->ptr[i])->len;
144
+ }
145
+ fptr_glMultiDrawElements(mode,counts,type,indices,size);
146
+ xfree(counts);
147
+ xfree(indices);
148
+ break;
149
+ case 4:
150
+ if (!CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING))
151
+ rb_raise(rb_eArgError, "Element array buffer not bound");
152
+ mode = (GLenum)NUM2INT(args[0]);
153
+ type = (GLenum)NUM2INT(args[1]);
154
+ Check_Type(args[2],T_ARRAY);
155
+ Check_Type(args[3],T_ARRAY);
156
+ if (RARRAY(args[2])->len != RARRAY(args[3])->len)
157
+ rb_raise(rb_eArgError, "Count and indices offset array must have same length");
158
+
159
+ size = RARRAY(args[2])->len;
160
+
161
+ counts = ALLOC_N(GLsizei,size);
162
+ indices = ALLOC_N(GLvoid*,size);
163
+ for (i=0;i<size;i++) {
164
+ counts[i] = NUM2INT(rb_ary_entry(args[2],i));
165
+ indices[i] = (GLvoid *) NUM2INT(rb_ary_entry(args[3],i));
166
+ }
167
+ fptr_glMultiDrawElements(mode,counts,type,indices,size);
168
+ xfree(counts);
169
+ xfree(indices);
170
+ break;
161
171
  }
162
- fptr_glMultiDrawElements(mode,counts,type,indices,size);
163
- xfree(counts);
164
- xfree(indices);
165
172
  return Qnil;
166
173
  }
167
174
 
@@ -233,134 +240,6 @@ VALUE obj,arg1,arg2;
233
240
  return Qnil;
234
241
  }
235
242
 
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
243
  #define GLSECONDARYCOLOR_VFUNC(_type_) \
365
244
  static VALUE \
366
245
  gl_SecondaryColor##_type_##v(argc,argv,obj) \
@@ -419,130 +298,15 @@ VALUE obj,arg1,arg2,arg3,arg4;
419
298
  size = (GLint)NUM2INT(arg1);
420
299
  type = (GLenum)NUM2INT(arg2);
421
300
  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);
301
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
302
+ g_SecondaryColor_ptr = arg4;
303
+ fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)NUM2INT(arg4));
304
+ } else {
305
+ Check_Type(arg4, T_STRING);
306
+ rb_str_freeze(arg4);
307
+ g_SecondaryColor_ptr = arg4;
308
+ fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING(arg4)->ptr);
309
+ }
546
310
  return Qnil;
547
311
  }
548
312
 
@@ -602,8 +366,8 @@ void gl_init_functions_1_4(VALUE module)
602
366
  rb_define_module_function(module, "glFogCoordd", gl_FogCoordd, 1);
603
367
  rb_define_module_function(module, "glFogCoorddv", gl_FogCoorddv, 1);
604
368
  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);
369
+ rb_define_module_function(module, "glMultiDrawArrays", gl_MultiDrawArrays, 3);
370
+ rb_define_module_function(module, "glMultiDrawElements", gl_MultiDrawElements, -1);
607
371
  rb_define_module_function(module, "glPointParameterf", gl_PointParameterf, 2);
608
372
  rb_define_module_function(module, "glPointParameterfv", gl_PointParameterfv, 2);
609
373
  rb_define_module_function(module, "glPointParameteri", gl_PointParameteri, 2);