opengl 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -1
- data/.travis.yml +19 -0
- data/History.rdoc +26 -0
- data/Manifest.txt +3 -23
- data/README.rdoc +43 -37
- data/Rakefile +6 -62
- data/examples/NeHe/nehe_lesson02.rb +3 -2
- data/examples/NeHe/nehe_lesson03.rb +3 -2
- data/examples/NeHe/nehe_lesson04.rb +3 -1
- data/examples/NeHe/nehe_lesson05.rb +4 -1
- data/examples/NeHe/nehe_lesson06.rb +9 -6
- data/examples/NeHe/nehe_lesson07.rb +9 -6
- data/examples/NeHe/nehe_lesson08.rb +9 -6
- data/examples/NeHe/nehe_lesson09.rb +10 -6
- data/examples/NeHe/nehe_lesson11.rb +9 -6
- data/examples/NeHe/nehe_lesson12.rb +9 -6
- data/examples/NeHe/nehe_lesson16.rb +50 -47
- data/examples/NeHe/nehe_lesson19.rb +10 -7
- data/examples/NeHe/nehe_lesson36.rb +234 -229
- data/examples/OrangeBook/brick.rb +227 -225
- data/examples/OrangeBook/particle.rb +233 -231
- data/examples/RedBook/aapoly.rb +71 -70
- data/examples/RedBook/aargb.rb +54 -52
- data/examples/RedBook/accanti.rb +96 -94
- data/examples/RedBook/accpersp.rb +106 -104
- data/examples/RedBook/alpha.rb +54 -52
- data/examples/RedBook/alpha3D.rb +90 -88
- data/examples/RedBook/bezcurve.rb +48 -46
- data/examples/RedBook/bezmesh.rb +71 -69
- data/examples/RedBook/checker.rb +57 -55
- data/examples/RedBook/clip.rb +41 -39
- data/examples/RedBook/colormat.rb +72 -70
- data/examples/RedBook/cube.rb +39 -37
- data/examples/RedBook/depthcue.rb +37 -35
- data/examples/RedBook/dof.rb +110 -109
- data/examples/RedBook/double.rb +40 -38
- data/examples/RedBook/drawf.rb +30 -28
- data/examples/RedBook/feedback.rb +79 -77
- data/examples/RedBook/fog.rb +90 -89
- data/examples/RedBook/font.rb +78 -76
- data/examples/RedBook/hello.rb +29 -27
- data/examples/RedBook/image.rb +57 -55
- data/examples/RedBook/jitter.rb +131 -131
- data/examples/RedBook/light.rb +2 -1
- data/examples/RedBook/lines.rb +70 -68
- data/examples/RedBook/list.rb +48 -46
- data/examples/RedBook/material.rb +200 -199
- data/examples/RedBook/mipmap.rb +84 -82
- data/examples/RedBook/model.rb +55 -53
- data/examples/RedBook/movelight.rb +52 -50
- data/examples/RedBook/pickdepth.rb +103 -101
- data/examples/RedBook/planet.rb +46 -44
- data/examples/RedBook/quadric.rb +97 -95
- data/examples/RedBook/robot.rb +55 -53
- data/examples/RedBook/select.rb +118 -116
- data/examples/RedBook/smooth.rb +35 -33
- data/examples/RedBook/stencil.rb +96 -94
- data/examples/RedBook/stroke.rb +75 -73
- data/examples/RedBook/surface.rb +93 -91
- data/examples/RedBook/teaambient.rb +71 -69
- data/examples/RedBook/teapots.rb +105 -103
- data/examples/RedBook/tess.rb +96 -94
- data/examples/RedBook/texbind.rb +79 -77
- data/examples/RedBook/texgen.rb +88 -86
- data/examples/RedBook/texturesurf.rb +57 -55
- data/examples/RedBook/varray.rb +85 -83
- data/examples/RedBook/wrap.rb +76 -74
- data/examples/misc/OGLBench.rb +114 -113
- data/examples/misc/anisotropic.rb +154 -152
- data/examples/misc/fbo_test.rb +37 -36
- data/examples/misc/font-glut.rb +47 -46
- data/examples/misc/glfwtest.rb +16 -16
- data/examples/misc/plane.rb +13 -13
- data/examples/misc/readpixel.rb +66 -65
- data/examples/misc/sdltest.rb +21 -19
- data/examples/misc/trislam.rb +548 -547
- data/ext/opengl/common.h +16 -38
- data/ext/opengl/conv.h +39 -41
- data/ext/opengl/extconf.rb +4 -31
- data/ext/opengl/funcdef.h +126 -124
- data/ext/opengl/gl-1.0-1.1.c +1917 -1917
- data/ext/opengl/gl-1.2.c +4 -667
- data/ext/opengl/gl-1.3.c +9 -9
- data/ext/opengl/gl-1.4.c +8 -8
- data/ext/opengl/gl-1.5.c +1 -1
- data/ext/opengl/gl-2.0.c +392 -388
- data/ext/opengl/gl-3.0.c +493 -0
- data/ext/opengl/gl-enums.c +1523 -5
- data/ext/opengl/gl-enums.h +4679 -122
- data/ext/opengl/gl-error.c +7 -7
- data/ext/opengl/gl-error.h +4 -4
- data/ext/opengl/gl-ext-arb.c +468 -464
- data/ext/opengl/gl-ext-ext.c +18 -18
- data/ext/opengl/gl-ext-nv.c +15 -15
- data/ext/opengl/gl.c +2 -0
- data/ext/opengl/gl_buffer.c +92 -92
- data/ext/opengl/opengl.c +1 -7
- data/lib/opengl.rb +23 -59
- data/lib/opengl/test_case.rb +1 -2
- data/test/dummy.xorg.conf +140 -0
- data/test/test_gl.rb +18 -22
- data/test/test_gl_10_11.rb +220 -220
- data/test/test_gl_12.rb +11 -122
- data/test/test_gl_13.rb +202 -210
- data/test/test_gl_14.rb +16 -19
- data/test/test_gl_15.rb +2 -4
- data/test/test_gl_20.rb +45 -58
- data/test/test_gl_21.rb +46 -163
- data/test/test_gl_ext_arb.rb +54 -72
- data/test/test_gl_ext_ati.rb +0 -2
- data/test/test_gl_ext_ext.rb +66 -66
- data/test/test_gl_ext_gremedy.rb +8 -15
- data/test/test_gl_ext_nv.rb +109 -112
- data/test/test_opengl_buffer.rb +8 -25
- data/utils/README +0 -5
- data/utils/enumgen.rb +72 -76
- data/utils/extlistgen.rb +55 -55
- metadata +87 -66
- metadata.gz.sig +2 -0
- data/Rakefile.cross +0 -107
- data/docs/build_install.txt +0 -119
- data/docs/extensions.txt.in +0 -348
- data/docs/history.txt +0 -66
- data/docs/requirements_and_design.txt +0 -117
- data/docs/roadmap.txt +0 -28
- data/docs/scientific_use.txt +0 -35
- data/docs/supplies/page_template.html +0 -71
- data/docs/thanks.txt +0 -29
- data/docs/tutorial.txt +0 -469
- data/ext/opengl/glu-enums.c +0 -164
- data/ext/opengl/glu-enums.h +0 -463
- data/ext/opengl/glu.c +0 -1534
- data/ext/opengl/glut.c +0 -1145
- data/ext/opengl/glut_callbacks.c +0 -845
- data/lib/glu.rb +0 -1
- data/lib/glut.rb +0 -1
- data/test/test_glu.rb +0 -309
- data/utils/mkdn2html.rb +0 -59
- data/utils/post-mkdn2html.rb +0 -91
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +0 -198
data/ext/opengl/gl-ext-ext.c
CHANGED
@@ -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*)
|
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 *)
|
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 *)
|
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*)
|
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, "
|
455
|
-
GL_FUNC_LOAD_3(VertexAttribI2iEXT,GLvoid, GLuint,GLint,GLint, "
|
456
|
-
GL_FUNC_LOAD_4(VertexAttribI3iEXT,GLvoid, GLuint,GLint,GLint,GLint, "
|
457
|
-
GL_FUNC_LOAD_5(VertexAttribI4iEXT,GLvoid, GLuint,GLint,GLint,GLint,GLint, "
|
458
|
-
GL_FUNC_LOAD_2(VertexAttribI1uiEXT,GLvoid, GLuint,GLuint, "
|
459
|
-
GL_FUNC_LOAD_3(VertexAttribI2uiEXT,GLvoid, GLuint,GLuint,GLuint, "
|
460
|
-
GL_FUNC_LOAD_4(VertexAttribI3uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint, "
|
461
|
-
GL_FUNC_LOAD_5(VertexAttribI4uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint,GLuint, "
|
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_, "
|
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 *)
|
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*)
|
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);
|
data/ext/opengl/gl-ext-nv.c
CHANGED
@@ -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 *)
|
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, "
|
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
|
}
|
data/ext/opengl/gl.c
CHANGED
@@ -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);
|
data/ext/opengl/gl_buffer.c
CHANGED
@@ -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
|
-
|
8
|
-
|
9
|
-
|
7
|
+
GLenum target;
|
8
|
+
void *ptr;
|
9
|
+
GLsizeiptr len;
|
10
10
|
};
|
11
11
|
|
12
12
|
static void
|
13
13
|
buffer_free(void *ptr) {
|
14
|
-
|
15
|
-
|
14
|
+
struct buffer *buf = ptr;
|
15
|
+
LOAD_GL_FUNC(glUnmapBuffer, "1.5");
|
16
16
|
|
17
|
-
|
18
|
-
|
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
|
-
|
24
|
-
|
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
|
-
|
29
|
-
|
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
|
-
|
35
|
-
|
34
|
+
struct buffer *buf = ALLOC(struct buffer);
|
35
|
+
LOAD_GL_FUNC(glMapBuffer, "1.5");
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
buf->target = RUBY2GLENUM(_target);
|
38
|
+
buf->len = 0;
|
39
39
|
|
40
|
-
|
40
|
+
buf->ptr = fptr_glMapBuffer(buf->target, RUBY2GLENUM(_access));
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
if (buf->ptr == NULL) {
|
43
|
+
xfree(buf);
|
44
|
+
CHECK_GLERROR_FROM("glMapBuffer");
|
45
|
+
}
|
46
46
|
|
47
|
-
|
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
|
-
|
52
|
+
struct buffer *buf;
|
53
53
|
|
54
|
-
|
54
|
+
TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
|
55
55
|
|
56
|
-
|
56
|
+
return SIZET2NUM((size_t)buf->ptr);
|
57
57
|
}
|
58
58
|
|
59
59
|
static VALUE
|
60
60
|
rb_gl_buffer_length(VALUE self) {
|
61
|
-
|
61
|
+
struct buffer *buf;
|
62
62
|
|
63
|
-
|
63
|
+
TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
|
64
64
|
|
65
|
-
|
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
|
-
|
71
|
-
|
72
|
-
|
70
|
+
struct buffer *buf;
|
71
|
+
VALUE _length, _offset;
|
72
|
+
GLsizeiptr offset, length;
|
73
73
|
|
74
|
-
|
74
|
+
TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
|
75
75
|
|
76
|
-
|
76
|
+
rb_scan_args(argc, argv, "02", &_length, &_offset);
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
if (buf->len == 0 && NIL_P(_length))
|
79
|
+
rb_raise(rb_eArgError, "length must be provided for unbounded buffer");
|
80
80
|
|
81
|
-
|
81
|
+
length = NUM2SIZET(_length);
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
if (NIL_P(_offset)) {
|
84
|
+
offset = 0;
|
85
|
+
} else {
|
86
|
+
offset = NUM2SIZET(_offset);
|
87
|
+
}
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
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
|
-
|
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
|
-
|
98
|
+
struct buffer *buf;
|
99
99
|
|
100
|
-
|
100
|
+
TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
|
101
101
|
|
102
|
-
|
102
|
+
return RETCONV_GLenum(buf->target);
|
103
103
|
}
|
104
104
|
|
105
105
|
static VALUE
|
106
106
|
rb_gl_buffer_unmap(VALUE self) {
|
107
|
-
|
108
|
-
|
107
|
+
struct buffer *buf;
|
108
|
+
LOAD_GL_FUNC(glUnmapBuffer, "1.5");
|
109
109
|
|
110
|
-
|
110
|
+
TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
|
111
111
|
|
112
|
-
|
113
|
-
|
112
|
+
if (!buf->ptr)
|
113
|
+
return self;
|
114
114
|
|
115
|
-
|
115
|
+
fptr_glUnmapBuffer(buf->target);
|
116
116
|
|
117
|
-
|
117
|
+
CHECK_GLERROR_FROM("glUnmapBuffer");
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
119
|
+
buf->ptr = NULL;
|
120
|
+
buf->len = 0;
|
121
|
+
buf->target = 0;
|
122
122
|
|
123
|
-
|
123
|
+
return self;
|
124
124
|
}
|
125
125
|
|
126
126
|
static VALUE
|
127
127
|
rb_gl_buffer_write(int argc, VALUE *argv, VALUE self) {
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
struct buffer *buf;
|
129
|
+
VALUE _data, _offset;
|
130
|
+
GLsizeiptr offset;
|
131
|
+
long length;
|
132
132
|
|
133
|
-
|
133
|
+
TypedData_Get_Struct(self, struct buffer, &buffer_type, buf);
|
134
134
|
|
135
|
-
|
136
|
-
|
135
|
+
if (!buf->ptr)
|
136
|
+
rb_raise(rb_eArgError, "write to unmapped buffer");
|
137
137
|
|
138
|
-
|
138
|
+
rb_scan_args(argc, argv, "11", &_data, &_offset);
|
139
139
|
|
140
|
-
|
141
|
-
|
140
|
+
if (NIL_P(_data))
|
141
|
+
rb_raise(rb_eArgError, "cannot write nil to buffer");
|
142
142
|
|
143
|
-
|
143
|
+
_data = rb_String(_data);
|
144
144
|
|
145
|
-
|
145
|
+
length = RSTRING_LEN(_data);
|
146
146
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
147
|
+
if (NIL_P(_offset)) {
|
148
|
+
offset = 0;
|
149
|
+
} else {
|
150
|
+
offset = NUM2SIZET(_offset);
|
151
|
+
}
|
152
152
|
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
-
|
157
|
+
memcpy((char *)buf->ptr + offset, RSTRING_PTR(_data), RSTRING_LEN(_data));
|
158
158
|
|
159
|
-
|
159
|
+
return self;
|
160
160
|
}
|
161
161
|
|
162
162
|
void
|
163
163
|
gl_init_buffer(void) {
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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
|
|