opengl 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +2 -1
  5. data/.travis.yml +19 -0
  6. data/History.rdoc +26 -0
  7. data/Manifest.txt +3 -23
  8. data/README.rdoc +43 -37
  9. data/Rakefile +6 -62
  10. data/examples/NeHe/nehe_lesson02.rb +3 -2
  11. data/examples/NeHe/nehe_lesson03.rb +3 -2
  12. data/examples/NeHe/nehe_lesson04.rb +3 -1
  13. data/examples/NeHe/nehe_lesson05.rb +4 -1
  14. data/examples/NeHe/nehe_lesson06.rb +9 -6
  15. data/examples/NeHe/nehe_lesson07.rb +9 -6
  16. data/examples/NeHe/nehe_lesson08.rb +9 -6
  17. data/examples/NeHe/nehe_lesson09.rb +10 -6
  18. data/examples/NeHe/nehe_lesson11.rb +9 -6
  19. data/examples/NeHe/nehe_lesson12.rb +9 -6
  20. data/examples/NeHe/nehe_lesson16.rb +50 -47
  21. data/examples/NeHe/nehe_lesson19.rb +10 -7
  22. data/examples/NeHe/nehe_lesson36.rb +234 -229
  23. data/examples/OrangeBook/brick.rb +227 -225
  24. data/examples/OrangeBook/particle.rb +233 -231
  25. data/examples/RedBook/aapoly.rb +71 -70
  26. data/examples/RedBook/aargb.rb +54 -52
  27. data/examples/RedBook/accanti.rb +96 -94
  28. data/examples/RedBook/accpersp.rb +106 -104
  29. data/examples/RedBook/alpha.rb +54 -52
  30. data/examples/RedBook/alpha3D.rb +90 -88
  31. data/examples/RedBook/bezcurve.rb +48 -46
  32. data/examples/RedBook/bezmesh.rb +71 -69
  33. data/examples/RedBook/checker.rb +57 -55
  34. data/examples/RedBook/clip.rb +41 -39
  35. data/examples/RedBook/colormat.rb +72 -70
  36. data/examples/RedBook/cube.rb +39 -37
  37. data/examples/RedBook/depthcue.rb +37 -35
  38. data/examples/RedBook/dof.rb +110 -109
  39. data/examples/RedBook/double.rb +40 -38
  40. data/examples/RedBook/drawf.rb +30 -28
  41. data/examples/RedBook/feedback.rb +79 -77
  42. data/examples/RedBook/fog.rb +90 -89
  43. data/examples/RedBook/font.rb +78 -76
  44. data/examples/RedBook/hello.rb +29 -27
  45. data/examples/RedBook/image.rb +57 -55
  46. data/examples/RedBook/jitter.rb +131 -131
  47. data/examples/RedBook/light.rb +2 -1
  48. data/examples/RedBook/lines.rb +70 -68
  49. data/examples/RedBook/list.rb +48 -46
  50. data/examples/RedBook/material.rb +200 -199
  51. data/examples/RedBook/mipmap.rb +84 -82
  52. data/examples/RedBook/model.rb +55 -53
  53. data/examples/RedBook/movelight.rb +52 -50
  54. data/examples/RedBook/pickdepth.rb +103 -101
  55. data/examples/RedBook/planet.rb +46 -44
  56. data/examples/RedBook/quadric.rb +97 -95
  57. data/examples/RedBook/robot.rb +55 -53
  58. data/examples/RedBook/select.rb +118 -116
  59. data/examples/RedBook/smooth.rb +35 -33
  60. data/examples/RedBook/stencil.rb +96 -94
  61. data/examples/RedBook/stroke.rb +75 -73
  62. data/examples/RedBook/surface.rb +93 -91
  63. data/examples/RedBook/teaambient.rb +71 -69
  64. data/examples/RedBook/teapots.rb +105 -103
  65. data/examples/RedBook/tess.rb +96 -94
  66. data/examples/RedBook/texbind.rb +79 -77
  67. data/examples/RedBook/texgen.rb +88 -86
  68. data/examples/RedBook/texturesurf.rb +57 -55
  69. data/examples/RedBook/varray.rb +85 -83
  70. data/examples/RedBook/wrap.rb +76 -74
  71. data/examples/misc/OGLBench.rb +114 -113
  72. data/examples/misc/anisotropic.rb +154 -152
  73. data/examples/misc/fbo_test.rb +37 -36
  74. data/examples/misc/font-glut.rb +47 -46
  75. data/examples/misc/glfwtest.rb +16 -16
  76. data/examples/misc/plane.rb +13 -13
  77. data/examples/misc/readpixel.rb +66 -65
  78. data/examples/misc/sdltest.rb +21 -19
  79. data/examples/misc/trislam.rb +548 -547
  80. data/ext/opengl/common.h +16 -38
  81. data/ext/opengl/conv.h +39 -41
  82. data/ext/opengl/extconf.rb +4 -31
  83. data/ext/opengl/funcdef.h +126 -124
  84. data/ext/opengl/gl-1.0-1.1.c +1917 -1917
  85. data/ext/opengl/gl-1.2.c +4 -667
  86. data/ext/opengl/gl-1.3.c +9 -9
  87. data/ext/opengl/gl-1.4.c +8 -8
  88. data/ext/opengl/gl-1.5.c +1 -1
  89. data/ext/opengl/gl-2.0.c +392 -388
  90. data/ext/opengl/gl-3.0.c +493 -0
  91. data/ext/opengl/gl-enums.c +1523 -5
  92. data/ext/opengl/gl-enums.h +4679 -122
  93. data/ext/opengl/gl-error.c +7 -7
  94. data/ext/opengl/gl-error.h +4 -4
  95. data/ext/opengl/gl-ext-arb.c +468 -464
  96. data/ext/opengl/gl-ext-ext.c +18 -18
  97. data/ext/opengl/gl-ext-nv.c +15 -15
  98. data/ext/opengl/gl.c +2 -0
  99. data/ext/opengl/gl_buffer.c +92 -92
  100. data/ext/opengl/opengl.c +1 -7
  101. data/lib/opengl.rb +23 -59
  102. data/lib/opengl/test_case.rb +1 -2
  103. data/test/dummy.xorg.conf +140 -0
  104. data/test/test_gl.rb +18 -22
  105. data/test/test_gl_10_11.rb +220 -220
  106. data/test/test_gl_12.rb +11 -122
  107. data/test/test_gl_13.rb +202 -210
  108. data/test/test_gl_14.rb +16 -19
  109. data/test/test_gl_15.rb +2 -4
  110. data/test/test_gl_20.rb +45 -58
  111. data/test/test_gl_21.rb +46 -163
  112. data/test/test_gl_ext_arb.rb +54 -72
  113. data/test/test_gl_ext_ati.rb +0 -2
  114. data/test/test_gl_ext_ext.rb +66 -66
  115. data/test/test_gl_ext_gremedy.rb +8 -15
  116. data/test/test_gl_ext_nv.rb +109 -112
  117. data/test/test_opengl_buffer.rb +8 -25
  118. data/utils/README +0 -5
  119. data/utils/enumgen.rb +72 -76
  120. data/utils/extlistgen.rb +55 -55
  121. metadata +87 -66
  122. metadata.gz.sig +2 -0
  123. data/Rakefile.cross +0 -107
  124. data/docs/build_install.txt +0 -119
  125. data/docs/extensions.txt.in +0 -348
  126. data/docs/history.txt +0 -66
  127. data/docs/requirements_and_design.txt +0 -117
  128. data/docs/roadmap.txt +0 -28
  129. data/docs/scientific_use.txt +0 -35
  130. data/docs/supplies/page_template.html +0 -71
  131. data/docs/thanks.txt +0 -29
  132. data/docs/tutorial.txt +0 -469
  133. data/ext/opengl/glu-enums.c +0 -164
  134. data/ext/opengl/glu-enums.h +0 -463
  135. data/ext/opengl/glu.c +0 -1534
  136. data/ext/opengl/glut.c +0 -1145
  137. data/ext/opengl/glut_callbacks.c +0 -845
  138. data/lib/glu.rb +0 -1
  139. data/lib/glut.rb +0 -1
  140. data/test/test_glu.rb +0 -309
  141. data/utils/mkdn2html.rb +0 -59
  142. data/utils/post-mkdn2html.rb +0 -91
  143. data/website/images/ogl.jpg +0 -0
  144. data/website/images/tab_bottom.gif +0 -0
  145. data/website/style.css +0 -198
