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-1.3.c
CHANGED
@@ -46,7 +46,7 @@ VALUE obj; \
|
|
46
46
|
{ \
|
47
47
|
int num; \
|
48
48
|
VALUE ary, args[5]; \
|
49
|
-
switch (num = rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3]
|
49
|
+
switch (num = rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3], &args[4])) { \
|
50
50
|
case 2: \
|
51
51
|
if (TYPE(args[1]) == T_ARRAY) { \
|
52
52
|
ary = args[1]; \
|
@@ -139,7 +139,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
139
139
|
border = (GLint)NUM2INT(arg7);
|
140
140
|
imagesize = (GLsizei)NUM2UINT(arg8);
|
141
141
|
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
142
|
-
fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,(GLvoid *)
|
142
|
+
fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,(GLvoid *)NUM2SIZET(arg9));
|
143
143
|
} else {
|
144
144
|
if (TYPE(arg9) == T_STRING || TYPE(arg9) == T_ARRAY) {
|
145
145
|
VALUE data;
|
@@ -181,7 +181,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
|
181
181
|
border = (GLint)NUM2INT(arg6);
|
182
182
|
imagesize = (GLsizei)NUM2UINT(arg7);
|
183
183
|
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
184
|
-
fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,(GLvoid *)
|
184
|
+
fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,(GLvoid *)NUM2SIZET(arg8));
|
185
185
|
} else {
|
186
186
|
if (TYPE(arg8) == T_STRING || TYPE(arg8) == T_ARRAY) {
|
187
187
|
VALUE data;
|
@@ -221,7 +221,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
221
221
|
border = (GLint)NUM2INT(arg5);
|
222
222
|
imagesize = (GLsizei)NUM2UINT(arg6);
|
223
223
|
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
224
|
-
fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,(GLvoid *)
|
224
|
+
fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,(GLvoid *)NUM2SIZET(arg7));
|
225
225
|
} else {
|
226
226
|
if (TYPE(arg7) == T_STRING || TYPE(arg7) == T_ARRAY) {
|
227
227
|
VALUE data;
|
@@ -269,7 +269,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
|
269
269
|
format = (GLenum)NUM2INT(arg9);
|
270
270
|
imagesize = (GLsizei)NUM2UINT(arg10);
|
271
271
|
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
272
|
-
fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,(GLvoid *)
|
272
|
+
fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,(GLvoid *)NUM2SIZET(arg11));
|
273
273
|
} else {
|
274
274
|
VALUE data;
|
275
275
|
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg11);
|
@@ -307,7 +307,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
307
307
|
format = (GLenum)NUM2INT(arg7);
|
308
308
|
imagesize = (GLsizei)NUM2UINT(arg8);
|
309
309
|
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
310
|
-
fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,(GLvoid *)
|
310
|
+
fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,(GLvoid *)NUM2SIZET(arg9));
|
311
311
|
} else {
|
312
312
|
VALUE data;
|
313
313
|
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg9);
|
@@ -340,7 +340,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
340
340
|
format = (GLenum)NUM2INT(arg5);
|
341
341
|
imagesize = (GLsizei)NUM2UINT(arg6);
|
342
342
|
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
343
|
-
fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,(GLvoid *)
|
343
|
+
fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,(GLvoid *)NUM2SIZET(arg7));
|
344
344
|
} else {
|
345
345
|
VALUE data;
|
346
346
|
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
|
@@ -382,9 +382,9 @@ VALUE obj;
|
|
382
382
|
CHECK_GLERROR_FROM("glGetCompressedTexImage");
|
383
383
|
return data;
|
384
384
|
case 3:
|
385
|
-
fptr_glGetCompressedTexImage(target,lod,(GLvoid*)
|
385
|
+
fptr_glGetCompressedTexImage(target,lod,(GLvoid*)NUM2SIZET(args[2]));
|
386
386
|
CHECK_GLERROR_FROM("glGetCompressedTexImage");
|
387
|
-
return Qnil;
|
387
|
+
return Qnil;
|
388
388
|
}
|
389
389
|
}
|
390
390
|
|
data/ext/opengl/gl-1.4.c
CHANGED
@@ -80,7 +80,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
80
80
|
stride = (GLsizei)NUM2UINT(arg2);
|
81
81
|
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
82
82
|
g_FogCoord_ptr = arg3;
|
83
|
-
fptr_glFogCoordPointer(type, stride, (const GLvoid*)
|
83
|
+
fptr_glFogCoordPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
|
84
84
|
} else {
|
85
85
|
VALUE data;
|
86
86
|
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg3);
|
@@ -100,10 +100,10 @@ VALUE obj,arg1,arg2,arg3;
|
|
100
100
|
GLenum mode;
|
101
101
|
GLint *ary1;
|
102
102
|
GLsizei *ary2;
|
103
|
-
|
103
|
+
int len1,len2;
|
104
104
|
LOAD_GL_FUNC(glMultiDrawArrays, "1.4");
|
105
|
-
|
106
|
-
|
105
|
+
len1 = (int)RARRAY_LENINT(arg2);
|
106
|
+
len2 = (int)RARRAY_LENINT(arg3);
|
107
107
|
if (len1!=len2)
|
108
108
|
rb_raise(rb_eArgError, "Passed arrays must have same length");
|
109
109
|
mode = (GLenum)NUM2INT(arg1);
|
@@ -171,7 +171,7 @@ VALUE obj;
|
|
171
171
|
indices = ALLOC_N(GLvoid*,size);
|
172
172
|
for (i=0;i<size;i++) {
|
173
173
|
counts[i] = (GLsizei)NUM2INT(rb_ary_entry(args[2],i));
|
174
|
-
indices[i] = (GLvoid *)
|
174
|
+
indices[i] = (GLvoid *)NUM2SIZET(rb_ary_entry(args[3],i));
|
175
175
|
}
|
176
176
|
fptr_glMultiDrawElements(mode,counts,type,indices,size);
|
177
177
|
xfree(counts);
|
@@ -198,7 +198,7 @@ VALUE obj,arg1,arg2;
|
|
198
198
|
else
|
199
199
|
size = 1;
|
200
200
|
ary2cflt(arg2,params,size);
|
201
|
-
fptr_glPointParameterfv(pname,params);
|
201
|
+
fptr_glPointParameterfv(pname,params);
|
202
202
|
CHECK_GLERROR_FROM("glPointParameterfv");
|
203
203
|
return Qnil;
|
204
204
|
}
|
@@ -219,7 +219,7 @@ VALUE obj,arg1,arg2;
|
|
219
219
|
else
|
220
220
|
size = 1;
|
221
221
|
ary2cint(arg2,params,size);
|
222
|
-
fptr_glPointParameteriv(pname,params);
|
222
|
+
fptr_glPointParameteriv(pname,params);
|
223
223
|
CHECK_GLERROR_FROM("glPointParameteriv");
|
224
224
|
return Qnil;
|
225
225
|
}
|
@@ -262,7 +262,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
262
262
|
stride = (GLsizei)NUM2UINT(arg3);
|
263
263
|
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
264
264
|
g_SecondaryColor_ptr = arg4;
|
265
|
-
fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)
|
265
|
+
fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)NUM2SIZET(arg4));
|
266
266
|
} else {
|
267
267
|
VALUE data;
|
268
268
|
data = pack_array_or_pass_string(type,arg4);
|
data/ext/opengl/gl-1.5.c
CHANGED
@@ -172,7 +172,7 @@ gl_MapBuffer(VALUE self, VALUE _target, VALUE _access) {
|
|
172
172
|
if (buffer_ptr == NULL || size <= 0)
|
173
173
|
return Qnil;
|
174
174
|
|
175
|
-
|
175
|
+
return rb_str_new(buffer_ptr, size);
|
176
176
|
}
|
177
177
|
|
178
178
|
static GLboolean (APIENTRY * fptr_glUnmapBuffer)(GLenum);
|
data/ext/opengl/gl-2.0.c
CHANGED
@@ -60,17 +60,17 @@ static VALUE
|
|
60
60
|
gl_DrawBuffers(obj,arg1)
|
61
61
|
VALUE obj,arg1;
|
62
62
|
{
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
GLsizei size;
|
64
|
+
GLenum *buffers;
|
65
|
+
LOAD_GL_FUNC(glDrawBuffers, "2.0");
|
66
|
+
Check_Type(arg1,T_ARRAY);
|
67
|
+
size = (GLsizei)RARRAY_LENINT(arg1);
|
68
|
+
buffers = ALLOC_N(GLenum,size);
|
69
|
+
ary2cuint(arg1,buffers,size);
|
70
|
+
fptr_glDrawBuffers(size,buffers);
|
71
|
+
xfree(buffers);
|
72
|
+
CHECK_GLERROR_FROM("glDrawBuffers");
|
73
|
+
return Qnil;
|
74
74
|
}
|
75
75
|
|
76
76
|
static void (APIENTRY * fptr_glBindAttribLocation)(GLuint,GLuint,GLchar *);
|
@@ -78,15 +78,15 @@ static VALUE
|
|
78
78
|
gl_BindAttribLocation(obj,arg1,arg2,arg3)
|
79
79
|
VALUE obj,arg1,arg2,arg3;
|
80
80
|
{
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
81
|
+
GLuint program;
|
82
|
+
GLuint index;
|
83
|
+
LOAD_GL_FUNC(glBindAttribLocation, "2.0");
|
84
|
+
program = (GLuint)NUM2UINT(arg1);
|
85
|
+
index = (GLuint)NUM2UINT(arg2);
|
86
|
+
Check_Type(arg3, T_STRING);
|
87
|
+
fptr_glBindAttribLocation(program,index,RSTRING_PTR(arg3));
|
88
|
+
CHECK_GLERROR_FROM("glBindAttribLocation");
|
89
|
+
return Qnil;
|
90
90
|
}
|
91
91
|
|
92
92
|
static void (APIENTRY * fptr_glGetProgramiv)(GLuint,GLenum,GLint *);
|
@@ -94,15 +94,15 @@ static VALUE
|
|
94
94
|
gl_GetProgramiv(obj,arg1,arg2)
|
95
95
|
VALUE obj,arg1,arg2;
|
96
96
|
{
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
GLuint program;
|
98
|
+
GLenum pname;
|
99
|
+
GLint params = 0;
|
100
|
+
LOAD_GL_FUNC(glGetProgramiv, "2.0");
|
101
|
+
program = (GLuint)NUM2UINT(arg1);
|
102
|
+
pname = (GLenum)NUM2INT(arg2);
|
103
|
+
fptr_glGetProgramiv(program,pname,¶ms);
|
104
|
+
CHECK_GLERROR_FROM("glGetProgramiv");
|
105
|
+
return cond_GLBOOL2RUBY(pname,params);
|
106
106
|
}
|
107
107
|
|
108
108
|
static void (APIENTRY * fptr_glGetActiveAttrib)(GLuint,GLuint,GLsizei,GLsizei *,GLint *,GLenum *,GLchar *);
|
@@ -110,30 +110,33 @@ static VALUE
|
|
110
110
|
gl_GetActiveAttrib(obj,arg1,arg2)
|
111
111
|
VALUE obj,arg1,arg2;
|
112
112
|
{
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
113
|
+
GLuint program;
|
114
|
+
GLuint index;
|
115
|
+
GLsizei max_size = 0;
|
116
|
+
GLsizei written = 0;
|
117
|
+
GLint attrib_size = 0;
|
118
|
+
GLenum attrib_type = 0;
|
119
|
+
VALUE buffer;
|
120
|
+
VALUE retary;
|
121
|
+
LOAD_GL_FUNC(glGetActiveAttrib, "2.0");
|
122
|
+
LOAD_GL_FUNC(glGetProgramiv, "2.0");
|
123
|
+
program = (GLuint)NUM2UINT(arg1);
|
124
|
+
index = (GLuint)NUM2UINT(arg2);
|
125
|
+
fptr_glGetProgramiv(program,GL_ACTIVE_ATTRIBUTE_MAX_LENGTH,&max_size);
|
126
|
+
CHECK_GLERROR_FROM("glGetProgramiv");
|
127
|
+
/* Can't determine maximum attribute name length, so presume it */
|
128
|
+
if (max_size==0) max_size = 256;
|
129
|
+
buffer = allocate_buffer_with_string(max_size-1);
|
130
|
+
|
131
|
+
fptr_glGetActiveAttrib(program,index,max_size,&written,&attrib_size,&attrib_type,RSTRING_PTR(buffer));
|
132
|
+
|
133
|
+
rb_str_set_len(buffer, written);
|
134
|
+
retary = rb_ary_new2(3);
|
135
|
+
rb_ary_push(retary, INT2NUM(attrib_size));
|
136
|
+
rb_ary_push(retary, INT2NUM(attrib_type));
|
137
|
+
rb_ary_push(retary, buffer);
|
138
|
+
CHECK_GLERROR_FROM("glGetActiveAttrib");
|
139
|
+
return retary;
|
137
140
|
}
|
138
141
|
|
139
142
|
static void (APIENTRY * fptr_glGetActiveUniform)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*);
|
@@ -141,33 +144,33 @@ static VALUE
|
|
141
144
|
gl_GetActiveUniform(obj,arg1,arg2)
|
142
145
|
VALUE obj,arg1,arg2;
|
143
146
|
{
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
rb_str_set_len(buffer,
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
147
|
+
GLuint program;
|
148
|
+
GLuint index;
|
149
|
+
GLsizei max_size = 0;
|
150
|
+
GLsizei written = 0;
|
151
|
+
GLint uniform_size = 0;
|
152
|
+
GLenum uniform_type = 0;
|
153
|
+
VALUE buffer;
|
154
|
+
VALUE retary;
|
155
|
+
LOAD_GL_FUNC(glGetActiveUniform, "2.0");
|
156
|
+
LOAD_GL_FUNC(glGetProgramiv, "2.0");
|
157
|
+
program = (GLuint)NUM2UINT(arg1);
|
158
|
+
index = (GLuint)NUM2UINT(arg2);
|
159
|
+
fptr_glGetProgramiv(program,GL_ACTIVE_UNIFORM_MAX_LENGTH,&max_size);
|
160
|
+
CHECK_GLERROR_FROM("glGetProgramiv");
|
161
|
+
/* Can't determine maximum uniform name length, so presume it */
|
162
|
+
if (max_size==0) max_size = 256;
|
163
|
+
buffer = allocate_buffer_with_string(max_size-1);
|
164
|
+
|
165
|
+
fptr_glGetActiveUniform(program,index,max_size,&written,&uniform_size,&uniform_type,RSTRING_PTR(buffer));
|
166
|
+
|
167
|
+
rb_str_set_len(buffer, written);
|
168
|
+
retary = rb_ary_new2(3);
|
169
|
+
rb_ary_push(retary, INT2NUM(uniform_size));
|
170
|
+
rb_ary_push(retary, INT2NUM(uniform_type));
|
171
|
+
rb_ary_push(retary, buffer);
|
172
|
+
CHECK_GLERROR_FROM("glGetActiveUniform");
|
173
|
+
return retary;
|
171
174
|
}
|
172
175
|
|
173
176
|
static void (APIENTRY * fptr_glGetAttachedShaders)(GLuint,GLsizei,GLsizei *,GLuint *);
|
@@ -175,19 +178,19 @@ static VALUE
|
|
175
178
|
gl_GetAttachedShaders(obj,arg1)
|
176
179
|
VALUE obj,arg1;
|
177
180
|
{
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
181
|
+
GLuint program;
|
182
|
+
GLint shaders_num = 0;
|
183
|
+
GLuint *shaders;
|
184
|
+
GLsizei count = 0;
|
185
|
+
LOAD_GL_FUNC(glGetAttachedShaders, "2.0");
|
186
|
+
LOAD_GL_FUNC(glGetProgramiv, "2.0");
|
187
|
+
program = (GLuint)NUM2UINT(arg1);
|
188
|
+
fptr_glGetProgramiv(program,GL_ATTACHED_SHADERS,&shaders_num);
|
189
|
+
CHECK_GLERROR_FROM("glGetProgramiv");
|
190
|
+
if (shaders_num<=0)
|
191
|
+
return Qnil;
|
192
|
+
shaders = ALLOC_N(GLuint,shaders_num);
|
193
|
+
fptr_glGetAttachedShaders(program,shaders_num,&count,shaders);
|
191
194
|
RET_ARRAY_OR_SINGLE_FREE("glGetAttachedShaders", count, RETCONV_GLuint,
|
192
195
|
shaders);
|
193
196
|
}
|
@@ -197,14 +200,14 @@ static VALUE
|
|
197
200
|
gl_GetAttribLocation(obj,arg1,arg2)
|
198
201
|
VALUE obj,arg1,arg2;
|
199
202
|
{
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
203
|
+
GLuint program;
|
204
|
+
GLint ret;
|
205
|
+
LOAD_GL_FUNC(glGetAttribLocation, "2.0");
|
206
|
+
program=(GLuint)NUM2UINT(arg1);
|
207
|
+
Check_Type(arg2,T_STRING);
|
208
|
+
ret = fptr_glGetAttribLocation(program,RSTRING_PTR(arg2));
|
209
|
+
CHECK_GLERROR_FROM("glGetAttribLocation");
|
210
|
+
return INT2NUM(ret);
|
208
211
|
}
|
209
212
|
|
210
213
|
static void (APIENTRY * fptr_glGetProgramInfoLog)(GLuint,GLsizei,GLsizei *,GLchar *);
|
@@ -212,21 +215,22 @@ static VALUE
|
|
212
215
|
gl_GetProgramInfoLog(obj,arg1)
|
213
216
|
VALUE obj,arg1;
|
214
217
|
{
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
218
|
+
GLuint program;
|
219
|
+
GLint max_size = 0;
|
220
|
+
GLsizei ret_length = 0;
|
221
|
+
VALUE buffer;
|
222
|
+
LOAD_GL_FUNC(glGetProgramInfoLog, "2.0");
|
223
|
+
LOAD_GL_FUNC(glGetProgramiv, "2.0");
|
224
|
+
program = (GLuint)NUM2UINT(arg1);
|
225
|
+
fptr_glGetProgramiv(program,GL_INFO_LOG_LENGTH,&max_size);
|
226
|
+
CHECK_GLERROR_FROM("glGetProgramiv");
|
227
|
+
if (max_size<=0)
|
228
|
+
return rb_str_new2("");
|
229
|
+
buffer = allocate_buffer_with_string(max_size);
|
230
|
+
fptr_glGetProgramInfoLog(program,max_size,&ret_length,RSTRING_PTR(buffer));
|
231
|
+
rb_str_set_len(buffer, ret_length);
|
232
|
+
CHECK_GLERROR_FROM("glGetProgramInfoLog");
|
233
|
+
return buffer;
|
230
234
|
}
|
231
235
|
|
232
236
|
static void (APIENTRY * fptr_glGetShaderiv)(GLuint,GLenum,GLint *);
|
@@ -234,15 +238,15 @@ static VALUE
|
|
234
238
|
gl_GetShaderiv(obj,arg1,arg2)
|
235
239
|
VALUE obj,arg1,arg2;
|
236
240
|
{
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
241
|
+
GLuint program;
|
242
|
+
GLenum pname;
|
243
|
+
GLint params = 0;
|
244
|
+
LOAD_GL_FUNC(glGetShaderiv, "2.0");
|
245
|
+
program = (GLuint)NUM2UINT(arg1);
|
246
|
+
pname = (GLenum)NUM2INT(arg2);
|
247
|
+
fptr_glGetShaderiv(program,pname,¶ms);
|
248
|
+
CHECK_GLERROR_FROM("glGetShaderiv");
|
249
|
+
return cond_GLBOOL2RUBY(pname,params);
|
246
250
|
}
|
247
251
|
|
248
252
|
static void (APIENTRY * fptr_glGetShaderInfoLog)(GLuint,GLsizei,GLsizei *,GLchar *);
|
@@ -250,25 +254,25 @@ static VALUE
|
|
250
254
|
gl_GetShaderInfoLog(obj,arg1)
|
251
255
|
VALUE obj,arg1;
|
252
256
|
{
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
257
|
+
GLuint program;
|
258
|
+
GLint max_size = 0;
|
259
|
+
GLsizei ret_length = 0;
|
260
|
+
VALUE ret_buffer;
|
261
|
+
GLchar *buffer;
|
262
|
+
LOAD_GL_FUNC(glGetShaderInfoLog, "2.0");
|
263
|
+
LOAD_GL_FUNC(glGetShaderiv, "2.0");
|
264
|
+
program = (GLuint)NUM2UINT(arg1);
|
265
|
+
fptr_glGetShaderiv(program,GL_INFO_LOG_LENGTH,&max_size);
|
266
|
+
CHECK_GLERROR_FROM("glGetShaderiv");
|
267
|
+
if (max_size<=0)
|
268
|
+
return rb_str_new2("");
|
269
|
+
buffer = ALLOC_N(GLchar,max_size+1);
|
270
|
+
memset(buffer,0,sizeof(GLchar) * (max_size+1));
|
271
|
+
fptr_glGetShaderInfoLog(program,max_size,&ret_length,buffer);
|
272
|
+
ret_buffer = rb_str_new(buffer, ret_length);
|
273
|
+
xfree(buffer);
|
274
|
+
CHECK_GLERROR_FROM("glGetShaderInfoLog");
|
275
|
+
return ret_buffer;
|
272
276
|
}
|
273
277
|
|
274
278
|
static void (APIENTRY * fptr_glGetShaderSource)(GLuint,GLsizei,GLsizei *,GLchar *);
|
@@ -276,21 +280,21 @@ static VALUE
|
|
276
280
|
gl_GetShaderSource(obj,arg1)
|
277
281
|
VALUE obj,arg1;
|
278
282
|
{
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
283
|
+
GLuint shader;
|
284
|
+
GLint max_size = 0;
|
285
|
+
GLsizei ret_length = 0;
|
286
|
+
VALUE buffer;
|
287
|
+
LOAD_GL_FUNC(glGetShaderSource, "2.0");
|
288
|
+
LOAD_GL_FUNC(glGetShaderiv, "2.0");
|
289
|
+
shader = (GLuint)NUM2UINT(arg1);
|
290
|
+
fptr_glGetShaderiv(shader,GL_SHADER_SOURCE_LENGTH,&max_size);
|
291
|
+
CHECK_GLERROR_FROM("glGetShaderiv");
|
292
|
+
if (max_size==0)
|
293
|
+
rb_raise(rb_eTypeError, "Can't determine maximum shader source length");
|
294
|
+
buffer = allocate_buffer_with_string(max_size-1);
|
295
|
+
fptr_glGetShaderSource(shader,max_size,&ret_length,RSTRING_PTR(buffer));
|
296
|
+
CHECK_GLERROR_FROM("glGetShaderSource");
|
297
|
+
return buffer;
|
294
298
|
}
|
295
299
|
|
296
300
|
static GLint (APIENTRY * fptr_glGetUniformLocation)(GLuint,const GLchar*);
|
@@ -298,15 +302,15 @@ static VALUE
|
|
298
302
|
gl_GetUniformLocation(obj,arg1,arg2)
|
299
303
|
VALUE obj,arg1,arg2;
|
300
304
|
{
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
305
|
+
GLuint program;
|
306
|
+
GLint ret;
|
307
|
+
LOAD_GL_FUNC(glGetUniformLocation, "2.0");
|
308
|
+
program=(GLuint)NUM2UINT(arg1);
|
309
|
+
Check_Type(arg2,T_STRING);
|
310
|
+
ret = fptr_glGetUniformLocation(program, RSTRING_PTR(arg2));
|
307
311
|
|
308
312
|
CHECK_GLERROR_FROM("glGetUniformLocation");
|
309
|
-
|
313
|
+
return INT2NUM(ret);
|
310
314
|
}
|
311
315
|
|
312
316
|
#define GETUNIFORM_FUNC(_name_,_type_) \
|
@@ -315,28 +319,28 @@ static VALUE \
|
|
315
319
|
gl_##_name_(obj,arg1,arg2) \
|
316
320
|
VALUE obj,arg1,arg2; \
|
317
321
|
{ \
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
322
|
+
GLuint program; \
|
323
|
+
GLint location; \
|
324
|
+
_type_ params[16]; \
|
325
|
+
GLint unused = 0; \
|
326
|
+
GLenum uniform_type = 0; \
|
327
|
+
GLint uniform_size = 0; \
|
324
328
|
\
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
+
LOAD_GL_FUNC(gl##_name_, "2.0"); \
|
330
|
+
LOAD_GL_FUNC(glGetActiveUniform, "2.0"); \
|
331
|
+
program = (GLuint)NUM2UINT(arg1); \
|
332
|
+
location = (GLint)NUM2INT(arg2); \
|
329
333
|
\
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
+
fptr_glGetActiveUniform(program,location,0,NULL,&unused,&uniform_type,NULL); \
|
335
|
+
CHECK_GLERROR_FROM("glGetActiveUniform"); \
|
336
|
+
if (uniform_type==0) \
|
337
|
+
rb_raise(rb_eTypeError, "Can't determine the uniform's type"); \
|
334
338
|
\
|
335
|
-
|
339
|
+
uniform_size = get_uniform_size(uniform_type); \
|
336
340
|
\
|
337
|
-
|
338
|
-
|
339
|
-
|
341
|
+
memset(params,0,16*sizeof(_type_)); \
|
342
|
+
fptr_gl##_name_(program,location,params); \
|
343
|
+
RET_ARRAY_OR_SINGLE("gl" #_name_, uniform_size, RETCONV_##_type_, params); \
|
340
344
|
}
|
341
345
|
|
342
346
|
GETUNIFORM_FUNC(GetUniformfv,GLfloat)
|
@@ -349,19 +353,19 @@ static VALUE \
|
|
349
353
|
gl_##_name_(obj,arg1,arg2) \
|
350
354
|
VALUE obj,arg1,arg2; \
|
351
355
|
{ \
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
356
|
+
GLuint index; \
|
357
|
+
GLenum pname; \
|
358
|
+
_type_ params[4] = {0,0,0,0}; \
|
359
|
+
GLint size; \
|
360
|
+
LOAD_GL_FUNC(gl##_name_, "2.0"); \
|
361
|
+
index = (GLuint)NUM2UINT(arg1); \
|
362
|
+
pname = (GLenum)NUM2INT(arg2); \
|
363
|
+
if (pname==GL_CURRENT_VERTEX_ATTRIB) \
|
364
|
+
size = 4; \
|
365
|
+
else \
|
366
|
+
size = 1; \
|
367
|
+
fptr_gl##_name_(index,pname,params); \
|
368
|
+
RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
|
365
369
|
}
|
366
370
|
|
367
371
|
GETVERTEXATTRIB_FUNC(GetVertexAttribdv,GLdouble)
|
@@ -374,18 +378,18 @@ static VALUE
|
|
374
378
|
gl_GetVertexAttribiv(obj,arg1,arg2)
|
375
379
|
VALUE obj,arg1,arg2;
|
376
380
|
{
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
381
|
+
GLuint index;
|
382
|
+
GLenum pname;
|
383
|
+
GLint params[4] = {0,0,0,0};
|
384
|
+
GLint size;
|
385
|
+
LOAD_GL_FUNC(glGetVertexAttribiv, "2.0");
|
386
|
+
index = (GLuint)NUM2UINT(arg1);
|
387
|
+
pname = (GLenum)NUM2INT(arg2);
|
388
|
+
if (pname==GL_CURRENT_VERTEX_ATTRIB)
|
389
|
+
size = 4;
|
390
|
+
else
|
391
|
+
size = 1;
|
392
|
+
fptr_glGetVertexAttribiv(index,pname,params);
|
389
393
|
RET_ARRAY_OR_SINGLE_BOOL("glGetVertexAttribiv", size, cond_GLBOOL2RUBY,
|
390
394
|
pname, params);
|
391
395
|
}
|
@@ -398,13 +402,13 @@ static VALUE
|
|
398
402
|
gl_GetVertexAttribPointerv(obj,arg1)
|
399
403
|
VALUE obj,arg1;
|
400
404
|
{
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
405
|
+
GLuint index;
|
406
|
+
LOAD_GL_FUNC(glGetVertexAttribPointerv, "2.0");
|
407
|
+
index =(GLuint) NUM2INT(arg1);
|
408
|
+
if (index>_MAX_VERTEX_ATTRIBS)
|
409
|
+
rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
|
406
410
|
|
407
|
-
|
411
|
+
return g_VertexAttrib_ptr[index];
|
408
412
|
}
|
409
413
|
|
410
414
|
static void (APIENTRY * fptr_glShaderSource)(GLuint,GLsizei,GLchar**,GLint *);
|
@@ -412,17 +416,17 @@ static VALUE
|
|
412
416
|
gl_ShaderSource(obj,arg1,arg2)
|
413
417
|
VALUE obj,arg1,arg2;
|
414
418
|
{
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
419
|
+
GLuint shader;
|
420
|
+
GLint length;
|
421
|
+
GLchar *str;
|
422
|
+
LOAD_GL_FUNC(glShaderSource, "2.0");
|
423
|
+
shader = (GLuint)NUM2UINT(arg1);
|
424
|
+
Check_Type(arg2,T_STRING);
|
425
|
+
str = RSTRING_PTR(arg2);
|
426
|
+
length = (GLint)RSTRING_LENINT(arg2);
|
427
|
+
fptr_glShaderSource(shader,1,&str,&length);
|
428
|
+
CHECK_GLERROR_FROM("glShaderSource");
|
429
|
+
return Qnil;
|
426
430
|
}
|
427
431
|
|
428
432
|
#define UNIFORM_FUNC_V(_name_,_type_,_conv_,_size_) \
|
@@ -431,21 +435,21 @@ static VALUE \
|
|
431
435
|
gl_##_name_(obj,arg1,arg2) \
|
432
436
|
VALUE obj,arg1,arg2; \
|
433
437
|
{ \
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
438
|
+
GLint location; \
|
439
|
+
GLsizei count; \
|
440
|
+
_type_ *value; \
|
441
|
+
LOAD_GL_FUNC(gl##_name_,"2.0"); \
|
442
|
+
Check_Type(arg2,T_ARRAY); \
|
443
|
+
count = (GLsizei)RARRAY_LENINT(arg2); \
|
444
|
+
if (count<=0 || (count % _size_) != 0) \
|
445
|
+
rb_raise(rb_eArgError, "Parameter array size must be multiplication of %i",_size_); \
|
446
|
+
location = (GLint)NUM2INT(arg1); \
|
447
|
+
value = ALLOC_N(_type_,count); \
|
448
|
+
_conv_(arg2,value,count); \
|
449
|
+
fptr_gl##_name_(location,count / _size_,value); \
|
450
|
+
xfree(value); \
|
451
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
452
|
+
return Qnil; \
|
449
453
|
}
|
450
454
|
|
451
455
|
UNIFORM_FUNC_V(Uniform1fv,GLfloat,ary2cflt,1)
|
@@ -464,20 +468,20 @@ static VALUE \
|
|
464
468
|
gl_##_name_(obj,arg1,arg2,arg3) \
|
465
469
|
VALUE obj,arg1,arg2,arg3; \
|
466
470
|
{ \
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
471
|
+
GLint location; \
|
472
|
+
GLsizei count; \
|
473
|
+
GLboolean transpose; \
|
474
|
+
GLfloat *value; \
|
475
|
+
LOAD_GL_FUNC(gl##_name_, "2.0"); \
|
476
|
+
location = (GLint)NUM2INT(arg1); \
|
477
|
+
count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3), rb_intern("flatten"), 0)); \
|
478
|
+
transpose = (GLboolean)RUBYBOOL2GL(arg2); \
|
479
|
+
value = ALLOC_N(GLfloat, count); \
|
480
|
+
ary2cmatfloatcount(arg3,value,_size_,_size_); \
|
481
|
+
fptr_gl##_name_(location,count / (_size_*_size_),transpose,value); \
|
482
|
+
xfree(value); \
|
483
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
484
|
+
return Qnil; \
|
481
485
|
}
|
482
486
|
|
483
487
|
UNIFORMMATRIX_FUNC(UniformMatrix2fv,2)
|
@@ -491,14 +495,14 @@ static VALUE \
|
|
491
495
|
gl_##_name_(obj,arg1,arg2) \
|
492
496
|
VALUE obj,arg1,arg2; \
|
493
497
|
{ \
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
498
|
+
GLuint index; \
|
499
|
+
_type_ v[_size_]; \
|
500
|
+
LOAD_GL_FUNC(gl##_name_, "2.0"); \
|
501
|
+
index = (GLuint)NUM2UINT(arg1); \
|
502
|
+
_conv_(arg2,v,_size_); \
|
503
|
+
fptr_gl##_name_(index,v); \
|
504
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
505
|
+
return Qnil; \
|
502
506
|
}
|
503
507
|
|
504
508
|
VERTEXATTRIB_FUNC_V(VertexAttrib4Nbv,GLbyte,ary2cbyte,4)
|
@@ -531,133 +535,133 @@ static VALUE
|
|
531
535
|
gl_VertexAttribPointer(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
532
536
|
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
533
537
|
{
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
538
|
+
GLuint index;
|
539
|
+
GLuint size;
|
540
|
+
GLenum type;
|
541
|
+
GLboolean normalized;
|
542
|
+
GLsizei stride;
|
543
|
+
LOAD_GL_FUNC(glVertexAttribPointer, "2.0");
|
544
|
+
index = (GLuint)NUM2UINT(arg1);
|
545
|
+
size = (GLuint)NUM2UINT(arg2);
|
546
|
+
type = (GLenum)NUM2INT(arg3);
|
547
|
+
normalized = (GLboolean)RUBYBOOL2GL(arg4);
|
548
|
+
stride = (GLsizei)NUM2UINT(arg5);
|
549
|
+
if (index>_MAX_VERTEX_ATTRIBS)
|
550
|
+
rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
|
551
|
+
|
552
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
553
|
+
g_VertexAttrib_ptr[index] = arg6;
|
554
|
+
fptr_glVertexAttribPointer(index,size,type,normalized,stride,(GLvoid *)NUM2SIZET(arg6));
|
555
|
+
} else {
|
556
|
+
VALUE data;
|
557
|
+
data = pack_array_or_pass_string(type,arg6);
|
558
|
+
rb_str_freeze(data);
|
559
|
+
g_VertexAttrib_ptr[index] = data;
|
560
|
+
fptr_glVertexAttribPointer(index,size,type,normalized,stride,(GLvoid *)RSTRING_PTR(data));
|
561
|
+
}
|
562
|
+
CHECK_GLERROR_FROM("glVertexAttribPointer");
|
563
|
+
return Qnil;
|
560
564
|
}
|
561
565
|
|
562
566
|
void gl_init_functions_2_0(VALUE module)
|
563
567
|
{
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
568
|
+
rb_define_module_function(module, "glBlendEquationSeparate", gl_BlendEquationSeparate, 2);
|
569
|
+
rb_define_module_function(module, "glDrawBuffers", gl_DrawBuffers, 1);
|
570
|
+
rb_define_module_function(module, "glStencilOpSeparate", gl_StencilOpSeparate, 4);
|
571
|
+
rb_define_module_function(module, "glStencilFuncSeparate", gl_StencilFuncSeparate, 4);
|
572
|
+
rb_define_module_function(module, "glStencilMaskSeparate", gl_StencilMaskSeparate, 2);
|
573
|
+
rb_define_module_function(module, "glAttachShader", gl_AttachShader, 2);
|
574
|
+
rb_define_module_function(module, "glBindAttribLocation", gl_BindAttribLocation, 3);
|
575
|
+
rb_define_module_function(module, "glCompileShader", gl_CompileShader, 1);
|
576
|
+
rb_define_module_function(module, "glCreateProgram", gl_CreateProgram, 0);
|
577
|
+
rb_define_module_function(module, "glCreateShader", gl_CreateShader, 1);
|
578
|
+
rb_define_module_function(module, "glDeleteProgram", gl_DeleteProgram, 1);
|
579
|
+
rb_define_module_function(module, "glDeleteShader", gl_DeleteShader, 1);
|
580
|
+
rb_define_module_function(module, "glDetachShader", gl_DetachShader, 2);
|
581
|
+
rb_define_module_function(module, "glDisableVertexAttribArray", gl_DisableVertexAttribArray, 1);
|
582
|
+
rb_define_module_function(module, "glEnableVertexAttribArray", gl_EnableVertexAttribArray, 1);
|
583
|
+
rb_define_module_function(module, "glGetActiveAttrib", gl_GetActiveAttrib, 2);
|
584
|
+
rb_define_module_function(module, "glGetActiveUniform", gl_GetActiveUniform, 2);
|
585
|
+
rb_define_module_function(module, "glGetAttachedShaders", gl_GetAttachedShaders, 1);
|
586
|
+
rb_define_module_function(module, "glGetAttribLocation", gl_GetAttribLocation, 2);
|
587
|
+
rb_define_module_function(module, "glGetProgramiv", gl_GetProgramiv, 2);
|
588
|
+
rb_define_module_function(module, "glGetProgramInfoLog", gl_GetProgramInfoLog, 1);
|
589
|
+
rb_define_module_function(module, "glGetShaderiv", gl_GetShaderiv, 2);
|
590
|
+
rb_define_module_function(module, "glGetShaderInfoLog", gl_GetShaderInfoLog, 1);
|
591
|
+
rb_define_module_function(module, "glGetShaderSource", gl_GetShaderSource, 1);
|
592
|
+
rb_define_module_function(module, "glGetUniformLocation", gl_GetUniformLocation, 2);
|
593
|
+
rb_define_module_function(module, "glGetUniformfv", gl_GetUniformfv, 2);
|
594
|
+
rb_define_module_function(module, "glGetUniformiv", gl_GetUniformiv, 2);
|
595
|
+
rb_define_module_function(module, "glGetVertexAttribdv", gl_GetVertexAttribdv, 2);
|
596
|
+
rb_define_module_function(module, "glGetVertexAttribfv", gl_GetVertexAttribfv, 2);
|
597
|
+
rb_define_module_function(module, "glGetVertexAttribiv", gl_GetVertexAttribiv, 2);
|
598
|
+
rb_define_module_function(module, "glGetVertexAttribPointerv", gl_GetVertexAttribPointerv, 1);
|
599
|
+
rb_define_module_function(module, "glIsProgram", gl_IsProgram, 1);
|
600
|
+
rb_define_module_function(module, "glIsShader", gl_IsShader, 1);
|
601
|
+
rb_define_module_function(module, "glLinkProgram", gl_LinkProgram, 1);
|
602
|
+
rb_define_module_function(module, "glShaderSource", gl_ShaderSource, 2);
|
603
|
+
rb_define_module_function(module, "glUseProgram", gl_UseProgram, 1);
|
604
|
+
rb_define_module_function(module, "glUniform1f", gl_Uniform1f, 2);
|
605
|
+
rb_define_module_function(module, "glUniform2f", gl_Uniform2f, 3);
|
606
|
+
rb_define_module_function(module, "glUniform3f", gl_Uniform3f, 4);
|
607
|
+
rb_define_module_function(module, "glUniform4f", gl_Uniform4f, 5);
|
608
|
+
rb_define_module_function(module, "glUniform1i", gl_Uniform1i, 2);
|
609
|
+
rb_define_module_function(module, "glUniform2i", gl_Uniform2i, 3);
|
610
|
+
rb_define_module_function(module, "glUniform3i", gl_Uniform3i, 4);
|
611
|
+
rb_define_module_function(module, "glUniform4i", gl_Uniform4i, 5);
|
612
|
+
rb_define_module_function(module, "glUniform1fv", gl_Uniform1fv, 2);
|
613
|
+
rb_define_module_function(module, "glUniform2fv", gl_Uniform2fv, 2);
|
614
|
+
rb_define_module_function(module, "glUniform3fv", gl_Uniform3fv, 2);
|
615
|
+
rb_define_module_function(module, "glUniform4fv", gl_Uniform4fv, 2);
|
616
|
+
rb_define_module_function(module, "glUniform1iv", gl_Uniform1iv, 2);
|
617
|
+
rb_define_module_function(module, "glUniform2iv", gl_Uniform2iv, 2);
|
618
|
+
rb_define_module_function(module, "glUniform3iv", gl_Uniform3iv, 2);
|
619
|
+
rb_define_module_function(module, "glUniform4iv", gl_Uniform4iv, 2);
|
620
|
+
rb_define_module_function(module, "glUniformMatrix2fv", gl_UniformMatrix2fv, 3);
|
621
|
+
rb_define_module_function(module, "glUniformMatrix3fv", gl_UniformMatrix3fv, 3);
|
622
|
+
rb_define_module_function(module, "glUniformMatrix4fv", gl_UniformMatrix4fv, 3);
|
623
|
+
rb_define_module_function(module, "glValidateProgram", gl_ValidateProgram, 1);
|
624
|
+
rb_define_module_function(module, "glVertexAttrib1d", gl_VertexAttrib1d, 2);
|
625
|
+
rb_define_module_function(module, "glVertexAttrib1f", gl_VertexAttrib1f, 2);
|
626
|
+
rb_define_module_function(module, "glVertexAttrib1s", gl_VertexAttrib1s, 2);
|
627
|
+
rb_define_module_function(module, "glVertexAttrib2d", gl_VertexAttrib2d, 3);
|
628
|
+
rb_define_module_function(module, "glVertexAttrib2f", gl_VertexAttrib2f, 3);
|
629
|
+
rb_define_module_function(module, "glVertexAttrib2s", gl_VertexAttrib2s, 3);
|
630
|
+
rb_define_module_function(module, "glVertexAttrib3d", gl_VertexAttrib3d, 4);
|
631
|
+
rb_define_module_function(module, "glVertexAttrib3f", gl_VertexAttrib3f, 4);
|
632
|
+
rb_define_module_function(module, "glVertexAttrib3s", gl_VertexAttrib3s, 4);
|
633
|
+
rb_define_module_function(module, "glVertexAttrib4Nbv", gl_VertexAttrib4Nbv, 2);
|
634
|
+
rb_define_module_function(module, "glVertexAttrib4Niv", gl_VertexAttrib4Niv, 2);
|
635
|
+
rb_define_module_function(module, "glVertexAttrib4Nsv", gl_VertexAttrib4Nsv, 2);
|
636
|
+
rb_define_module_function(module, "glVertexAttrib4Nub", gl_VertexAttrib4Nub, 5);
|
637
|
+
rb_define_module_function(module, "glVertexAttrib4Nubv", gl_VertexAttrib4Nubv, 2);
|
638
|
+
rb_define_module_function(module, "glVertexAttrib4Nuiv", gl_VertexAttrib4Nuiv, 2);
|
639
|
+
rb_define_module_function(module, "glVertexAttrib4Nusv", gl_VertexAttrib4Nusv, 2);
|
640
|
+
rb_define_module_function(module, "glVertexAttrib4bv", gl_VertexAttrib4bv, 2);
|
641
|
+
rb_define_module_function(module, "glVertexAttrib4d", gl_VertexAttrib4d, 5);
|
642
|
+
rb_define_module_function(module, "glVertexAttrib4f", gl_VertexAttrib4f, 5);
|
643
|
+
rb_define_module_function(module, "glVertexAttrib4iv", gl_VertexAttrib4iv, 2);
|
644
|
+
rb_define_module_function(module, "glVertexAttrib4s", gl_VertexAttrib4s, 5);
|
645
|
+
rb_define_module_function(module, "glVertexAttrib4ubv", gl_VertexAttrib4ubv, 2);
|
646
|
+
rb_define_module_function(module, "glVertexAttrib4uiv", gl_VertexAttrib4uiv, 2);
|
647
|
+
rb_define_module_function(module, "glVertexAttrib4usv", gl_VertexAttrib4usv, 2);
|
648
|
+
rb_define_module_function(module, "glVertexAttrib1dv", gl_VertexAttrib1dv, 2);
|
649
|
+
rb_define_module_function(module, "glVertexAttrib1fv", gl_VertexAttrib1fv, 2);
|
650
|
+
rb_define_module_function(module, "glVertexAttrib1sv", gl_VertexAttrib1sv, 2);
|
651
|
+
rb_define_module_function(module, "glVertexAttrib2dv", gl_VertexAttrib2dv, 2);
|
652
|
+
rb_define_module_function(module, "glVertexAttrib2fv", gl_VertexAttrib2fv, 2);
|
653
|
+
rb_define_module_function(module, "glVertexAttrib2sv", gl_VertexAttrib2sv, 2);
|
654
|
+
rb_define_module_function(module, "glVertexAttrib3dv", gl_VertexAttrib3dv, 2);
|
655
|
+
rb_define_module_function(module, "glVertexAttrib3fv", gl_VertexAttrib3fv, 2);
|
656
|
+
rb_define_module_function(module, "glVertexAttrib3sv", gl_VertexAttrib3sv, 2);
|
657
|
+
rb_define_module_function(module, "glVertexAttrib4dv", gl_VertexAttrib4dv, 2);
|
658
|
+
rb_define_module_function(module, "glVertexAttrib4fv", gl_VertexAttrib4fv, 2);
|
659
|
+
rb_define_module_function(module, "glVertexAttrib4sv", gl_VertexAttrib4sv, 2);
|
660
|
+
rb_define_module_function(module, "glVertexAttribPointer", gl_VertexAttribPointer, 6);
|
661
|
+
|
662
|
+
{
|
663
|
+
int i;
|
664
|
+
for (i=0;i<_MAX_VERTEX_ATTRIBS;i++)
|
665
|
+
rb_global_variable(&g_VertexAttrib_ptr[i]);
|
666
|
+
}
|
663
667
|
}
|