opengl 0.7.0.pre1-x86-mingw32 → 0.7.0.pre2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +29 -0
- data/.gitignore +5 -8
- data/History.rdoc +33 -0
- data/Manifest.txt +72 -57
- data/README.rdoc +72 -25
- data/Rakefile +60 -72
- data/Rakefile.cross +5 -2
- data/{doc → docs}/build_install.txt +0 -0
- data/{doc → docs}/extensions.txt.in +0 -0
- data/{doc → docs}/history.txt +0 -0
- data/{doc → docs}/requirements_and_design.txt +0 -0
- data/{doc → docs}/roadmap.txt +0 -0
- data/{doc → docs}/scientific_use.txt +0 -0
- data/{doc → docs}/supplies/page_template.html +0 -0
- data/{doc → docs}/thanks.txt +0 -0
- data/{doc → docs}/tutorial.txt +0 -0
- data/examples/NeHe/NeHe.png +0 -0
- data/examples/NeHe/crate.png +0 -0
- data/examples/NeHe/glass.png +0 -0
- data/examples/NeHe/nehe_lesson02.rb +82 -83
- data/examples/NeHe/nehe_lesson03.rb +88 -88
- data/examples/NeHe/nehe_lesson04.rb +93 -96
- data/examples/NeHe/nehe_lesson05.rb +137 -144
- data/examples/NeHe/nehe_lesson06.rb +183 -0
- data/examples/NeHe/nehe_lesson07.rb +237 -0
- data/examples/NeHe/nehe_lesson08.rb +252 -0
- data/examples/NeHe/nehe_lesson09.rb +199 -0
- data/examples/NeHe/nehe_lesson11.rb +173 -0
- data/examples/NeHe/nehe_lesson12.rb +200 -0
- data/examples/NeHe/nehe_lesson16.rb +208 -0
- data/examples/NeHe/nehe_lesson19.rb +206 -0
- data/examples/NeHe/particle.png +0 -0
- data/examples/NeHe/star.png +0 -0
- data/examples/NeHe/tim.png +0 -0
- data/examples/RedBook/light.rb +154 -0
- data/examples/misc/OGLBench.rb +2 -2
- data/examples/misc/trislam.rb +2 -2
- data/ext/{common → opengl}/common.h +2 -11
- data/ext/{common → opengl}/conv.h +43 -31
- data/ext/{glut → opengl}/extconf.rb +14 -7
- data/ext/{common → opengl}/funcdef.h +155 -125
- data/ext/{gl → opengl}/gl-1.0-1.1.c +426 -162
- data/ext/{gl → opengl}/gl-1.2.c +70 -66
- data/ext/{gl → opengl}/gl-1.3.c +19 -19
- data/ext/{gl → opengl}/gl-1.4.c +23 -23
- data/ext/{gl → opengl}/gl-1.5.c +46 -47
- data/ext/{gl → opengl}/gl-2.0.c +66 -60
- data/ext/{gl → opengl}/gl-2.1.c +4 -4
- data/ext/{gl → opengl}/gl-enums.c +2 -1
- data/ext/{common → opengl}/gl-enums.h +0 -0
- data/ext/{gl → opengl}/gl-error.c +12 -4
- data/ext/{common → opengl}/gl-error.h +7 -2
- data/ext/{gl → opengl}/gl-ext-3dfx.c +1 -1
- data/ext/{gl → opengl}/gl-ext-arb.c +75 -70
- data/ext/{gl → opengl}/gl-ext-ati.c +3 -3
- data/ext/{gl → opengl}/gl-ext-ext.c +54 -54
- data/ext/{gl → opengl}/gl-ext-gremedy.c +3 -3
- data/ext/{gl → opengl}/gl-ext-nv.c +49 -48
- data/ext/{common → opengl}/gl-types.h +0 -0
- data/ext/{gl → opengl}/gl.c +8 -10
- data/ext/{glu → opengl}/glu-enums.c +1 -1
- data/ext/{common → opengl}/glu-enums.h +0 -0
- data/ext/{glu → opengl}/glu.c +7 -3
- data/ext/{glut → opengl}/glut.c +98 -48
- data/ext/opengl/opengl.c +11 -0
- data/lib/gl.rb +1 -0
- data/lib/glu.rb +1 -0
- data/lib/glut.rb +1 -0
- data/lib/opengl.rb +13 -14
- data/lib/opengl/opengl.so +0 -0
- data/lib/opengl/test_case.rb +87 -0
- data/test/{tc_misc.rb → test_gl.rb} +2 -14
- data/test/test_gl_10_11.rb +1363 -0
- data/test/test_gl_12.rb +182 -0
- data/test/{tc_func_13.rb → test_gl_13.rb} +14 -14
- data/test/test_gl_14.rb +221 -0
- data/test/test_gl_15.rb +260 -0
- data/test/test_gl_20.rb +430 -0
- data/test/test_gl_21.rb +553 -0
- data/test/test_gl_ext_arb.rb +526 -0
- data/test/{tc_ext_ati.rb → test_gl_ext_ati.rb} +11 -14
- data/test/test_gl_ext_ext.rb +608 -0
- data/test/{tc_ext_gremedy.rb → test_gl_ext_gremedy.rb} +6 -6
- data/test/test_gl_ext_nv.rb +352 -0
- data/test/test_glu.rb +309 -0
- metadata +159 -102
- data/History.txt +0 -36
- data/ext/gl/extconf.rb +0 -43
- data/ext/glu/extconf.rb +0 -51
- data/test/README +0 -10
- data/test/tc_common.rb +0 -98
- data/test/tc_ext_arb.rb +0 -467
- data/test/tc_ext_ext.rb +0 -551
- data/test/tc_ext_nv.rb +0 -357
- data/test/tc_func_10_11.rb +0 -1281
- data/test/tc_func_12.rb +0 -186
- data/test/tc_func_14.rb +0 -197
- data/test/tc_func_15.rb +0 -270
- data/test/tc_func_20.rb +0 -346
- data/test/tc_func_21.rb +0 -541
- data/test/tc_glu.rb +0 -310
- data/test/tc_include_gl.rb +0 -35
- data/test/tc_require_gl.rb +0 -34
@@ -18,6 +18,11 @@ void gl_init_error(VALUE);
|
|
18
18
|
extern VALUE error_checking;
|
19
19
|
extern VALUE inside_begin_end;
|
20
20
|
|
21
|
-
void check_for_glerror(
|
21
|
+
void check_for_glerror(const char *);
|
22
|
+
|
23
|
+
#define CHECK_GLERROR_FROM(caller) \
|
24
|
+
do { \
|
25
|
+
if (error_checking == Qtrue && inside_begin_end == Qfalse) \
|
26
|
+
check_for_glerror(caller); \
|
27
|
+
} while (0)
|
22
28
|
|
23
|
-
#define CHECK_GLERROR if (error_checking==Qtrue && inside_begin_end==Qfalse) check_for_glerror();
|
@@ -13,7 +13,7 @@
|
|
13
13
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
14
|
*/
|
15
15
|
|
16
|
-
#include "
|
16
|
+
#include "common.h"
|
17
17
|
|
18
18
|
/* OpenGL ARB extensions */
|
19
19
|
|
@@ -25,10 +25,10 @@ gl_##_name_(obj,arg1) \
|
|
25
25
|
VALUE obj,arg1; \
|
26
26
|
{ \
|
27
27
|
_type_ m[4*4]; \
|
28
|
-
LOAD_GL_FUNC(gl##_name_,"GL_ARB_transpose_matrix") \
|
28
|
+
LOAD_GL_FUNC(gl##_name_, "GL_ARB_transpose_matrix"); \
|
29
29
|
_conv_(arg1, m, 4, 4); \
|
30
30
|
fptr_gl##_name_(m); \
|
31
|
-
|
31
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
32
32
|
return Qnil; \
|
33
33
|
}
|
34
34
|
|
@@ -51,7 +51,7 @@ static VALUE gl_PointParameterfvARB(VALUE obj,VALUE arg1,VALUE arg2)
|
|
51
51
|
GLfloat params[3] = {(GLfloat)0.0,(GLfloat)0.0,(GLfloat)0.0};
|
52
52
|
GLenum pname;
|
53
53
|
GLint size;
|
54
|
-
LOAD_GL_FUNC(glPointParameterfvARB,"GL_ARB_point_parameters")
|
54
|
+
LOAD_GL_FUNC(glPointParameterfvARB, "GL_ARB_point_parameters");
|
55
55
|
pname = NUM2UINT(arg1);
|
56
56
|
Check_Type(arg2,T_ARRAY);
|
57
57
|
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
@@ -60,7 +60,7 @@ static VALUE gl_PointParameterfvARB(VALUE obj,VALUE arg1,VALUE arg2)
|
|
60
60
|
size = 1;
|
61
61
|
ary2cflt(arg2,params,size);
|
62
62
|
fptr_glPointParameterfvARB(pname,params);
|
63
|
-
|
63
|
+
CHECK_GLERROR_FROM("glPointParameterfvARB");
|
64
64
|
return Qnil;
|
65
65
|
}
|
66
66
|
|
@@ -79,13 +79,13 @@ static void (APIENTRY * fptr_gl##_name_)(const _type_ *); \
|
|
79
79
|
static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
|
80
80
|
{ \
|
81
81
|
_type_ cary[_size_]; \
|
82
|
-
LOAD_GL_FUNC(gl##_name_,_ext_) \
|
82
|
+
LOAD_GL_FUNC(gl##_name_, _ext_); \
|
83
83
|
Check_Type(arg1,T_ARRAY); \
|
84
84
|
if (RARRAY_LEN(arg1) != _size_) \
|
85
85
|
rb_raise(rb_eArgError, "Incorrect array length - must have '%i' elements.",_size_); \
|
86
86
|
_conv_(arg1,cary,_size_); \
|
87
87
|
fptr_gl##_name_(cary); \
|
88
|
-
|
88
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
89
89
|
return Qnil; \
|
90
90
|
}
|
91
91
|
|
@@ -104,10 +104,10 @@ WINDOWPOSFUNCV(WindowPos3svARB,GLshort,ary2cshort,3,"GL_ARB_window_pos")
|
|
104
104
|
static void (APIENTRY * fptr_glProgramStringARB)(GLenum,GLenum,GLsizei,const void *);
|
105
105
|
static VALUE gl_ProgramStringARB(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3)
|
106
106
|
{
|
107
|
-
LOAD_GL_FUNC(glProgramStringARB,"GL_ARB_vertex_program")
|
107
|
+
LOAD_GL_FUNC(glProgramStringARB, "GL_ARB_vertex_program");
|
108
108
|
Check_Type(arg3,T_STRING);
|
109
109
|
fptr_glProgramStringARB((GLenum)NUM2INT(arg1),(GLenum)NUM2INT(arg2),(GLsizei)RSTRING_LENINT(arg3),RSTRING_PTR(arg3));
|
110
|
-
|
110
|
+
CHECK_GLERROR_FROM("glProgramStringARB");
|
111
111
|
return Qnil;
|
112
112
|
}
|
113
113
|
|
@@ -115,9 +115,9 @@ static void (APIENTRY * fptr_glGetProgramivARB)(GLenum,GLenum,GLint *);
|
|
115
115
|
static VALUE gl_GetProgramivARB(VALUE obj,VALUE arg1,VALUE arg2)
|
116
116
|
{
|
117
117
|
GLint ret = 0;
|
118
|
-
LOAD_GL_FUNC(glGetProgramivARB,"GL_ARB_vertex_program")
|
118
|
+
LOAD_GL_FUNC(glGetProgramivARB, "GL_ARB_vertex_program");
|
119
119
|
fptr_glGetProgramivARB(NUM2INT(arg1),NUM2INT(arg2),&ret);
|
120
|
-
|
120
|
+
CHECK_GLERROR_FROM("glGetProgramivARB");
|
121
121
|
return cond_GLBOOL2RUBY(NUM2INT(arg2),ret);
|
122
122
|
}
|
123
123
|
|
@@ -128,11 +128,11 @@ static VALUE gl_GetProgramStringARB(VALUE obj,VALUE arg1,VALUE arg2)
|
|
128
128
|
char *buffer;
|
129
129
|
VALUE ret_buffer;
|
130
130
|
|
131
|
-
LOAD_GL_FUNC(glGetProgramStringARB,"GL_ARB_vertex_program")
|
132
|
-
LOAD_GL_FUNC(glGetProgramivARB,"GL_ARB_vertex_program")
|
131
|
+
LOAD_GL_FUNC(glGetProgramStringARB, "GL_ARB_vertex_program");
|
132
|
+
LOAD_GL_FUNC(glGetProgramivARB, "GL_ARB_vertex_program");
|
133
133
|
|
134
134
|
fptr_glGetProgramivARB(NUM2INT(arg1),GL_PROGRAM_LENGTH_ARB,&len);
|
135
|
-
|
135
|
+
CHECK_GLERROR_FROM("glGetProgramivARB");
|
136
136
|
if (len<=0)
|
137
137
|
return rb_str_new2("");
|
138
138
|
|
@@ -142,7 +142,7 @@ static VALUE gl_GetProgramStringARB(VALUE obj,VALUE arg1,VALUE arg2)
|
|
142
142
|
ret_buffer = rb_str_new2(buffer);
|
143
143
|
xfree(buffer);
|
144
144
|
|
145
|
-
|
145
|
+
CHECK_GLERROR_FROM("glGetProgramStringARB");
|
146
146
|
return ret_buffer;
|
147
147
|
}
|
148
148
|
|
@@ -164,12 +164,12 @@ static VALUE gl_VertexAttribPointerARB(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg
|
|
164
164
|
GLboolean normalized;
|
165
165
|
GLsizei stride;
|
166
166
|
|
167
|
-
LOAD_GL_FUNC(glVertexAttribPointerARB,"GL_ARB_vertex_program")
|
167
|
+
LOAD_GL_FUNC(glVertexAttribPointerARB, "GL_ARB_vertex_program");
|
168
168
|
|
169
169
|
index = (GLuint)NUM2UINT(arg1);
|
170
170
|
size = (GLuint)NUM2UINT(arg2);
|
171
171
|
type = (GLenum)NUM2INT(arg3);
|
172
|
-
normalized = (GLboolean)
|
172
|
+
normalized = (GLboolean)RUBYBOOL2GL(arg4);
|
173
173
|
stride = (GLsizei)NUM2UINT(arg5);
|
174
174
|
if (index>_MAX_VERTEX_ATTRIBS)
|
175
175
|
rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
|
@@ -185,7 +185,7 @@ static VALUE gl_VertexAttribPointerARB(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg
|
|
185
185
|
fptr_glVertexAttribPointerARB(index,size,type,normalized,stride,(GLvoid *)RSTRING_PTR(data));
|
186
186
|
}
|
187
187
|
|
188
|
-
|
188
|
+
CHECK_GLERROR_FROM("glVertexAttribPointerARB");
|
189
189
|
return Qnil;
|
190
190
|
}
|
191
191
|
|
@@ -196,7 +196,7 @@ gl_GetVertexAttribPointervARB(obj,arg1)
|
|
196
196
|
VALUE obj,arg1;
|
197
197
|
{
|
198
198
|
GLuint index;
|
199
|
-
LOAD_GL_FUNC(glGetVertexAttribPointervARB,"GL_ARB_vertex_program")
|
199
|
+
LOAD_GL_FUNC(glGetVertexAttribPointervARB, "GL_ARB_vertex_program");
|
200
200
|
index =(GLuint) NUM2INT(arg1);
|
201
201
|
if (index>_MAX_VERTEX_ATTRIBS)
|
202
202
|
rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
|
@@ -216,10 +216,10 @@ gl_##_name_(obj,arg1,arg2,arg3) \
|
|
216
216
|
VALUE obj,arg1,arg2,arg3; \
|
217
217
|
{ \
|
218
218
|
_type_ cary[4]; \
|
219
|
-
LOAD_GL_FUNC(gl##_name_,_extension_) \
|
219
|
+
LOAD_GL_FUNC(gl##_name_, _extension_); \
|
220
220
|
_conv_(arg3,cary,4); \
|
221
221
|
fptr_gl##_name_(NUM2UINT(arg1),NUM2UINT(arg2),cary); \
|
222
|
-
|
222
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
223
223
|
return Qnil; \
|
224
224
|
}
|
225
225
|
|
@@ -236,9 +236,9 @@ gl_##_name_(obj,arg1,arg2) \
|
|
236
236
|
VALUE obj,arg1,arg2; \
|
237
237
|
{ \
|
238
238
|
_type_ cary[4] = {(_type_)0.0,(_type_)0.0,(_type_)0.0,(_type_)0.0}; \
|
239
|
-
LOAD_GL_FUNC(gl##_name_,_extension_) \
|
239
|
+
LOAD_GL_FUNC(gl##_name_, _extension_); \
|
240
240
|
fptr_gl##_name_(NUM2UINT(arg1),NUM2UINT(arg2),cary); \
|
241
|
-
RET_ARRAY_OR_SINGLE(4,RETCONV_##_type_,cary) \
|
241
|
+
RET_ARRAY_OR_SINGLE("gl" #_name_, 4, RETCONV_##_type_, cary); \
|
242
242
|
}
|
243
243
|
|
244
244
|
GETPROGRAMPARAM_FUNC(GetProgramEnvParameterdvARB,GLdouble,"GL_ARB_vertex_program")
|
@@ -270,11 +270,11 @@ VALUE obj,arg1,arg2; \
|
|
270
270
|
{ \
|
271
271
|
GLuint index; \
|
272
272
|
_type_ v[_size_]; \
|
273
|
-
LOAD_GL_FUNC(gl##_name_,_extension_)
|
273
|
+
LOAD_GL_FUNC(gl##_name_, _extension_); \
|
274
274
|
index = (GLuint)NUM2UINT(arg1); \
|
275
275
|
_conv_(arg2,v,_size_); \
|
276
276
|
fptr_gl##_name_(index,v); \
|
277
|
-
|
277
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
278
278
|
return Qnil; \
|
279
279
|
}
|
280
280
|
|
@@ -313,7 +313,7 @@ VALUE obj,arg1,arg2; \
|
|
313
313
|
GLenum pname; \
|
314
314
|
_type_ params[4] = {0,0,0,0}; \
|
315
315
|
GLint size; \
|
316
|
-
LOAD_GL_FUNC(gl##_name_,_extension_) \
|
316
|
+
LOAD_GL_FUNC(gl##_name_, _extension_); \
|
317
317
|
index = (GLuint)NUM2UINT(arg1); \
|
318
318
|
pname = (GLenum)NUM2INT(arg2); \
|
319
319
|
if (pname==GL_CURRENT_VERTEX_ATTRIB_ARB) \
|
@@ -321,7 +321,7 @@ VALUE obj,arg1,arg2; \
|
|
321
321
|
else \
|
322
322
|
size = 1; \
|
323
323
|
fptr_gl##_name_(index,pname,params); \
|
324
|
-
RET_ARRAY_OR_SINGLE(size,RETCONV_##_type_,params) \
|
324
|
+
RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
|
325
325
|
}
|
326
326
|
|
327
327
|
GETVERTEXATTRIB_FUNC(GetVertexAttribdvARB,GLdouble,"GL_ARB_vertex_program")
|
@@ -338,7 +338,7 @@ VALUE obj,arg1,arg2;
|
|
338
338
|
GLenum pname;
|
339
339
|
GLint params[4] = {0,0,0,0};
|
340
340
|
GLint size;
|
341
|
-
LOAD_GL_FUNC(glGetVertexAttribivARB,"GL_ARB_vertex_program")
|
341
|
+
LOAD_GL_FUNC(glGetVertexAttribivARB, "GL_ARB_vertex_program");
|
342
342
|
index = (GLuint)NUM2UINT(arg1);
|
343
343
|
pname = (GLenum)NUM2INT(arg2);
|
344
344
|
if (pname==GL_CURRENT_VERTEX_ATTRIB)
|
@@ -346,7 +346,8 @@ VALUE obj,arg1,arg2;
|
|
346
346
|
else
|
347
347
|
size = 1;
|
348
348
|
fptr_glGetVertexAttribivARB(index,pname,params);
|
349
|
-
|
349
|
+
RET_ARRAY_OR_SINGLE_BOOL("glGetVertexAttribivARB", size, cond_GLBOOL2RUBY,
|
350
|
+
pname, params);
|
350
351
|
}
|
351
352
|
|
352
353
|
|
@@ -362,9 +363,9 @@ static void (APIENTRY * fptr_gl##_name_)(GLuint,GLenum,_type_ *); \
|
|
362
363
|
static VALUE gl_##_name_(VALUE obj,VALUE arg1,VALUE arg2) \
|
363
364
|
{ \
|
364
365
|
_type_ ret = 0; \
|
365
|
-
LOAD_GL_FUNC(gl##_name_,"GL_ARB_occlusion_query") \
|
366
|
+
LOAD_GL_FUNC(gl##_name_, "GL_ARB_occlusion_query"); \
|
366
367
|
fptr_gl##_name_(NUM2INT(arg1),NUM2INT(arg2),&ret); \
|
367
|
-
|
368
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
368
369
|
return _conv_(NUM2INT(arg2),ret); \
|
369
370
|
}
|
370
371
|
|
@@ -393,13 +394,13 @@ VALUE obj,arg1,arg2;
|
|
393
394
|
GLuint shader;
|
394
395
|
GLint length;
|
395
396
|
GLchar *str;
|
396
|
-
LOAD_GL_FUNC(glShaderSourceARB,"GL_ARB_shader_objects")
|
397
|
+
LOAD_GL_FUNC(glShaderSourceARB, "GL_ARB_shader_objects");
|
397
398
|
shader = (GLuint)NUM2UINT(arg1);
|
398
399
|
Check_Type(arg2,T_STRING);
|
399
400
|
str = RSTRING_PTR(arg2);
|
400
401
|
length = (GLint)RSTRING_LENINT(arg2);
|
401
402
|
fptr_glShaderSourceARB(shader,1,&str,&length);
|
402
|
-
|
403
|
+
CHECK_GLERROR_FROM("glShaderSourceARB");
|
403
404
|
return Qnil;
|
404
405
|
}
|
405
406
|
|
@@ -421,7 +422,7 @@ VALUE obj,arg1,arg2; \
|
|
421
422
|
GLint location; \
|
422
423
|
GLsizei count; \
|
423
424
|
_type_ *value; \
|
424
|
-
LOAD_GL_FUNC(gl##_name_,"GL_ARB_shader_objects") \
|
425
|
+
LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
|
425
426
|
Check_Type(arg2,T_ARRAY); \
|
426
427
|
count = (GLsizei)RARRAY_LENINT(arg2); \
|
427
428
|
if (count<=0 || (count % _size_) != 0) \
|
@@ -431,7 +432,7 @@ VALUE obj,arg1,arg2; \
|
|
431
432
|
_conv_(arg2,value,count); \
|
432
433
|
fptr_gl##_name_(location,count / _size_,value); \
|
433
434
|
xfree(value); \
|
434
|
-
|
435
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
435
436
|
return Qnil; \
|
436
437
|
}
|
437
438
|
|
@@ -455,15 +456,15 @@ VALUE obj,arg1,arg2,arg3; \
|
|
455
456
|
GLsizei count; \
|
456
457
|
GLboolean transpose; \
|
457
458
|
GLfloat *value; \
|
458
|
-
LOAD_GL_FUNC(gl##_name_,"GL_ARB_shader_objects") \
|
459
|
+
LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
|
459
460
|
location = (GLint)NUM2INT(arg1); \
|
460
461
|
count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3),rb_intern("flatten"),0)); \
|
461
|
-
transpose = (GLboolean)
|
462
|
+
transpose = (GLboolean)RUBYBOOL2GL(arg2); \
|
462
463
|
value = ALLOC_N(GLfloat, count); \
|
463
464
|
ary2cmatfloatcount(arg3,value,_size_,_size_); \
|
464
465
|
fptr_gl##_name_(location,count / (_size_*_size_),transpose,value); \
|
465
466
|
xfree(value); \
|
466
|
-
|
467
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
467
468
|
return Qnil; \
|
468
469
|
}
|
469
470
|
|
@@ -481,11 +482,11 @@ VALUE obj,arg1,arg2; \
|
|
481
482
|
GLuint program; \
|
482
483
|
GLenum pname; \
|
483
484
|
_type_ params = 0; \
|
484
|
-
LOAD_GL_FUNC(gl##_name_,"GL_ARB_shader_objects") \
|
485
|
+
LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
|
485
486
|
program = (GLuint)NUM2UINT(arg1); \
|
486
487
|
pname = (GLenum)NUM2INT(arg2); \
|
487
488
|
fptr_gl##_name_(program,pname,¶ms); \
|
488
|
-
|
489
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
489
490
|
return _conv_(pname,params); \
|
490
491
|
}
|
491
492
|
|
@@ -503,16 +504,16 @@ VALUE obj,arg1;
|
|
503
504
|
GLint max_size = 0;
|
504
505
|
GLsizei ret_length = 0;
|
505
506
|
VALUE buffer;
|
506
|
-
LOAD_GL_FUNC(glGetInfoLogARB,"GL_ARB_shader_objects")
|
507
|
-
LOAD_GL_FUNC(glGetObjectParameterivARB,"GL_ARB_shader_objects")
|
507
|
+
LOAD_GL_FUNC(glGetInfoLogARB, "GL_ARB_shader_objects");
|
508
|
+
LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
|
508
509
|
program = (GLuint)NUM2UINT(arg1);
|
509
510
|
fptr_glGetObjectParameterivARB(program,GL_OBJECT_INFO_LOG_LENGTH_ARB,&max_size);
|
510
|
-
|
511
|
+
CHECK_GLERROR_FROM("glGetObjectParameterivARB");
|
511
512
|
if (max_size<=0)
|
512
513
|
return rb_str_new2("");
|
513
514
|
buffer = allocate_buffer_with_string(max_size);
|
514
515
|
fptr_glGetInfoLogARB(program,max_size,&ret_length,RSTRING_PTR(buffer));
|
515
|
-
|
516
|
+
CHECK_GLERROR_FROM("glGetInfoLogARB");
|
516
517
|
return buffer;
|
517
518
|
}
|
518
519
|
|
@@ -525,16 +526,16 @@ VALUE obj,arg1;
|
|
525
526
|
GLint max_size = 0;
|
526
527
|
GLsizei ret_length = 0;
|
527
528
|
VALUE buffer;
|
528
|
-
LOAD_GL_FUNC(glGetShaderSourceARB,"GL_ARB_shader_objects")
|
529
|
-
LOAD_GL_FUNC(glGetObjectParameterivARB,"GL_ARB_shader_objects")
|
529
|
+
LOAD_GL_FUNC(glGetShaderSourceARB, "GL_ARB_shader_objects");
|
530
|
+
LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
|
530
531
|
shader = (GLuint)NUM2UINT(arg1);
|
531
532
|
fptr_glGetObjectParameterivARB(shader,GL_OBJECT_SHADER_SOURCE_LENGTH_ARB,&max_size);
|
532
|
-
|
533
|
+
CHECK_GLERROR_FROM("glGetObjectParameterivARB");
|
533
534
|
if (max_size==0)
|
534
535
|
rb_raise(rb_eTypeError, "Can't determine maximum shader source length");
|
535
536
|
buffer = allocate_buffer_with_string(max_size-1);
|
536
537
|
fptr_glGetShaderSourceARB(shader,max_size,&ret_length,RSTRING_PTR(buffer));
|
537
|
-
|
538
|
+
CHECK_GLERROR_FROM("glGetShaderSourceARB");
|
538
539
|
return buffer;
|
539
540
|
}
|
540
541
|
|
@@ -551,21 +552,23 @@ VALUE obj,arg1,arg2;
|
|
551
552
|
GLenum uniform_type = 0;
|
552
553
|
VALUE buffer;
|
553
554
|
VALUE retary;
|
554
|
-
LOAD_GL_FUNC(glGetActiveUniformARB,"GL_ARB_shader_objects")
|
555
|
-
LOAD_GL_FUNC(glGetObjectParameterivARB,"GL_EXT_sahder_objects")
|
555
|
+
LOAD_GL_FUNC(glGetActiveUniformARB, "GL_ARB_shader_objects");
|
556
|
+
LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_EXT_sahder_objects");
|
556
557
|
program = (GLuint)NUM2UINT(arg1);
|
557
558
|
index = (GLuint)NUM2UINT(arg2);
|
558
559
|
fptr_glGetObjectParameterivARB(program,GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB,&max_size);
|
559
|
-
|
560
|
+
CHECK_GLERROR_FROM("glGetObjectParameterivARB");
|
560
561
|
if (max_size==0)
|
561
562
|
rb_raise(rb_eTypeError, "Can't determine maximum uniform name length");
|
562
563
|
buffer = allocate_buffer_with_string(max_size-1);
|
563
564
|
fptr_glGetActiveUniformARB(program,index,max_size,&written,&uniform_size,&uniform_type,RSTRING_PTR(buffer));
|
565
|
+
|
566
|
+
rb_str_set_len(buffer, strnlen(RSTRING_PTR(buffer), max_size));
|
564
567
|
retary = rb_ary_new2(3);
|
565
568
|
rb_ary_push(retary, INT2NUM(uniform_size));
|
566
569
|
rb_ary_push(retary, INT2NUM(uniform_type));
|
567
570
|
rb_ary_push(retary, buffer);
|
568
|
-
|
571
|
+
CHECK_GLERROR_FROM("glGetACtiveUniformARB");
|
569
572
|
return retary;
|
570
573
|
}
|
571
574
|
|
@@ -582,13 +585,13 @@ VALUE obj,arg1,arg2; \
|
|
582
585
|
GLenum uniform_type = 0; \
|
583
586
|
GLint uniform_size = 0; \
|
584
587
|
\
|
585
|
-
LOAD_GL_FUNC(gl##_name_,"GL_ARB_shader_objects") \
|
586
|
-
LOAD_GL_FUNC(glGetActiveUniformARB,"GL_ARB_shader_objects") \
|
588
|
+
LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
|
589
|
+
LOAD_GL_FUNC(glGetActiveUniformARB, "GL_ARB_shader_objects"); \
|
587
590
|
program = (GLuint)NUM2UINT(arg1); \
|
588
591
|
location = (GLint)NUM2INT(arg2); \
|
589
592
|
\
|
590
593
|
fptr_glGetActiveUniformARB(program,location,0,NULL,&unused,&uniform_type,NULL); \
|
591
|
-
|
594
|
+
CHECK_GLERROR_FROM("glGetActiveUniformARB"); \
|
592
595
|
if (uniform_type==0) \
|
593
596
|
rb_raise(rb_eTypeError, "Can't determine the uniform's type"); \
|
594
597
|
\
|
@@ -596,7 +599,8 @@ VALUE obj,arg1,arg2; \
|
|
596
599
|
\
|
597
600
|
memset(params,0,16*sizeof(_type_)); \
|
598
601
|
fptr_gl##_name_(program,location,params); \
|
599
|
-
|
602
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
603
|
+
RET_ARRAY_OR_SINGLE("gl" #_name_, uniform_size, RETCONV_##_type_, params); \
|
600
604
|
}
|
601
605
|
|
602
606
|
GETUNIFORM_FUNC(GetUniformfvARB,GLfloat)
|
@@ -610,11 +614,11 @@ VALUE obj,arg1,arg2;
|
|
610
614
|
{
|
611
615
|
GLuint program;
|
612
616
|
GLint ret;
|
613
|
-
LOAD_GL_FUNC(glGetUniformLocationARB,"GL_ARB_shader_objects")
|
617
|
+
LOAD_GL_FUNC(glGetUniformLocationARB, "GL_ARB_shader_objects");
|
614
618
|
program=(GLuint)NUM2UINT(arg1);
|
615
619
|
Check_Type(arg2,T_STRING);
|
616
620
|
ret = fptr_glGetUniformLocationARB(program,RSTRING_PTR(arg2));
|
617
|
-
|
621
|
+
CHECK_GLERROR_FROM("glGetUniformLocationARB");
|
618
622
|
return INT2NUM(ret);
|
619
623
|
}
|
620
624
|
|
@@ -627,16 +631,17 @@ VALUE obj,arg1;
|
|
627
631
|
GLint shaders_num = 0;
|
628
632
|
GLuint *shaders;
|
629
633
|
GLsizei count = 0;
|
630
|
-
LOAD_GL_FUNC(glGetAttachedObjectsARB,"GL_ARB_shader_objects")
|
631
|
-
LOAD_GL_FUNC(glGetObjectParameterivARB,"GL_ARB_shader_objects")
|
634
|
+
LOAD_GL_FUNC(glGetAttachedObjectsARB, "GL_ARB_shader_objects");
|
635
|
+
LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
|
632
636
|
program = (GLuint)NUM2UINT(arg1);
|
633
637
|
fptr_glGetObjectParameterivARB(program,GL_OBJECT_ATTACHED_OBJECTS_ARB,&shaders_num);
|
634
|
-
|
638
|
+
CHECK_GLERROR_FROM("glGetObjectParameterivARB");
|
635
639
|
if (shaders_num<=0)
|
636
640
|
return Qnil;
|
637
641
|
shaders = ALLOC_N(GLuint,shaders_num);
|
638
642
|
fptr_glGetAttachedObjectsARB(program,shaders_num,&count,shaders);
|
639
|
-
|
643
|
+
RET_ARRAY_OR_SINGLE_FREE("glGetAttachedObjectsARB", count, RETCONV_GLuint,
|
644
|
+
shaders);
|
640
645
|
}
|
641
646
|
|
642
647
|
/* #31 GL_ARB_vertex_shader */
|
@@ -648,12 +653,12 @@ VALUE obj,arg1,arg2,arg3;
|
|
648
653
|
{
|
649
654
|
GLuint program;
|
650
655
|
GLuint index;
|
651
|
-
LOAD_GL_FUNC(glBindAttribLocationARB,"GL_ARB_vertex_shader")
|
656
|
+
LOAD_GL_FUNC(glBindAttribLocationARB, "GL_ARB_vertex_shader");
|
652
657
|
program = (GLuint)NUM2UINT(arg1);
|
653
658
|
index = (GLuint)NUM2UINT(arg2);
|
654
659
|
Check_Type(arg3, T_STRING);
|
655
660
|
fptr_glBindAttribLocationARB(program,index,RSTRING_PTR(arg3));
|
656
|
-
|
661
|
+
CHECK_GLERROR_FROM("glBindAttribLocationARB");
|
657
662
|
return Qnil;
|
658
663
|
}
|
659
664
|
|
@@ -670,12 +675,12 @@ VALUE obj,arg1,arg2;
|
|
670
675
|
GLenum attrib_type = 0;
|
671
676
|
VALUE buffer;
|
672
677
|
VALUE retary;
|
673
|
-
LOAD_GL_FUNC(glGetActiveAttribARB,"GL_ARB_vertex_shader")
|
674
|
-
LOAD_GL_FUNC(glGetObjectParameterivARB,"GL_ARB_vertex_shader")
|
678
|
+
LOAD_GL_FUNC(glGetActiveAttribARB, "GL_ARB_vertex_shader");
|
679
|
+
LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_vertex_shader");
|
675
680
|
program = (GLuint)NUM2UINT(arg1);
|
676
681
|
index = (GLuint)NUM2UINT(arg2);
|
677
682
|
fptr_glGetObjectParameterivARB(program,GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB,&max_size);
|
678
|
-
|
683
|
+
CHECK_GLERROR_FROM("glGetObjectParameterivARB");
|
679
684
|
if (max_size==0)
|
680
685
|
rb_raise(rb_eTypeError, "Can't determine maximum attribute name length");
|
681
686
|
buffer = allocate_buffer_with_string(max_size-1);
|
@@ -684,7 +689,7 @@ VALUE obj,arg1,arg2;
|
|
684
689
|
rb_ary_push(retary, INT2NUM(attrib_size));
|
685
690
|
rb_ary_push(retary, INT2NUM(attrib_type));
|
686
691
|
rb_ary_push(retary, buffer);
|
687
|
-
|
692
|
+
CHECK_GLERROR_FROM("glGetActiveAttribARB");
|
688
693
|
return retary;
|
689
694
|
}
|
690
695
|
|
@@ -695,11 +700,11 @@ VALUE obj,arg1,arg2;
|
|
695
700
|
{
|
696
701
|
GLuint program;
|
697
702
|
GLint ret;
|
698
|
-
LOAD_GL_FUNC(glGetAttribLocationARB,"GL_ARB_shader_objects")
|
703
|
+
LOAD_GL_FUNC(glGetAttribLocationARB, "GL_ARB_shader_objects");
|
699
704
|
program=(GLuint)NUM2UINT(arg1);
|
700
705
|
Check_Type(arg2,T_STRING);
|
701
706
|
ret = fptr_glGetAttribLocationARB(program,RSTRING_PTR(arg2));
|
702
|
-
|
707
|
+
CHECK_GLERROR_FROM("glGetAttribLocationARB");
|
703
708
|
return INT2NUM(ret);
|
704
709
|
}
|
705
710
|
|