ruby-opengl 0.50.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +15 -11
- data/doc/build_install.txt +10 -6
- data/doc/extensions.txt.in +348 -0
- data/doc/history.txt +4 -0
- data/doc/roadmap.txt +4 -6
- data/doc/scientific_use.txt +7 -0
- data/doc/supplies/page_template.html +2 -1
- data/doc/thanks.txt +5 -0
- data/doc/tutorial.txt +431 -121
- data/examples/NeHe/nehe_lesson02.rb +1 -1
- data/examples/NeHe/nehe_lesson03.rb +1 -1
- data/examples/NeHe/nehe_lesson04.rb +1 -1
- data/examples/NeHe/nehe_lesson05.rb +1 -1
- data/examples/NeHe/nehe_lesson36.rb +1 -1
- data/examples/OrangeBook/brick.rb +3 -15
- data/examples/OrangeBook/particle.rb +2 -20
- data/examples/RedBook/aapoly.rb +1 -1
- data/examples/RedBook/aargb.rb +2 -2
- data/examples/RedBook/accanti.rb +1 -1
- data/examples/RedBook/accpersp.rb +1 -1
- data/examples/RedBook/alpha.rb +2 -2
- data/examples/RedBook/alpha3D.rb +1 -1
- data/examples/RedBook/bezcurve.rb +1 -1
- data/examples/RedBook/bezmesh.rb +1 -1
- data/examples/RedBook/checker.rb +1 -1
- data/examples/RedBook/clip.rb +1 -1
- data/examples/RedBook/colormat.rb +1 -1
- data/examples/RedBook/cube.rb +1 -1
- data/examples/RedBook/depthcue.rb +1 -1
- data/examples/RedBook/dof.rb +1 -1
- data/examples/RedBook/double.rb +1 -1
- data/examples/RedBook/drawf.rb +1 -1
- data/examples/RedBook/feedback.rb +1 -1
- data/examples/RedBook/fog.rb +1 -1
- data/examples/RedBook/font.rb +2 -2
- data/examples/RedBook/hello.rb +1 -1
- data/examples/RedBook/image.rb +4 -4
- data/examples/RedBook/lines.rb +1 -1
- data/examples/RedBook/list.rb +1 -1
- data/examples/RedBook/material.rb +1 -1
- data/examples/RedBook/mipmap.rb +1 -1
- data/examples/RedBook/model.rb +1 -1
- data/examples/RedBook/movelight.rb +1 -1
- data/examples/RedBook/pickdepth.rb +1 -1
- data/examples/RedBook/planet.rb +5 -5
- data/examples/RedBook/quadric.rb +1 -1
- data/examples/RedBook/robot.rb +5 -5
- data/examples/RedBook/select.rb +1 -1
- data/examples/RedBook/smooth.rb +1 -1
- data/examples/RedBook/stencil.rb +1 -1
- data/examples/RedBook/stroke.rb +2 -2
- data/examples/RedBook/surface.rb +1 -1
- data/examples/RedBook/teaambient.rb +1 -1
- data/examples/RedBook/teapots.rb +1 -1
- data/examples/RedBook/tess.rb +1 -1
- data/examples/RedBook/texbind.rb +1 -1
- data/examples/RedBook/texgen.rb +5 -5
- data/examples/RedBook/texturesurf.rb +1 -1
- data/examples/RedBook/varray.rb +1 -1
- data/examples/RedBook/wrap.rb +5 -5
- data/examples/misc/OGLBench.rb +337 -0
- data/examples/misc/anisotropic.rb +1 -1
- data/examples/misc/fbo_test.rb +356 -0
- data/examples/misc/font-glut.rb +1 -1
- data/examples/misc/glfwtest.rb +30 -0
- data/examples/misc/md2model.rb +15 -0
- data/examples/misc/plane.rb +1 -1
- data/examples/misc/readpixel.rb +1 -1
- data/examples/misc/sdltest.rb +34 -0
- data/examples/misc/trislam.rb +828 -0
- data/ext/common/common.h +126 -218
- data/ext/common/conv.h +244 -0
- data/ext/common/funcdef.h +280 -0
- data/ext/common/gl-error.h +23 -0
- data/ext/common/gl-types.h +14 -0
- data/ext/gl/gl-1.0-1.1.c +497 -1255
- data/ext/gl/gl-1.2.c +121 -304
- data/ext/gl/gl-1.3.c +78 -339
- data/ext/gl/gl-1.4.c +102 -164
- data/ext/gl/gl-1.5.c +42 -173
- data/ext/gl/gl-2.0.c +273 -1039
- data/ext/gl/gl-2.1.c +15 -19
- data/ext/gl/gl-enums.c +3 -2
- data/ext/gl/gl-error.c +104 -0
- data/ext/gl/gl-ext-3dfx.c +27 -0
- data/ext/gl/gl-ext-arb.c +812 -12
- data/ext/gl/gl-ext-ati.c +41 -0
- data/ext/gl/gl-ext-ext.c +791 -119
- data/ext/gl/gl-ext-gremedy.c +41 -0
- data/ext/gl/gl-ext-nv.c +679 -0
- data/ext/gl/gl.c +48 -28
- data/ext/gl/mkrf_conf.rb +13 -10
- data/ext/glu/glu-enums.c +3 -2
- data/ext/glu/glu.c +136 -41
- data/ext/glu/mkrf_conf.rb +15 -12
- data/ext/glut/glut.c +37 -80
- data/ext/glut/mkrf_conf.rb +17 -13
- data/lib/opengl.rb +29 -53
- data/test/tc_common.rb +9 -3
- data/test/tc_ext_arb.rb +397 -3
- data/test/tc_ext_ati.rb +33 -0
- data/test/tc_ext_ext.rb +479 -2
- data/test/tc_ext_gremedy.rb +36 -0
- data/test/tc_ext_nv.rb +357 -0
- data/test/tc_func_10_11.rb +93 -67
- data/test/tc_func_12.rb +11 -11
- data/test/tc_func_13.rb +38 -18
- data/test/tc_func_14.rb +2 -2
- data/test/tc_func_15.rb +10 -10
- data/test/tc_func_20.rb +20 -20
- data/test/tc_func_21.rb +53 -22
- data/test/tc_glu.rb +9 -4
- data/test/tc_misc.rb +15 -2
- metadata +22 -8
- data/doc/extensions.txt +0 -361
- data/examples/RedBook/aaindex.rb +0 -97
- data/examples/misc/smooth.rb +0 -42
- data/examples/misc/test.rb +0 -65
data/ext/gl/gl-1.4.c
CHANGED
|
@@ -16,25 +16,28 @@
|
|
|
16
16
|
#include "../common/common.h"
|
|
17
17
|
|
|
18
18
|
/* OpenGL 1.4 functions */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
|
|
20
|
+
GL_FUNC_LOAD_4(BlendFuncSeparate,GLvoid, GLenum,GLenum,GLenum,GLenum, "1.4")
|
|
21
|
+
GL_FUNC_LOAD_1(FogCoordf,GLvoid, GLfloat, "1.4")
|
|
22
|
+
GL_FUNC_LOAD_1(FogCoordd,GLvoid, GLdouble, "1.4")
|
|
23
|
+
GL_FUNC_LOAD_2(PointParameteri,GLvoid, GLenum,GLint, "1.4")
|
|
24
|
+
GL_FUNC_LOAD_2(PointParameterf,GLvoid, GLenum,GLfloat, "1.4")
|
|
25
|
+
GL_FUNC_LOAD_3(SecondaryColor3b,GLvoid, GLbyte,GLbyte,GLbyte, "1.4")
|
|
26
|
+
GL_FUNC_LOAD_3(SecondaryColor3d,GLvoid, GLdouble,GLdouble,GLdouble, "1.4")
|
|
27
|
+
GL_FUNC_LOAD_3(SecondaryColor3f,GLvoid, GLfloat,GLfloat,GLfloat, "1.4")
|
|
28
|
+
GL_FUNC_LOAD_3(SecondaryColor3i,GLvoid, GLint,GLint,GLint, "1.4")
|
|
29
|
+
GL_FUNC_LOAD_3(SecondaryColor3s,GLvoid, GLshort,GLshort,GLshort, "1.4")
|
|
30
|
+
GL_FUNC_LOAD_3(SecondaryColor3ub,GLvoid, GLubyte,GLubyte,GLubyte, "1.4")
|
|
31
|
+
GL_FUNC_LOAD_3(SecondaryColor3ui,GLvoid, GLuint,GLuint,GLuint, "1.4")
|
|
32
|
+
GL_FUNC_LOAD_3(SecondaryColor3us,GLvoid, GLushort,GLushort,GLushort, "1.4")
|
|
33
|
+
GL_FUNC_LOAD_2(WindowPos2d,GLvoid, GLdouble,GLdouble, "1.4")
|
|
34
|
+
GL_FUNC_LOAD_2(WindowPos2f,GLvoid, GLfloat,GLfloat, "1.4")
|
|
35
|
+
GL_FUNC_LOAD_2(WindowPos2i,GLvoid, GLint,GLint, "1.4")
|
|
36
|
+
GL_FUNC_LOAD_2(WindowPos2s,GLvoid, GLshort,GLshort, "1.4")
|
|
37
|
+
GL_FUNC_LOAD_3(WindowPos3d,GLvoid, GLdouble,GLdouble,GLdouble, "1.4")
|
|
38
|
+
GL_FUNC_LOAD_3(WindowPos3f,GLvoid, GLfloat,GLfloat,GLfloat, "1.4")
|
|
39
|
+
GL_FUNC_LOAD_3(WindowPos3i,GLvoid, GLint,GLint,GLint, "1.4")
|
|
40
|
+
GL_FUNC_LOAD_3(WindowPos3s,GLvoid, GLshort,GLshort,GLshort, "1.4")
|
|
38
41
|
|
|
39
42
|
static void (APIENTRY * fptr_glFogCoordfv)(GLfloat *);
|
|
40
43
|
static VALUE
|
|
@@ -42,10 +45,11 @@ gl_FogCoordfv(obj,arg1)
|
|
|
42
45
|
VALUE obj,arg1;
|
|
43
46
|
{
|
|
44
47
|
GLfloat coord;
|
|
45
|
-
LOAD_GL_FUNC(glFogCoordfv)
|
|
48
|
+
LOAD_GL_FUNC(glFogCoordfv,"1.4")
|
|
46
49
|
Check_Type(arg1,T_ARRAY);
|
|
47
50
|
ary2cflt(arg1,&coord,1);
|
|
48
51
|
fptr_glFogCoordfv(&coord);
|
|
52
|
+
CHECK_GLERROR
|
|
49
53
|
return Qnil;
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -55,10 +59,11 @@ gl_FogCoorddv(obj,arg1)
|
|
|
55
59
|
VALUE obj,arg1;
|
|
56
60
|
{
|
|
57
61
|
GLdouble coord;
|
|
58
|
-
LOAD_GL_FUNC(glFogCoorddv)
|
|
62
|
+
LOAD_GL_FUNC(glFogCoorddv,"1.4")
|
|
59
63
|
Check_Type(arg1,T_ARRAY);
|
|
60
64
|
ary2cdbl(arg1,&coord,1);
|
|
61
65
|
fptr_glFogCoorddv(&coord);
|
|
66
|
+
CHECK_GLERROR
|
|
62
67
|
return Qnil;
|
|
63
68
|
}
|
|
64
69
|
|
|
@@ -70,18 +75,20 @@ VALUE obj,arg1,arg2,arg3;
|
|
|
70
75
|
{
|
|
71
76
|
GLenum type;
|
|
72
77
|
GLsizei stride;
|
|
73
|
-
LOAD_GL_FUNC(glFogCoordPointer)
|
|
78
|
+
LOAD_GL_FUNC(glFogCoordPointer,"1.4")
|
|
74
79
|
type = (GLenum)NUM2INT(arg1);
|
|
75
80
|
stride = (GLsizei)NUM2UINT(arg2);
|
|
76
81
|
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
|
77
82
|
g_FogCoord_ptr = arg3;
|
|
78
83
|
fptr_glFogCoordPointer(type, stride, (const GLvoid*)NUM2INT(arg3));
|
|
79
84
|
} else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
VALUE data;
|
|
86
|
+
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg3);
|
|
87
|
+
rb_str_freeze(data);
|
|
88
|
+
g_FogCoord_ptr = data;
|
|
89
|
+
fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
|
|
84
90
|
}
|
|
91
|
+
CHECK_GLERROR
|
|
85
92
|
return Qnil;
|
|
86
93
|
}
|
|
87
94
|
|
|
@@ -94,7 +101,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
|
94
101
|
GLint *ary1;
|
|
95
102
|
GLsizei *ary2;
|
|
96
103
|
int len1,len2;
|
|
97
|
-
LOAD_GL_FUNC(glMultiDrawArrays)
|
|
104
|
+
LOAD_GL_FUNC(glMultiDrawArrays,"1.4")
|
|
98
105
|
len1 = RARRAY(arg2)->len;
|
|
99
106
|
len2 = RARRAY(arg3)->len;
|
|
100
107
|
if (len1!=len2)
|
|
@@ -107,6 +114,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
|
107
114
|
fptr_glMultiDrawArrays(mode,ary1,ary2,len1);
|
|
108
115
|
xfree(ary1);
|
|
109
116
|
xfree(ary2);
|
|
117
|
+
CHECK_GLERROR
|
|
110
118
|
return Qnil;
|
|
111
119
|
}
|
|
112
120
|
|
|
@@ -125,7 +133,7 @@ VALUE obj;
|
|
|
125
133
|
RArray *ary;
|
|
126
134
|
int i;
|
|
127
135
|
VALUE args[4];
|
|
128
|
-
LOAD_GL_FUNC(glMultiDrawElements)
|
|
136
|
+
LOAD_GL_FUNC(glMultiDrawElements,"1.4")
|
|
129
137
|
switch (rb_scan_args(argc, argv, "31", &args[0], &args[1], &args[2],&args[3])) {
|
|
130
138
|
default:
|
|
131
139
|
case 3:
|
|
@@ -139,8 +147,10 @@ VALUE obj;
|
|
|
139
147
|
counts = ALLOC_N(GLsizei,size);
|
|
140
148
|
indices = ALLOC_N(GLvoid*,size);
|
|
141
149
|
for (i=0;i<size;i++) {
|
|
142
|
-
|
|
143
|
-
|
|
150
|
+
VALUE data;
|
|
151
|
+
data = pack_array_or_pass_string(type,ary->ptr[i]);
|
|
152
|
+
indices[i] = RSTRING_PTR(data);
|
|
153
|
+
counts[i] = RSTRING_LEN(data);
|
|
144
154
|
}
|
|
145
155
|
fptr_glMultiDrawElements(mode,counts,type,indices,size);
|
|
146
156
|
xfree(counts);
|
|
@@ -169,20 +179,7 @@ VALUE obj;
|
|
|
169
179
|
xfree(indices);
|
|
170
180
|
break;
|
|
171
181
|
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
static void (APIENTRY * fptr_glPointParameterf)(GLenum,GLfloat);
|
|
176
|
-
static VALUE
|
|
177
|
-
gl_PointParameterf(obj,arg1,arg2)
|
|
178
|
-
VALUE obj,arg1,arg2;
|
|
179
|
-
{
|
|
180
|
-
GLenum pname;
|
|
181
|
-
GLfloat param;
|
|
182
|
-
LOAD_GL_FUNC(glPointParameterf)
|
|
183
|
-
pname = (GLenum)NUM2INT(arg1);
|
|
184
|
-
param = (GLfloat)NUM2INT(arg2);
|
|
185
|
-
fptr_glPointParameterf(pname,param);
|
|
182
|
+
CHECK_GLERROR
|
|
186
183
|
return Qnil;
|
|
187
184
|
}
|
|
188
185
|
|
|
@@ -194,7 +191,7 @@ VALUE obj,arg1,arg2;
|
|
|
194
191
|
GLenum pname;
|
|
195
192
|
GLfloat params[3] = {0.0,0.0,0.0};
|
|
196
193
|
GLint size;
|
|
197
|
-
LOAD_GL_FUNC(glPointParameterfv)
|
|
194
|
+
LOAD_GL_FUNC(glPointParameterfv,"1.4")
|
|
198
195
|
pname = (GLenum)NUM2INT(arg1);
|
|
199
196
|
Check_Type(arg2,T_ARRAY);
|
|
200
197
|
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
|
@@ -203,20 +200,7 @@ VALUE obj,arg1,arg2;
|
|
|
203
200
|
size = 1;
|
|
204
201
|
ary2cflt(arg2,params,size);
|
|
205
202
|
fptr_glPointParameterfv(pname,params);
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
static void (APIENTRY * fptr_glPointParameteri)(GLenum,GLint);
|
|
210
|
-
static VALUE
|
|
211
|
-
gl_PointParameteri(obj,arg1,arg2)
|
|
212
|
-
VALUE obj,arg1,arg2;
|
|
213
|
-
{
|
|
214
|
-
GLenum pname;
|
|
215
|
-
GLint param;
|
|
216
|
-
LOAD_GL_FUNC(glPointParameteri)
|
|
217
|
-
pname = (GLenum)NUM2INT(arg1);
|
|
218
|
-
param = (GLint)NUM2INT(arg2);
|
|
219
|
-
fptr_glPointParameteri(pname,param);
|
|
203
|
+
CHECK_GLERROR
|
|
220
204
|
return Qnil;
|
|
221
205
|
}
|
|
222
206
|
|
|
@@ -228,7 +212,7 @@ VALUE obj,arg1,arg2;
|
|
|
228
212
|
GLenum pname;
|
|
229
213
|
GLint params[3] = {0.0,0.0,0.0};
|
|
230
214
|
GLint size;
|
|
231
|
-
LOAD_GL_FUNC(glPointParameteriv)
|
|
215
|
+
LOAD_GL_FUNC(glPointParameteriv,"1.4")
|
|
232
216
|
pname = (GLenum)NUM2INT(arg1);
|
|
233
217
|
Check_Type(arg2,T_ARRAY);
|
|
234
218
|
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
|
@@ -237,52 +221,31 @@ VALUE obj,arg1,arg2;
|
|
|
237
221
|
size = 1;
|
|
238
222
|
ary2cint(arg2,params,size);
|
|
239
223
|
fptr_glPointParameteriv(pname,params);
|
|
224
|
+
CHECK_GLERROR
|
|
240
225
|
return Qnil;
|
|
241
226
|
}
|
|
242
227
|
|
|
243
|
-
#define GLSECONDARYCOLOR_VFUNC(_type_) \
|
|
244
|
-
static
|
|
245
|
-
|
|
246
|
-
int argc; \
|
|
247
|
-
VALUE *argv; \
|
|
248
|
-
VALUE obj; \
|
|
228
|
+
#define GLSECONDARYCOLOR_VFUNC(_name_,_type_,_conv_) \
|
|
229
|
+
static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
|
|
230
|
+
VALUE gl_##_name_(VALUE obj,VALUE arg1) \
|
|
249
231
|
{ \
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
ary = RARRAY(args[0]); \
|
|
257
|
-
switch (ary->len) { \
|
|
258
|
-
case 3: \
|
|
259
|
-
gl_SecondaryColor3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
|
|
260
|
-
break; \
|
|
261
|
-
default: \
|
|
262
|
-
rb_raise(rb_eArgError, "array length:%d", num); \
|
|
263
|
-
} \
|
|
264
|
-
} \
|
|
265
|
-
else \
|
|
266
|
-
rb_raise(rb_eArgError, "array length:%d", num); \
|
|
267
|
-
break; \
|
|
268
|
-
case 3: \
|
|
269
|
-
gl_SecondaryColor3##_type_(obj,args[0], args[1], args[2]); \
|
|
270
|
-
break; \
|
|
271
|
-
default: \
|
|
272
|
-
rb_raise(rb_eArgError, "too many arguments"); \
|
|
273
|
-
break; \
|
|
274
|
-
} \
|
|
232
|
+
_type_ cary[3] = {0,0,0}; \
|
|
233
|
+
LOAD_GL_FUNC(gl##_name_,"1.4") \
|
|
234
|
+
Check_Type(arg1,T_ARRAY); \
|
|
235
|
+
_conv_(arg1,cary,3); \
|
|
236
|
+
fptr_gl##_name_(cary); \
|
|
237
|
+
CHECK_GLERROR \
|
|
275
238
|
return Qnil; \
|
|
276
239
|
}
|
|
277
240
|
|
|
278
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
279
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
280
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
281
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
282
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
283
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
284
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
285
|
-
GLSECONDARYCOLOR_VFUNC(
|
|
241
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3bv,GLbyte,ary2cbyte)
|
|
242
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3dv,GLdouble,ary2cdbl)
|
|
243
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3fv,GLfloat,ary2cflt)
|
|
244
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3iv,GLint,ary2cint)
|
|
245
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3sv,GLshort,ary2cshort)
|
|
246
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3uiv,GLuint,ary2cuint)
|
|
247
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3ubv,GLubyte,ary2cubyte)
|
|
248
|
+
GLSECONDARYCOLOR_VFUNC(SecondaryColor3usv,GLushort,ary2cushort)
|
|
286
249
|
#undef GLSECONDARYCOLOR_VFUNC
|
|
287
250
|
|
|
288
251
|
extern VALUE g_SecondaryColor_ptr;
|
|
@@ -294,7 +257,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
|
294
257
|
GLint size;
|
|
295
258
|
GLenum type;
|
|
296
259
|
GLsizei stride;
|
|
297
|
-
LOAD_GL_FUNC(glSecondaryColorPointer)
|
|
260
|
+
LOAD_GL_FUNC(glSecondaryColorPointer,"1.4")
|
|
298
261
|
size = (GLint)NUM2INT(arg1);
|
|
299
262
|
type = (GLenum)NUM2INT(arg2);
|
|
300
263
|
stride = (GLsizei)NUM2UINT(arg3);
|
|
@@ -302,59 +265,37 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
|
302
265
|
g_SecondaryColor_ptr = arg4;
|
|
303
266
|
fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)NUM2INT(arg4));
|
|
304
267
|
} else {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
268
|
+
VALUE data;
|
|
269
|
+
data = pack_array_or_pass_string(type,arg4);
|
|
270
|
+
rb_str_freeze(data);
|
|
271
|
+
g_SecondaryColor_ptr = data;
|
|
272
|
+
fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING_PTR(data));
|
|
309
273
|
}
|
|
274
|
+
CHECK_GLERROR
|
|
310
275
|
return Qnil;
|
|
311
276
|
}
|
|
312
277
|
|
|
313
|
-
#define GLWINDOWPOS_VFUNC(_type_) \
|
|
314
|
-
static
|
|
315
|
-
|
|
316
|
-
int argc; \
|
|
317
|
-
VALUE *argv; \
|
|
318
|
-
VALUE obj; \
|
|
278
|
+
#define GLWINDOWPOS_VFUNC(_name_,_type_,_size_,_conv_) \
|
|
279
|
+
static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
|
|
280
|
+
VALUE gl_##_name_(VALUE obj,VALUE arg1) \
|
|
319
281
|
{ \
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
ary = RARRAY(args[0]); \
|
|
327
|
-
switch (ary->len) { \
|
|
328
|
-
case 2: \
|
|
329
|
-
gl_WindowPos2##_type_(obj,ary->ptr[0],ary->ptr[1]); \
|
|
330
|
-
break; \
|
|
331
|
-
case 3: \
|
|
332
|
-
gl_WindowPos3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
|
|
333
|
-
break; \
|
|
334
|
-
default: \
|
|
335
|
-
rb_raise(rb_eArgError, "array length:%d", num); \
|
|
336
|
-
} \
|
|
337
|
-
} \
|
|
338
|
-
else \
|
|
339
|
-
rb_raise(rb_eArgError, "array length:%d", num); \
|
|
340
|
-
break; \
|
|
341
|
-
case 2: \
|
|
342
|
-
gl_WindowPos2##_type_(obj,args[0], args[1]); \
|
|
343
|
-
break; \
|
|
344
|
-
case 3: \
|
|
345
|
-
gl_WindowPos3##_type_(obj,args[0], args[1], args[2]); \
|
|
346
|
-
break; \
|
|
347
|
-
default: \
|
|
348
|
-
rb_raise(rb_eArgError, "too many arguments"); \
|
|
349
|
-
break; \
|
|
350
|
-
} \
|
|
282
|
+
_type_ cary[3] = {0,0,0}; \
|
|
283
|
+
LOAD_GL_FUNC(gl##_name_,"1.4") \
|
|
284
|
+
Check_Type(arg1,T_ARRAY); \
|
|
285
|
+
_conv_(arg1,cary,_size_); \
|
|
286
|
+
fptr_gl##_name_(cary); \
|
|
287
|
+
CHECK_GLERROR \
|
|
351
288
|
return Qnil; \
|
|
352
289
|
}
|
|
353
290
|
|
|
354
|
-
GLWINDOWPOS_VFUNC(
|
|
355
|
-
GLWINDOWPOS_VFUNC(
|
|
356
|
-
GLWINDOWPOS_VFUNC(
|
|
357
|
-
GLWINDOWPOS_VFUNC(
|
|
291
|
+
GLWINDOWPOS_VFUNC(WindowPos2dv,GLdouble,2,ary2cdbl)
|
|
292
|
+
GLWINDOWPOS_VFUNC(WindowPos2fv,GLfloat,2,ary2cflt)
|
|
293
|
+
GLWINDOWPOS_VFUNC(WindowPos2iv,GLint,2,ary2cint)
|
|
294
|
+
GLWINDOWPOS_VFUNC(WindowPos2sv,GLshort,2,ary2cshort)
|
|
295
|
+
GLWINDOWPOS_VFUNC(WindowPos3dv,GLdouble,3,ary2cdbl)
|
|
296
|
+
GLWINDOWPOS_VFUNC(WindowPos3fv,GLfloat,3,ary2cflt)
|
|
297
|
+
GLWINDOWPOS_VFUNC(WindowPos3iv,GLint,3,ary2cint)
|
|
298
|
+
GLWINDOWPOS_VFUNC(WindowPos3sv,GLshort,3,ary2cshort)
|
|
358
299
|
#undef GLWINDOWPOS_VFUNC
|
|
359
300
|
|
|
360
301
|
|
|
@@ -380,6 +321,14 @@ void gl_init_functions_1_4(VALUE module)
|
|
|
380
321
|
rb_define_module_function(module, "glSecondaryColor3ub", gl_SecondaryColor3ub, 3);
|
|
381
322
|
rb_define_module_function(module, "glSecondaryColor3ui", gl_SecondaryColor3ui, 3);
|
|
382
323
|
rb_define_module_function(module, "glSecondaryColor3us", gl_SecondaryColor3us, 3);
|
|
324
|
+
rb_define_module_function(module, "glSecondaryColor3bv", gl_SecondaryColor3bv, 1);
|
|
325
|
+
rb_define_module_function(module, "glSecondaryColor3dv", gl_SecondaryColor3dv, 1);
|
|
326
|
+
rb_define_module_function(module, "glSecondaryColor3fv", gl_SecondaryColor3fv, 1);
|
|
327
|
+
rb_define_module_function(module, "glSecondaryColor3iv", gl_SecondaryColor3iv, 1);
|
|
328
|
+
rb_define_module_function(module, "glSecondaryColor3sv", gl_SecondaryColor3sv, 1);
|
|
329
|
+
rb_define_module_function(module, "glSecondaryColor3ubv", gl_SecondaryColor3ubv, 1);
|
|
330
|
+
rb_define_module_function(module, "glSecondaryColor3uiv", gl_SecondaryColor3uiv, 1);
|
|
331
|
+
rb_define_module_function(module, "glSecondaryColor3usv", gl_SecondaryColor3usv, 1);
|
|
383
332
|
rb_define_module_function(module, "glSecondaryColorPointer", gl_SecondaryColorPointer, 4);
|
|
384
333
|
rb_define_module_function(module, "glWindowPos2d", gl_WindowPos2d, 2);
|
|
385
334
|
rb_define_module_function(module, "glWindowPos2f", gl_WindowPos2f, 2);
|
|
@@ -389,23 +338,12 @@ void gl_init_functions_1_4(VALUE module)
|
|
|
389
338
|
rb_define_module_function(module, "glWindowPos3f", gl_WindowPos3f, 3);
|
|
390
339
|
rb_define_module_function(module, "glWindowPos3i", gl_WindowPos3i, 3);
|
|
391
340
|
rb_define_module_function(module, "glWindowPos3s", gl_WindowPos3s, 3);
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
rb_define_module_function(module, "
|
|
395
|
-
rb_define_module_function(module, "
|
|
396
|
-
rb_define_module_function(module, "
|
|
397
|
-
rb_define_module_function(module, "
|
|
398
|
-
rb_define_module_function(module, "
|
|
399
|
-
rb_define_module_function(module, "
|
|
400
|
-
rb_define_module_function(module, "glSecondaryColor3uiv", gl_SecondaryColoruiv, -1);
|
|
401
|
-
rb_define_module_function(module, "glSecondaryColor3usv", gl_SecondaryColorusv, -1);
|
|
402
|
-
|
|
403
|
-
rb_define_module_function(module, "glWindowPos2dv", gl_WindowPosdv, -1);
|
|
404
|
-
rb_define_module_function(module, "glWindowPos2fv", gl_WindowPosfv, -1);
|
|
405
|
-
rb_define_module_function(module, "glWindowPos2iv", gl_WindowPosiv, -1);
|
|
406
|
-
rb_define_module_function(module, "glWindowPos2sv", gl_WindowPossv, -1);
|
|
407
|
-
rb_define_module_function(module, "glWindowPos3dv", gl_WindowPosdv, -1);
|
|
408
|
-
rb_define_module_function(module, "glWindowPos3fv", gl_WindowPosfv, -1);
|
|
409
|
-
rb_define_module_function(module, "glWindowPos3iv", gl_WindowPosiv, -1);
|
|
410
|
-
rb_define_module_function(module, "glWindowPos3sv", gl_WindowPossv, -1);
|
|
341
|
+
rb_define_module_function(module, "glWindowPos2dv", gl_WindowPos2dv, 1);
|
|
342
|
+
rb_define_module_function(module, "glWindowPos2fv", gl_WindowPos2fv, 1);
|
|
343
|
+
rb_define_module_function(module, "glWindowPos2iv", gl_WindowPos2iv, 1);
|
|
344
|
+
rb_define_module_function(module, "glWindowPos2sv", gl_WindowPos2sv, 1);
|
|
345
|
+
rb_define_module_function(module, "glWindowPos3dv", gl_WindowPos3dv, 1);
|
|
346
|
+
rb_define_module_function(module, "glWindowPos3fv", gl_WindowPos3fv, 1);
|
|
347
|
+
rb_define_module_function(module, "glWindowPos3iv", gl_WindowPos3iv, 1);
|
|
348
|
+
rb_define_module_function(module, "glWindowPos3sv", gl_WindowPos3sv, 1);
|
|
411
349
|
}
|
data/ext/gl/gl-1.5.c
CHANGED
|
@@ -17,76 +17,15 @@
|
|
|
17
17
|
|
|
18
18
|
/* OpenGL 1.5 functions */
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
RArray *ret;
|
|
30
|
-
int i;
|
|
31
|
-
LOAD_GL_FUNC(glGenQueries)
|
|
32
|
-
n = (GLsizei)NUM2UINT(arg1);
|
|
33
|
-
queries = ALLOC_N(GLuint, n);
|
|
34
|
-
fptr_glGenQueries(n, queries);
|
|
35
|
-
ret = RARRAY(rb_ary_new2(n));
|
|
36
|
-
for (i = 0; i < n; i++)
|
|
37
|
-
rb_ary_push((VALUE)ret, INT2NUM(queries[i]));
|
|
38
|
-
xfree(queries);
|
|
39
|
-
return (VALUE)ret;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static void (APIENTRY * fptr_glDeleteQueries)(GLsizei,GLuint *);
|
|
43
|
-
static VALUE
|
|
44
|
-
gl_DeleteQueries(obj,arg1)
|
|
45
|
-
VALUE obj,arg1;
|
|
46
|
-
{
|
|
47
|
-
GLsizei n;
|
|
48
|
-
GLuint *queries;
|
|
49
|
-
LOAD_GL_FUNC(glDeleteQueries)
|
|
50
|
-
if (TYPE(arg1)==T_ARRAY) {
|
|
51
|
-
n = RARRAY(arg1)->len;
|
|
52
|
-
queries = ALLOC_N(GLuint,n);
|
|
53
|
-
ary2cuint(arg1,queries,n);
|
|
54
|
-
fptr_glDeleteQueries( n, queries);
|
|
55
|
-
xfree(queries);
|
|
56
|
-
} else {
|
|
57
|
-
GLuint query;
|
|
58
|
-
query = NUM2INT(arg1);
|
|
59
|
-
fptr_glDeleteQueries( 1, &query);
|
|
60
|
-
}
|
|
61
|
-
return Qnil;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static GLboolean (APIENTRY * fptr_glIsQuery)(GLuint);
|
|
65
|
-
static VALUE
|
|
66
|
-
gl_IsQuery(obj,arg1)
|
|
67
|
-
VALUE obj,arg1;
|
|
68
|
-
{
|
|
69
|
-
GLuint query;
|
|
70
|
-
GLboolean ret;
|
|
71
|
-
LOAD_GL_FUNC(glIsQuery)
|
|
72
|
-
query = (GLuint)NUM2UINT(arg1);
|
|
73
|
-
ret = fptr_glIsQuery(query);
|
|
74
|
-
return INT2NUM(ret);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static void (APIENTRY * fptr_glBeginQuery)(GLenum,GLuint);
|
|
78
|
-
static VALUE
|
|
79
|
-
gl_BeginQuery(obj,arg1,arg2)
|
|
80
|
-
VALUE obj,arg1,arg2;
|
|
81
|
-
{
|
|
82
|
-
GLenum target;
|
|
83
|
-
GLuint id;
|
|
84
|
-
LOAD_GL_FUNC(glBeginQuery)
|
|
85
|
-
target = (GLenum)NUM2INT(arg1);
|
|
86
|
-
id = (GLuint)NUM2UINT(arg2);
|
|
87
|
-
fptr_glBeginQuery(target,id);
|
|
88
|
-
return Qnil;
|
|
89
|
-
}
|
|
20
|
+
GL_FUNC_LOAD_1(EndQuery,GLvoid, GLenum, "1.5")
|
|
21
|
+
GL_FUNC_LOAD_1(IsQuery,GLboolean, GLuint, "1.5")
|
|
22
|
+
GL_FUNC_LOAD_2(BeginQuery,GLvoid, GLenum,GLuint, "1.5")
|
|
23
|
+
GL_FUNC_LOAD_2(BindBuffer,GLvoid, GLenum,GLuint, "1.5")
|
|
24
|
+
GL_FUNC_LOAD_1(IsBuffer,GLboolean, GLuint, "1.5")
|
|
25
|
+
GL_FUNC_GENOBJECTS_LOAD(GenQueries,"1.5")
|
|
26
|
+
GL_FUNC_DELETEOBJECTS_LOAD(DeleteQueries,"1.5")
|
|
27
|
+
GL_FUNC_GENOBJECTS_LOAD(GenBuffers,"1.5")
|
|
28
|
+
GL_FUNC_DELETEOBJECTS_LOAD(DeleteBuffers,"1.5")
|
|
90
29
|
|
|
91
30
|
static void (APIENTRY * fptr_glGetQueryiv)(GLenum,GLenum,GLint *);
|
|
92
31
|
static VALUE
|
|
@@ -96,14 +35,12 @@ VALUE obj,arg1,arg2;
|
|
|
96
35
|
GLenum target;
|
|
97
36
|
GLenum pname;
|
|
98
37
|
GLint params = 0;
|
|
99
|
-
|
|
100
|
-
LOAD_GL_FUNC(glGetQueryiv)
|
|
38
|
+
LOAD_GL_FUNC(glGetQueryiv,"1.5")
|
|
101
39
|
target = (GLenum)NUM2INT(arg1);
|
|
102
40
|
pname = (GLenum)NUM2INT(arg2);
|
|
103
41
|
fptr_glGetQueryiv(target,pname,¶ms);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return retary;
|
|
42
|
+
CHECK_GLERROR
|
|
43
|
+
return RETCONV_GLint(params);
|
|
107
44
|
}
|
|
108
45
|
|
|
109
46
|
static void (APIENTRY * fptr_glGetQueryObjectiv)(GLuint,GLenum,GLint *);
|
|
@@ -114,101 +51,28 @@ VALUE obj,arg1,arg2;
|
|
|
114
51
|
GLuint id;
|
|
115
52
|
GLenum pname;
|
|
116
53
|
GLint params = 0;
|
|
117
|
-
|
|
118
|
-
LOAD_GL_FUNC(glGetQueryObjectiv)
|
|
54
|
+
LOAD_GL_FUNC(glGetQueryObjectiv,"1.5")
|
|
119
55
|
id = (GLuint)NUM2UINT(arg1);
|
|
120
56
|
pname = (GLenum)NUM2INT(arg2);
|
|
121
57
|
fptr_glGetQueryObjectiv(id,pname,¶ms);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return retary;
|
|
58
|
+
CHECK_GLERROR
|
|
59
|
+
return cond_GLBOOL2RUBY(pname,params);
|
|
125
60
|
}
|
|
126
61
|
|
|
127
62
|
static void (APIENTRY * fptr_glGetQueryObjectuiv)(GLuint,GLenum,GLuint *);
|
|
128
63
|
static VALUE
|
|
129
|
-
gl_GetQueryObjectuiv(obj,arg1,arg2
|
|
130
|
-
VALUE obj,arg1,arg2
|
|
64
|
+
gl_GetQueryObjectuiv(obj,arg1,arg2)
|
|
65
|
+
VALUE obj,arg1,arg2;
|
|
131
66
|
{
|
|
132
67
|
GLuint id;
|
|
133
68
|
GLenum pname;
|
|
134
69
|
GLuint params = 0;
|
|
135
|
-
|
|
136
|
-
LOAD_GL_FUNC(glGetQueryObjectuiv)
|
|
70
|
+
LOAD_GL_FUNC(glGetQueryObjectuiv,"1.5")
|
|
137
71
|
id = (GLuint)NUM2UINT(arg1);
|
|
138
72
|
pname = (GLenum)NUM2INT(arg2);
|
|
139
73
|
fptr_glGetQueryObjectuiv(id,pname,¶ms);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return retary;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
static void (APIENTRY * fptr_glBindBuffer)(GLenum,GLuint);
|
|
146
|
-
static VALUE
|
|
147
|
-
gl_BindBuffer(obj,arg1,arg2)
|
|
148
|
-
VALUE obj,arg1,arg2;
|
|
149
|
-
{
|
|
150
|
-
GLenum target;
|
|
151
|
-
GLuint buffer;
|
|
152
|
-
LOAD_GL_FUNC(glBindBuffer)
|
|
153
|
-
target = (GLenum)NUM2INT(arg1);
|
|
154
|
-
buffer = (GLenum)NUM2INT(arg2);
|
|
155
|
-
fptr_glBindBuffer(target,buffer);
|
|
156
|
-
return Qnil;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
static void (APIENTRY * fptr_glDeleteBuffers)(GLsizei,GLuint *);
|
|
160
|
-
static VALUE
|
|
161
|
-
gl_DeleteBuffers(obj,arg1)
|
|
162
|
-
VALUE obj,arg1;
|
|
163
|
-
{
|
|
164
|
-
GLsizei n;
|
|
165
|
-
GLuint *buffers;
|
|
166
|
-
LOAD_GL_FUNC(glDeleteBuffers)
|
|
167
|
-
if (TYPE(arg1)==T_ARRAY) {
|
|
168
|
-
n = RARRAY(arg1)->len;
|
|
169
|
-
buffers = ALLOC_N(GLuint,n);
|
|
170
|
-
ary2cuint(arg1,buffers,n);
|
|
171
|
-
fptr_glDeleteBuffers(n, buffers);
|
|
172
|
-
xfree(buffers);
|
|
173
|
-
} else {
|
|
174
|
-
GLuint buffer;
|
|
175
|
-
buffer = NUM2INT(arg1);
|
|
176
|
-
fptr_glDeleteBuffers(1, &buffer);
|
|
177
|
-
}
|
|
178
|
-
return Qnil;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
static void (APIENTRY * fptr_glGenBuffers)(GLsizei,GLuint *);
|
|
182
|
-
static VALUE
|
|
183
|
-
gl_GenBuffers(obj,arg1)
|
|
184
|
-
VALUE obj,arg1;
|
|
185
|
-
{
|
|
186
|
-
GLsizei n;
|
|
187
|
-
GLuint *buffers;
|
|
188
|
-
RArray *ret;
|
|
189
|
-
int i;
|
|
190
|
-
LOAD_GL_FUNC(glGenBuffers)
|
|
191
|
-
n = (GLsizei)NUM2UINT(arg1);
|
|
192
|
-
buffers = ALLOC_N(GLuint, n);
|
|
193
|
-
fptr_glGenBuffers(n, buffers);
|
|
194
|
-
ret = RARRAY(rb_ary_new2(n));
|
|
195
|
-
for (i = 0; i < n; i++)
|
|
196
|
-
rb_ary_push((VALUE)ret, INT2NUM(buffers[i]));
|
|
197
|
-
xfree(buffers);
|
|
198
|
-
return (VALUE)ret;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
static GLboolean (APIENTRY * fptr_glIsBuffer)(GLuint);
|
|
202
|
-
static VALUE
|
|
203
|
-
gl_IsBuffer(obj,arg1)
|
|
204
|
-
VALUE obj,arg1;
|
|
205
|
-
{
|
|
206
|
-
GLuint buffer;
|
|
207
|
-
GLboolean ret;
|
|
208
|
-
LOAD_GL_FUNC(glIsBuffer)
|
|
209
|
-
buffer = (GLuint)NUM2UINT(arg1);
|
|
210
|
-
ret = fptr_glIsBuffer(buffer);
|
|
211
|
-
return INT2NUM(ret);
|
|
74
|
+
CHECK_GLERROR
|
|
75
|
+
return cond_GLBOOL2RUBY_U(pname,params);
|
|
212
76
|
}
|
|
213
77
|
|
|
214
78
|
static void (APIENTRY * fptr_glBufferData)(GLenum,GLsizeiptr,GLvoid *,GLenum);
|
|
@@ -219,17 +83,18 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
|
219
83
|
GLenum target;
|
|
220
84
|
GLsizeiptr size;
|
|
221
85
|
GLenum usage;
|
|
222
|
-
LOAD_GL_FUNC(glBufferData)
|
|
86
|
+
LOAD_GL_FUNC(glBufferData,"1.5")
|
|
223
87
|
target = (GLenum)NUM2INT(arg1);
|
|
224
88
|
size = (GLsizeiptr)NUM2INT(arg2);
|
|
225
89
|
usage = (GLenum)NUM2INT(arg4);
|
|
226
90
|
if (TYPE(arg3) == T_STRING) {
|
|
227
|
-
fptr_glBufferData(target,size,(GLvoid *)
|
|
91
|
+
fptr_glBufferData(target,size,(GLvoid *)RSTRING_PTR(arg3),usage);
|
|
228
92
|
} else if (NIL_P(arg3)) {
|
|
229
93
|
fptr_glBufferData(target,size,NULL,usage);
|
|
230
94
|
} else {
|
|
231
95
|
Check_Type(arg3,T_STRING); /* force exception */
|
|
232
96
|
}
|
|
97
|
+
CHECK_GLERROR
|
|
233
98
|
return Qnil;
|
|
234
99
|
}
|
|
235
100
|
|
|
@@ -241,12 +106,13 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
|
241
106
|
GLenum target;
|
|
242
107
|
GLintptr offset;
|
|
243
108
|
GLsizeiptr size;
|
|
244
|
-
LOAD_GL_FUNC(glBufferSubData)
|
|
109
|
+
LOAD_GL_FUNC(glBufferSubData,"1.5")
|
|
245
110
|
target = (GLenum)NUM2INT(arg1);
|
|
246
111
|
offset = (GLintptr)NUM2INT(arg2);
|
|
247
112
|
size = (GLsizeiptr)NUM2INT(arg3);
|
|
248
113
|
Check_Type(arg4,T_STRING);
|
|
249
|
-
fptr_glBufferSubData(target,offset,size,(GLvoid *)
|
|
114
|
+
fptr_glBufferSubData(target,offset,size,(GLvoid *)RSTRING_PTR(arg4));
|
|
115
|
+
CHECK_GLERROR
|
|
250
116
|
return Qnil;
|
|
251
117
|
}
|
|
252
118
|
|
|
@@ -259,12 +125,13 @@ VALUE obj,arg1,arg2,arg3;
|
|
|
259
125
|
GLintptr offset;
|
|
260
126
|
GLsizeiptr size;
|
|
261
127
|
VALUE data;
|
|
262
|
-
LOAD_GL_FUNC(glGetBufferSubData)
|
|
128
|
+
LOAD_GL_FUNC(glGetBufferSubData,"1.5")
|
|
263
129
|
target = (GLenum)NUM2INT(arg1);
|
|
264
130
|
offset = (GLintptr)NUM2INT(arg2);
|
|
265
131
|
size = (GLsizeiptr)NUM2INT(arg3);
|
|
266
132
|
data = allocate_buffer_with_string(size);
|
|
267
|
-
fptr_glGetBufferSubData(target,offset,size,(GLvoid *)
|
|
133
|
+
fptr_glGetBufferSubData(target,offset,size,(GLvoid *)RSTRING_PTR(data));
|
|
134
|
+
CHECK_GLERROR
|
|
268
135
|
return data;
|
|
269
136
|
}
|
|
270
137
|
|
|
@@ -276,14 +143,12 @@ VALUE obj,arg1,arg2;
|
|
|
276
143
|
GLenum target;
|
|
277
144
|
GLenum value;
|
|
278
145
|
GLint data = 0;
|
|
279
|
-
|
|
280
|
-
LOAD_GL_FUNC(glGetBufferParameteriv)
|
|
146
|
+
LOAD_GL_FUNC(glGetBufferParameteriv,"1.5")
|
|
281
147
|
target = (GLenum)NUM2INT(arg1);
|
|
282
148
|
value = (GLenum)NUM2INT(arg2);
|
|
283
149
|
fptr_glGetBufferParameteriv(target,value,&data);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return retary;
|
|
150
|
+
CHECK_GLERROR
|
|
151
|
+
return cond_GLBOOL2RUBY(value,data);
|
|
287
152
|
}
|
|
288
153
|
|
|
289
154
|
static GLvoid * (APIENTRY * fptr_glMapBuffer)(GLenum,GLenum);
|
|
@@ -296,16 +161,18 @@ VALUE obj,arg1,arg2;
|
|
|
296
161
|
GLint size = 0;
|
|
297
162
|
VALUE data;
|
|
298
163
|
GLvoid *buffer_ptr = NULL;
|
|
299
|
-
LOAD_GL_FUNC(glMapBuffer)
|
|
300
|
-
LOAD_GL_FUNC(glGetBufferParameteriv)
|
|
164
|
+
LOAD_GL_FUNC(glMapBuffer,"1.5")
|
|
165
|
+
LOAD_GL_FUNC(glGetBufferParameteriv,"1.5")
|
|
301
166
|
target = (GLenum)NUM2INT(arg1);
|
|
302
167
|
access = (GLenum)NUM2INT(arg2);
|
|
303
168
|
fptr_glGetBufferParameteriv(target,GL_BUFFER_SIZE,&size);
|
|
169
|
+
CHECK_GLERROR
|
|
304
170
|
buffer_ptr = fptr_glMapBuffer(target,access);
|
|
171
|
+
CHECK_GLERROR
|
|
305
172
|
if (buffer_ptr==NULL || size<=0)
|
|
306
173
|
return Qnil;
|
|
307
174
|
data = allocate_buffer_with_string(size);
|
|
308
|
-
memcpy(
|
|
175
|
+
memcpy(RSTRING_PTR(data), buffer_ptr, size);
|
|
309
176
|
return data;
|
|
310
177
|
}
|
|
311
178
|
|
|
@@ -316,10 +183,11 @@ VALUE obj,arg1;
|
|
|
316
183
|
{
|
|
317
184
|
GLenum target;
|
|
318
185
|
GLboolean ret;
|
|
319
|
-
LOAD_GL_FUNC(glUnmapBuffer)
|
|
186
|
+
LOAD_GL_FUNC(glUnmapBuffer,"1.5")
|
|
320
187
|
target = (GLenum)NUM2INT(arg1);
|
|
321
188
|
ret = fptr_glUnmapBuffer(target);
|
|
322
|
-
|
|
189
|
+
CHECK_GLERROR
|
|
190
|
+
return GLBOOL2RUBY(ret);
|
|
323
191
|
}
|
|
324
192
|
|
|
325
193
|
static void (APIENTRY * fptr_glGetBufferPointerv)(GLenum,GLenum,GLvoid **);
|
|
@@ -327,8 +195,9 @@ static VALUE
|
|
|
327
195
|
gl_GetBufferPointerv(obj,arg1,arg2,arg3)
|
|
328
196
|
VALUE obj,arg1,arg2,arg3;
|
|
329
197
|
{
|
|
330
|
-
LOAD_GL_FUNC(glGetBufferPointerv)
|
|
198
|
+
LOAD_GL_FUNC(glGetBufferPointerv,"1.5")
|
|
331
199
|
rb_raise(rb_eArgError, "glGetBufferPointerv not implemented");
|
|
200
|
+
CHECK_GLERROR
|
|
332
201
|
return Qnil;
|
|
333
202
|
}
|
|
334
203
|
|