@@ -45,8 +45,8 @@ VALUE obj,arg1,arg2;
45
45
  rb_raise(rb_eArgError, "passed arrays must have the same length");
46
46
  textures = ALLOC_N(GLuint,size);
47
47
  priorities = ALLOC_N(GLclampf,size);
48
- ary2cuint(arg1,textures,size);
49
- ary2cflt(arg2,priorities,size);
48
+ ary2cuint(arg1,textures,size);
49
+ ary2cflt(arg2,priorities,size);
50
50
  fptr_glPrioritizeTexturesEXT(size,textures,priorities);
51
51
  xfree(textures);
52
52
  xfree(priorities);
@@ -71,7 +71,7 @@ VALUE obj,arg1;
71
71
  size = (GLsizei)RARRAY_LENINT(ary);
72
72
  textures = ALLOC_N(GLuint,size);
73
73
  residences = ALLOC_N(GLboolean,size);
74
- ary2cuint(ary,textures,size);
74
+ ary2cuint(ary,textures,size);
75
75
  r = fptr_glAreTexturesResidentEXT(size,textures,residences);
76
76
  retary = rb_ary_new2(size);
77
77
  if (r==GL_TRUE) { /* all are resident */
@@ -162,7 +162,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
162
162
  stride = (GLsizei)NUM2UINT(arg3);
163
163
  if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
164
164
  g_SecondaryColor_ptr = arg4;
165
- fptr_glSecondaryColorPointerEXT(size,type, stride, (const GLvoid*)NUM2LONG(arg4));
165
+ fptr_glSecondaryColorPointerEXT(size,type, stride, (const GLvoid*)NUM2SIZET(arg4));
166
166
  } else {
167
167
  VALUE data;
168
168
  data = pack_array_or_pass_string(type,arg4);
@@ -196,7 +196,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
196
196
  count = (GLsizei)NUM2UINT(arg4);
197
197
  type = (GLenum)NUM2INT(arg5);
198
198
  if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
199
- fptr_glDrawRangeElementsEXT(mode, start, end, count, type, (GLvoid *)NUM2LONG(arg6));
199
+ fptr_glDrawRangeElementsEXT(mode, start, end, count, type, (GLvoid *)NUM2SIZET(arg6));
200
200
  } else {
201
201
  VALUE data;
202
202
  data = pack_array_or_pass_string(type,arg6);
@@ -287,7 +287,7 @@ VALUE obj;
287
287
  indices = ALLOC_N(GLvoid*,size);
288
288
  for (i=0;i<size;i++) {
289
289
  counts[i] = NUM2INT(rb_ary_entry(args[2],i));
290
- indices[i] = (GLvoid *)NUM2LONG(rb_ary_entry(args[3],i));
290
+ indices[i] = (GLvoid *)NUM2SIZET(rb_ary_entry(args[3],i));
291
291
  }
292
292
  fptr_glMultiDrawElementsEXT(mode,counts,type,indices,size);
293
293
  xfree(counts);
@@ -331,7 +331,7 @@ VALUE obj,arg1,arg2,arg3;
331
331
  stride = (GLsizei)NUM2UINT(arg2);
332
332
  if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
333
333
  g_FogCoord_ptr = arg3;
334
- fptr_glFogCoordPointerEXT(type, stride, (const GLvoid*)NUM2LONG(arg3));
334
+ fptr_glFogCoordPointerEXT(type, stride, (const GLvoid*)NUM2SIZET(arg3));
335
335
  } else {
336
336
  VALUE data;
337
337
  data = pack_array_or_pass_string(type,arg3);
@@ -451,14 +451,14 @@ PROGRAMPARAM_MULTI_FUNC_V(ProgramLocalParameters4fvEXT,GLfloat,ary2cflt,"GL_EXT_
451
451
  GL_FUNC_LOAD_3(ProgramParameteriEXT,GLvoid, GLuint,GLenum,GLint, "GL_EXT_geometry_shader4")
452
452
 
453
453
  /* #326 - GL_EXT_gpu_shader4 */
454
- GL_FUNC_LOAD_2(VertexAttribI1iEXT,GLvoid, GLuint,GLint, "GL_ARB_shader_objects")
455
- GL_FUNC_LOAD_3(VertexAttribI2iEXT,GLvoid, GLuint,GLint,GLint, "GL_ARB_shader_objects")
456
- GL_FUNC_LOAD_4(VertexAttribI3iEXT,GLvoid, GLuint,GLint,GLint,GLint, "GL_ARB_shader_objects")
457
- GL_FUNC_LOAD_5(VertexAttribI4iEXT,GLvoid, GLuint,GLint,GLint,GLint,GLint, "GL_ARB_shader_objects")
458
- GL_FUNC_LOAD_2(VertexAttribI1uiEXT,GLvoid, GLuint,GLuint, "GL_ARB_shader_objects")
459
- GL_FUNC_LOAD_3(VertexAttribI2uiEXT,GLvoid, GLuint,GLuint,GLuint, "GL_ARB_shader_objects")
460
- GL_FUNC_LOAD_4(VertexAttribI3uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint, "GL_ARB_shader_objects")
461
- GL_FUNC_LOAD_5(VertexAttribI4uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint,GLuint, "GL_ARB_shader_objects")
454
+ GL_FUNC_LOAD_2(VertexAttribI1iEXT,GLvoid, GLuint,GLint, "GL_EXT_gpu_shader4")
455
+ GL_FUNC_LOAD_3(VertexAttribI2iEXT,GLvoid, GLuint,GLint,GLint, "GL_EXT_gpu_shader4")
456
+ GL_FUNC_LOAD_4(VertexAttribI3iEXT,GLvoid, GLuint,GLint,GLint,GLint, "GL_EXT_gpu_shader4")
457
+ GL_FUNC_LOAD_5(VertexAttribI4iEXT,GLvoid, GLuint,GLint,GLint,GLint,GLint, "GL_EXT_gpu_shader4")
458
+ GL_FUNC_LOAD_2(VertexAttribI1uiEXT,GLvoid, GLuint,GLuint, "GL_EXT_gpu_shader4")
459
+ GL_FUNC_LOAD_3(VertexAttribI2uiEXT,GLvoid, GLuint,GLuint,GLuint, "GL_EXT_gpu_shader4")
460
+ GL_FUNC_LOAD_4(VertexAttribI3uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint, "GL_EXT_gpu_shader4")
461
+ GL_FUNC_LOAD_5(VertexAttribI4uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint,GLuint, "GL_EXT_gpu_shader4")
462
462
 
463
463
  #define GLVERTEXATTRIB_VFUNC(_name_,_type_,_conv_,_size_) \
464
464
  static void (APIENTRY * fptr_gl##_name_)(GLuint,const _type_ *); \
@@ -467,7 +467,7 @@ gl_##_name_(obj,arg1,arg2) \
467
467
  VALUE obj,arg1,arg2; \
468
468
  { \
469
469
  _type_ value[_size_]; \
470
- LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
470
+ LOAD_GL_FUNC(gl##_name_, "GL_EXT_gpu_shader4"); \
471
471
  _conv_(arg2,value,_size_); \
472
472
  fptr_gl##_name_(NUM2UINT(arg1),value); \
473
473
  CHECK_GLERROR_FROM("gl" #_name_); \
@@ -534,7 +534,7 @@ static VALUE gl_VertexAttribIPointerEXT(VALUE obj,VALUE arg1,VALUE arg2,VALUE ar
534
534
 
535
535
  if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
536
536
  g_VertexAttrib_ptr[index] = arg5;
537
- fptr_glVertexAttribIPointerEXT(index,size,type,stride,(GLvoid *)NUM2LONG(arg5));
537
+ fptr_glVertexAttribIPointerEXT(index,size,type,stride,(GLvoid *)NUM2SIZET(arg5));
538
538
  } else {
539
539
  VALUE data;
540
540
  data = pack_array_or_pass_string(type,arg5);
@@ -653,7 +653,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5;
653
653
  type = (GLenum)NUM2INT(arg3);
654
654
  primcount = (GLsizei)NUM2INT(arg5);
655
655
  if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
656
- fptr_glDrawElementsInstancedEXT(mode, count, type, (const GLvoid*)NUM2LONG(arg4), primcount);
656
+ fptr_glDrawElementsInstancedEXT(mode, count, type, (const GLvoid*)NUM2SIZET(arg4), primcount);
657
657
  } else {
658
658
  VALUE data;
659
659
  data = pack_array_or_pass_string(type,arg4);
@@ -70,7 +70,7 @@ static VALUE gl_GetProgramStringNV(VALUE obj,VALUE arg1,VALUE arg2)
70
70
  CHECK_GLERROR_FROM("glGetProgramivNV");
71
71
  if (len<=0)
72
72
  return rb_str_new2("");
73
-
73
+
74
74
  buffer = ALLOC_N(GLchar,len+1);
75
75
  memset(buffer,0,sizeof(GLchar) * (len+1));
76
76
  fptr_glGetProgramStringNV(NUM2INT(arg1),NUM2INT(arg2),buffer);
@@ -118,7 +118,7 @@ static VALUE gl_VertexAttribPointerNV(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3
118
118
 
119
119
  if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
120
120
  g_VertexAttrib_ptr[index] = arg5;
121
- fptr_glVertexAttribPointerNV(index,size,type,stride,(GLvoid *)NUM2LONG(arg5));
121
+ fptr_glVertexAttribPointerNV(index,size,type,stride,(GLvoid *)NUM2SIZET(arg5));
122
122
  } else {
123
123
  VALUE data;
124
124
  data = pack_array_or_pass_string(type,arg5);
@@ -355,7 +355,7 @@ static VALUE gl_RequestResidentProgramsNV(VALUE obj,VALUE arg1)
355
355
  GLuint *programs;
356
356
  n = (GLsizei)RARRAY_LENINT(arg1);
357
357
  programs = ALLOC_N(GLuint,n);
358
- ary2cuint(arg1,programs,n);
358
+ ary2cuint(arg1,programs,n);
359
359
  fptr_glRequestResidentProgramsNV( n, programs);
360
360
  xfree(programs);
361
361
  } else {
@@ -382,7 +382,7 @@ static VALUE gl_AreProgramsResidentNV(VALUE obj,VALUE arg1)
382
382
  size = (GLsizei)RARRAY_LENINT(ary);
383
383
  programs = ALLOC_N(GLuint,size);
384
384
  residences = ALLOC_N(GLboolean,size);
385
- ary2cuint(ary,programs,size);
385
+ ary2cuint(ary,programs,size);
386
386
  r = fptr_glAreProgramsResidentNV(size,programs,residences);
387
387
  retary = rb_ary_new2(size);
388
388
  if (r==GL_TRUE) { /* all are resident */
@@ -530,7 +530,7 @@ GETPROGRAMPARAM_FUNC_2(GetProgramEnvParameterIuivNV,GLuint,"GL_NV_gpu_program4")
530
530
  #undef GETPROGRAMPARAM_FUNC_2
531
531
 
532
532
  /* #323 GL_NV_geometry_program4 */
533
- GL_FUNC_LOAD_2(ProgramVertexLimitNV,GLvoid, GLenum,GLint, "GL_NV_gpu_program4")
533
+ GL_FUNC_LOAD_2(ProgramVertexLimitNV,GLvoid, GLenum,GLint, "GL_EXT_geometry_shader4")
534
534
  GL_FUNC_LOAD_4(FramebufferTextureEXT,GLvoid, GLenum,GLenum,GLuint,GLuint, "GL_EXT_geometry_shader4")
535
535
  GL_FUNC_LOAD_5(FramebufferTextureLayerEXT,GLvoid, GLenum,GLenum,GLuint,GLint,GLint, "GL_EXT_geometry_shader4")
536
536
  GL_FUNC_LOAD_5(FramebufferTextureFaceEXT,GLvoid, GLenum,GLenum,GLuint,GLint,GLenum, "GL_EXT_geometry_shader4")
@@ -545,7 +545,7 @@ GL_FUNC_LOAD_6(RenderbufferStorageMultisampleCoverageNV,GLvoid, GLenum,GLsizei,G
545
545
 
546
546
  void gl_init_functions_ext_nv(VALUE module)
547
547
  {
548
- /* #222 GL_NV_fence */
548
+ /* #222 GL_NV_fence */
549
549
  rb_define_module_function(module, "glGenFencesNV", gl_GenFencesNV, 1);
550
550
  rb_define_module_function(module, "glDeleteFencesNV", gl_DeleteFencesNV, 1);
551
551
  rb_define_module_function(module, "glSetFenceNV", gl_SetFenceNV, 2);
@@ -554,7 +554,7 @@ void gl_init_functions_ext_nv(VALUE module)
554
554
  rb_define_module_function(module, "glIsFenceNV", gl_IsFenceNV, 1);
555
555
  rb_define_module_function(module, "glGetFenceivNV", gl_GetFenceivNV, 2);
556
556
 
557
- /* #233 GL_NV_vertex_program */
557
+ /* #233 GL_NV_vertex_program */
558
558
  rb_define_module_function(module, "glLoadProgramNV", gl_LoadProgramNV, 3);
559
559
  rb_define_module_function(module, "glGetProgramStringNV", gl_GetProgramStringNV, 2);
560
560
  rb_define_module_function(module, "glGetProgramivNV", gl_GetProgramivNV, 2);
@@ -620,7 +620,7 @@ void gl_init_functions_ext_nv(VALUE module)
620
620
  rb_define_module_function(module, "glRequestResidentProgramsNV", gl_RequestResidentProgramsNV, 1);
621
621
  rb_define_module_function(module, "glAreProgramsResidentNV", gl_AreProgramsResidentNV, 1);
622
622
 
623
- /* #261 GL_NV_occlusion_query */
623
+ /* #261 GL_NV_occlusion_query */
624
624
  rb_define_module_function(module, "glGenOcclusionQueriesNV", gl_GenOcclusionQueriesNV, 1);
625
625
  rb_define_module_function(module, "glDeleteOcclusionQueriesNV", gl_DeleteOcclusionQueriesNV, 1);
626
626
  rb_define_module_function(module, "glIsOcclusionQueryNV", gl_IsOcclusionQueryNV, 1);
@@ -629,11 +629,11 @@ void gl_init_functions_ext_nv(VALUE module)
629
629
  rb_define_module_function(module, "glGetOcclusionQueryivNV", gl_GetOcclusionQueryivNV, 2);
630
630
  rb_define_module_function(module, "glGetOcclusionQueryuivNV", gl_GetOcclusionQueryuivNV, 2);
631
631
 
632
- /* #262 GL_NV_point_sprite */
632
+ /* #262 GL_NV_point_sprite */
633
633
  rb_define_module_function(module, "glPointParameteriNV", gl_PointParameteriNV, 2);
634
634
  rb_define_module_function(module, "glPointParameterivNV", gl_PointParameterivNV, 2);
635
635
 
636
- /* #282 GL_NV_fragment_program */
636
+ /* #282 GL_NV_fragment_program */
637
637
  rb_define_module_function(module, "glProgramNamedParameter4fNV", gl_ProgramNamedParameter4fNV, 6);
638
638
  rb_define_module_function(module, "glProgramNamedParameter4dNV", gl_ProgramNamedParameter4dNV, 6);
639
639
  rb_define_module_function(module, "glProgramNamedParameter4fvNV", gl_ProgramNamedParameter4fvNV, 3);
@@ -641,11 +641,11 @@ void gl_init_functions_ext_nv(VALUE module)
641
641
  rb_define_module_function(module, "glGetProgramNamedParameterdvNV", gl_GetProgramNamedParameterdvNV, 2);
642
642
  rb_define_module_function(module, "glGetProgramNamedParameterfvNV", gl_GetProgramNamedParameterfvNV, 2);
643
643
 
644
- /* #285 GL_NV_primitive_restart */
644
+ /* #285 GL_NV_primitive_restart */
645
645
  rb_define_module_function(module, "glPrimitiveRestartNV", gl_PrimitiveRestartNV, 0);
646
646
  rb_define_module_function(module, "glPrimitiveRestartIndexNV", gl_PrimitiveRestartIndexNV, 1);
647
647
 
648
- /* #322 GL_NV_gpu_program4 */
648
+ /* #322 GL_NV_gpu_program4 */
649
649
  rb_define_module_function(module, "glProgramLocalParameterI4iNV", gl_ProgramLocalParameterI4iNV, 6);
650
650
  rb_define_module_function(module, "glProgramLocalParameterI4uiNV", gl_ProgramLocalParameterI4uiNV, 6);
651
651
  rb_define_module_function(module, "glProgramLocalParameterI4ivNV", gl_ProgramLocalParameterI4ivNV, 3);
@@ -663,18 +663,18 @@ void gl_init_functions_ext_nv(VALUE module)
663
663
  rb_define_module_function(module, "glGetProgramEnvParameterIivNV", gl_GetProgramEnvParameterIivNV, 2);
664
664
  rb_define_module_function(module, "glGetProgramEnvParameterIuivNV", gl_GetProgramEnvParameterIuivNV, 2);
665
665
 
666
- /* #323 GL_NV_geometry_program4 */
666
+ /* #323 GL_NV_geometry_program4 */
667
667
  rb_define_module_function(module, "glProgramVertexLimitNV", gl_ProgramVertexLimitNV, 2);
668
668
  rb_define_module_function(module, "glFramebufferTextureEXT", gl_FramebufferTextureEXT, 4);
669
669
  rb_define_module_function(module, "glFramebufferTextureLayerEXT", gl_FramebufferTextureLayerEXT, 5);
670
670
  rb_define_module_function(module, "glFramebufferTextureFaceEXT", gl_FramebufferTextureFaceEXT, 5);
671
671
 
672
- /* #334 GL_NV_depth_buffer_float */
672
+ /* #334 GL_NV_depth_buffer_float */
673
673
  rb_define_module_function(module, "glDepthRangedNV", gl_DepthRangedNV, 2);
674
674
  rb_define_module_function(module, "glClearDepthdNV", gl_ClearDepthdNV, 1);
675
675
  rb_define_module_function(module, "glDepthBoundsdNV", gl_DepthBoundsdNV, 2);
676
676
 
677
- /* #336 GL_NV_framebuffer_multisample_coverage */
677
+ /* #336 GL_NV_framebuffer_multisample_coverage */
678
678
  rb_define_module_function(module, "glRenderbufferStorageMultisampleCoverageNV", gl_RenderbufferStorageMultisampleCoverageNV, 6);
679
679
 
680
680
  }
@@ -27,6 +27,7 @@ void gl_init_functions_1_4(VALUE);
27
27
  void gl_init_functions_1_5(VALUE);
28
28
  void gl_init_functions_2_0(VALUE);
29
29
  void gl_init_functions_2_1(VALUE);
30
+ void gl_init_functions_3_0(VALUE);
30
31
  void gl_init_functions_ext_3dfx(VALUE);
31
32
  void gl_init_functions_ext_arb(VALUE);
32
33
  void gl_init_functions_ext_ati(VALUE);
@@ -202,6 +203,7 @@ DLLEXPORT void Init_gl()
202
203
  gl_init_functions_1_5(module);
203
204
  gl_init_functions_2_0(module);
204
205
  gl_init_functions_2_1(module);
206
+ gl_init_functions_3_0(module);
205
207
  gl_init_functions_ext_3dfx(module);
206
208
  gl_init_functions_ext_arb(module);
207
209
  gl_init_functions_ext_ati(module);
@@ -4,174 +4,174 @@ static GLvoid * (APIENTRY * fptr_glMapBuffer)(GLenum,GLenum);
4
4
  static GLboolean (APIENTRY * fptr_glUnmapBuffer)(GLenum);
5
5
 
6
6
  struct buffer {
7
- GLenum target;
8
- void *ptr;
9
- GLsizeiptr len;
7
+ GLenum target;
8
+ void *ptr;
9
+ GLsizeiptr len;
10
10
  };
11
11
 
12
12
  static void
13
13
  buffer_free(void *ptr) {
14
- struct buffer *buf = ptr;
15
- LOAD_GL_FUNC(glUnmapBuffer, "1.5");
14
+ struct buffer *buf = ptr;
15
+ LOAD_GL_FUNC(glUnmapBuffer, "1.5");
16
16
 
17
- if (buf->ptr != NULL)
18
- fptr_glUnmapBuffer(buf->target);
17
+ if (buf->ptr != NULL)
18
+ fptr_glUnmapBuffer(buf->target);
19
19
  }
20
20
 
21
21
  static size_t
22
22
  buffer_memsize(const void *ptr) {
23
- const struct buffer *buf = ptr;
24
- return sizeof(struct buffer) + (size_t)buf->len;
23
+ const struct buffer *buf = ptr;
24
+ return sizeof(struct buffer) + (size_t)buf->len;
25
25
  }
26
26
 
27
27
  static const rb_data_type_t buffer_type = {
28
- "OpenGL/buffer",
29
- { NULL, buffer_free, buffer_memsize, },
28
+ "OpenGL/buffer",
29
+ { NULL, buffer_free, buffer_memsize, },
30
30
  };
31
31
 
32
32
  VALUE
33
33
  rb_gl_buffer_s_map(VALUE klass, VALUE _target, VALUE _access) {
34
- struct buffer *buf = ALLOC(struct buffer);
35
- LOAD_GL_FUNC(glMapBuffer, "1.5");
34
+ struct buffer *buf = ALLOC(struct buffer);
35
+ LOAD_GL_FUNC(glMapBuffer, "1.5");
36
36
 
37
- buf->target = RUBY2GLENUM(_target);
38
- buf->len = 0;
37
+ buf->target = RUBY2GLENUM(_target);
38
+ buf->len = 0;
39
39
 
40
- buf->ptr = fptr_glMapBuffer(buf->target, RUBY2GLENUM(_access));
40
+ buf->ptr = fptr_glMapBuffer(buf->target, RUBY2GLENUM(_access));
41
41
 
42
- if (buf->ptr == NULL) {
43
- xfree(buf);
44
- CHECK_GLERROR_FROM("glMapBuffer");
45
- }
42
+ if (buf->ptr == NULL) {
43
+ xfree(buf);
44
+ CHECK_GLERROR_FROM("glMapBuffer");
45
+ }
46
46
 
47
- return TypedData_Wrap_Struct(klass, &buffer_type, buf);
47
+ return TypedData_Wrap_Struct(klass, &buffer_type, buf);
48
48
  }
49
49
 
50
50
  static VALUE
51
51
  rb_gl_buffer_addr(VALUE self) {
52
- struct buffer *buf;
52
+ struct buffer *buf;
53
53
 
54
- TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
54
+ TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
55
55
 
56
- return ULONG2NUM((unsigned long)buf->ptr);
56
+ return SIZET2NUM((size_t)buf->ptr);
57
57
  }
58
58
 
59
59
  static VALUE
60
60
  rb_gl_buffer_length(VALUE self) {
61
- struct buffer *buf;
61
+ struct buffer *buf;
62
62
 
63
- TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
63
+ TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
64
64
 
65
- return RETCONV_GLsizeiptr(buf->len);
65
+ return RETCONV_GLsizeiptr(buf->len);
66
66
  }
67
67
 
68
68
  static VALUE
69
69
  rb_gl_buffer_read(int argc, VALUE *argv, VALUE self) {
70
- struct buffer *buf;
71
- VALUE _length, _offset;
72
- GLsizeiptr offset, length;
70
+ struct buffer *buf;
71
+ VALUE _length, _offset;
72
+ GLsizeiptr offset, length;
73
73
 
74
- TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
74
+ TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
75
75
 
76
- rb_scan_args(argc, argv, "02", &_length, &_offset);
76
+ rb_scan_args(argc, argv, "02", &_length, &_offset);
77
77
 
78
- if (buf->len == 0 && NIL_P(_length))
79
- rb_raise(rb_eArgError, "length must be provided for unbounded buffer");
78
+ if (buf->len == 0 && NIL_P(_length))
79
+ rb_raise(rb_eArgError, "length must be provided for unbounded buffer");
80
80
 
81
- length = NUM2ULONG(_length);
81
+ length = NUM2SIZET(_length);
82
82
 
83
- if (NIL_P(_offset)) {
84
- offset = 0;
85
- } else {
86
- offset = NUM2ULONG(_offset);
87
- }
83
+ if (NIL_P(_offset)) {
84
+ offset = 0;
85
+ } else {
86
+ offset = NUM2SIZET(_offset);
87
+ }
88
88
 
89
- if (buf->len != 0 && length + offset > buf->len)
90
- rb_raise(rb_eArgError, "read to %ld past end of buffer %ld",
91
- length + offset, buf->len);
89
+ if (buf->len != 0 && length + offset > buf->len)
90
+ rb_raise(rb_eArgError, "read to %lu past end of buffer %lu",
91
+ (unsigned long)(length + offset), (unsigned long)buf->len);
92
92
 
93
- return rb_str_new((char *)buf->ptr + offset, length);
93
+ return rb_str_new((char *)buf->ptr + offset, length);
94
94
  }
95
95
 
96
96
  static VALUE
97
97
  rb_gl_buffer_target(VALUE self) {
98
- struct buffer *buf;
98
+ struct buffer *buf;
99
99
 
100
- TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
100
+ TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
101
101
 
102
- return RETCONV_GLenum(buf->target);
102
+ return RETCONV_GLenum(buf->target);
103
103
  }
104
104
 
105
105
  static VALUE
106
106
  rb_gl_buffer_unmap(VALUE self) {
107
- struct buffer *buf;
108
- LOAD_GL_FUNC(glUnmapBuffer, "1.5");
107
+ struct buffer *buf;
108
+ LOAD_GL_FUNC(glUnmapBuffer, "1.5");
109
109
 
110
- TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
110
+ TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
111
111
 
112
- if (!buf->ptr)
113
- return self;
112
+ if (!buf->ptr)
113
+ return self;
114
114
 
115
- fptr_glUnmapBuffer(buf->target);
115
+ fptr_glUnmapBuffer(buf->target);
116
116
 
117
- CHECK_GLERROR_FROM("glUnmapBuffer");
117
+ CHECK_GLERROR_FROM("glUnmapBuffer");
118
118
 
119
- buf->ptr = NULL;
120
- buf->len = 0;
121
- buf->target = 0;
119
+ buf->ptr = NULL;
120
+ buf->len = 0;
121
+ buf->target = 0;
122
122
 
123
- return self;
123
+ return self;
124
124
  }
125
125
 
126
126
  static VALUE
127
127
  rb_gl_buffer_write(int argc, VALUE *argv, VALUE self) {
128
- struct buffer *buf;
129
- VALUE _data, _offset;
130
- GLsizeiptr offset;
131
- long length;
128
+ struct buffer *buf;
129
+ VALUE _data, _offset;
130
+ GLsizeiptr offset;
131
+ long length;
132
132
 
133
- TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
133
+ TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
134
134
 
135
- if (!buf->ptr)
136
- rb_raise(rb_eArgError, "write to unmapped buffer");
135
+ if (!buf->ptr)
136
+ rb_raise(rb_eArgError, "write to unmapped buffer");
137
137
 
138
- rb_scan_args(argc, argv, "11", &_data, &_offset);
138
+ rb_scan_args(argc, argv, "11", &_data, &_offset);
139
139
 
140
- if (NIL_P(_data))
141
- rb_raise(rb_eArgError, "cannot write nil to buffer");
140
+ if (NIL_P(_data))
141
+ rb_raise(rb_eArgError, "cannot write nil to buffer");
142
142
 
143
- _data = rb_String(_data);
143
+ _data = rb_String(_data);
144
144
 
145
- length = RSTRING_LEN(_data);
145
+ length = RSTRING_LEN(_data);
146
146
 
147
- if (NIL_P(_offset)) {
148
- offset = 0;
149
- } else {
150
- offset = NUM2ULONG(_offset);
151
- }
147
+ if (NIL_P(_offset)) {
148
+ offset = 0;
149
+ } else {
150
+ offset = NUM2SIZET(_offset);
151
+ }
152
152
 
153
- if (buf->len != 0 && length + offset > buf->len)
154
- rb_raise(rb_eArgError, "write to %ld past end of buffer %ld",
155
- length + offset, buf->len);
153
+ if (buf->len != 0 && length + offset > buf->len)
154
+ rb_raise(rb_eArgError, "write to %lu past end of buffer %lu",
155
+ (unsigned long)(length + offset), (unsigned long)buf->len);
156
156
 
157
- memcpy((char *)buf->ptr + offset, RSTRING_PTR(_data), RSTRING_LEN(_data));
157
+ memcpy((char *)buf->ptr + offset, RSTRING_PTR(_data), RSTRING_LEN(_data));
158
158
 
159
- return self;
159
+ return self;
160
160
  }
161
161
 
162
162
  void
163
163
  gl_init_buffer(void) {
164
- VALUE mOpenGL = rb_path2class("OpenGL");
165
- VALUE cBuffer = rb_define_class_under(mOpenGL, "Buffer", rb_cObject);
166
-
167
- rb_undef_alloc_func(cBuffer);
168
- rb_define_singleton_method(cBuffer, "map", rb_gl_buffer_s_map, 2);
169
-
170
- rb_define_method(cBuffer, "addr", rb_gl_buffer_addr, 0);
171
- rb_define_method(cBuffer, "length", rb_gl_buffer_length, 0);
172
- rb_define_method(cBuffer, "read", rb_gl_buffer_read, -1);
173
- rb_define_method(cBuffer, "target", rb_gl_buffer_target, 0);
174
- rb_define_method(cBuffer, "unmap", rb_gl_buffer_unmap, 0);
175
- rb_define_method(cBuffer, "write", rb_gl_buffer_write, -1);
164
+ VALUE mOpenGL = rb_path2class("OpenGL");
165
+ VALUE cBuffer = rb_define_class_under(mOpenGL, "Buffer", rb_cObject);
166
+
167
+ rb_undef_alloc_func(cBuffer);
168
+ rb_define_singleton_method(cBuffer, "map", rb_gl_buffer_s_map, 2);
169
+
170
+ rb_define_method(cBuffer, "addr", rb_gl_buffer_addr, 0);
171
+ rb_define_method(cBuffer, "length", rb_gl_buffer_length, 0);
172
+ rb_define_method(cBuffer, "read", rb_gl_buffer_read, -1);
173
+ rb_define_method(cBuffer, "target", rb_gl_buffer_target, 0);
174
+ rb_define_method(cBuffer, "unmap", rb_gl_buffer_unmap, 0);
175
+ rb_define_method(cBuffer, "write", rb_gl_buffer_write, -1);
176
176
  }
177
177