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
data/ext/{gl → opengl}/gl-1.3.c
RENAMED
@@ -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 1.3 functions */
|
19
19
|
|
@@ -101,10 +101,10 @@ gl_##_name_(obj,arg1) \
|
|
101
101
|
VALUE obj,arg1; \
|
102
102
|
{ \
|
103
103
|
_type_ m[4*4]; \
|
104
|
-
LOAD_GL_FUNC(gl##_name_,"1.3") \
|
104
|
+
LOAD_GL_FUNC(gl##_name_, "1.3"); \
|
105
105
|
ary2cmat##_type_(arg1, m, 4, 4); \
|
106
106
|
fptr_gl##_name_(m); \
|
107
|
-
|
107
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
108
108
|
return Qnil; \
|
109
109
|
}
|
110
110
|
|
@@ -129,7 +129,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
129
129
|
GLint border;
|
130
130
|
GLsizei imagesize;
|
131
131
|
GLvoid *pixels;
|
132
|
-
LOAD_GL_FUNC(glCompressedTexImage3D,"1.3")
|
132
|
+
LOAD_GL_FUNC(glCompressedTexImage3D, "1.3");
|
133
133
|
target = (GLenum)NUM2INT(arg1);
|
134
134
|
level = (GLint)NUM2INT(arg2);
|
135
135
|
internalformat = (GLenum)NUM2INT(arg3);
|
@@ -155,7 +155,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
155
155
|
}
|
156
156
|
fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels);
|
157
157
|
}
|
158
|
-
|
158
|
+
CHECK_GLERROR_FROM("glCompressedTexImage3D");
|
159
159
|
return Qnil;
|
160
160
|
}
|
161
161
|
|
@@ -172,7 +172,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
|
172
172
|
GLint border;
|
173
173
|
GLsizei imagesize;
|
174
174
|
GLvoid *pixels;
|
175
|
-
LOAD_GL_FUNC(glCompressedTexImage2D,"1.3")
|
175
|
+
LOAD_GL_FUNC(glCompressedTexImage2D, "1.3");
|
176
176
|
target = (GLenum)NUM2INT(arg1);
|
177
177
|
level = (GLint)NUM2INT(arg2);
|
178
178
|
internalformat = (GLenum)NUM2INT(arg3);
|
@@ -197,7 +197,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
|
197
197
|
}
|
198
198
|
fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels);
|
199
199
|
}
|
200
|
-
|
200
|
+
CHECK_GLERROR_FROM("glCompressedTexImage2D");
|
201
201
|
return Qnil;
|
202
202
|
}
|
203
203
|
|
@@ -213,7 +213,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
213
213
|
GLint border;
|
214
214
|
GLsizei imagesize;
|
215
215
|
GLvoid *pixels;
|
216
|
-
LOAD_GL_FUNC(glCompressedTexImage1D,"1.3")
|
216
|
+
LOAD_GL_FUNC(glCompressedTexImage1D, "1.3");
|
217
217
|
target = (GLenum)NUM2INT(arg1);
|
218
218
|
level = (GLint)NUM2INT(arg2);
|
219
219
|
internalformat = (GLenum)NUM2INT(arg3);
|
@@ -237,7 +237,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
237
237
|
}
|
238
238
|
fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels);
|
239
239
|
}
|
240
|
-
|
240
|
+
CHECK_GLERROR_FROM("glCompressedTexImage1D");
|
241
241
|
return Qnil;
|
242
242
|
}
|
243
243
|
|
@@ -257,7 +257,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
|
257
257
|
GLenum format;
|
258
258
|
GLsizei imagesize;
|
259
259
|
GLvoid *pixels;
|
260
|
-
LOAD_GL_FUNC(glCompressedTexSubImage3D,"1.3")
|
260
|
+
LOAD_GL_FUNC(glCompressedTexSubImage3D, "1.3");
|
261
261
|
target = (GLenum)NUM2INT(arg1);
|
262
262
|
level = (GLint)NUM2INT(arg2);
|
263
263
|
xoffset = (GLint)NUM2INT(arg3);
|
@@ -279,7 +279,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
|
279
279
|
|
280
280
|
fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels);
|
281
281
|
}
|
282
|
-
|
282
|
+
CHECK_GLERROR_FROM("glCompressedTexSubImage3D");
|
283
283
|
return Qnil;
|
284
284
|
}
|
285
285
|
|
@@ -297,7 +297,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
297
297
|
GLenum format;
|
298
298
|
GLsizei imagesize;
|
299
299
|
GLvoid *pixels;
|
300
|
-
LOAD_GL_FUNC(glCompressedTexSubImage2D,"1.3")
|
300
|
+
LOAD_GL_FUNC(glCompressedTexSubImage2D, "1.3");
|
301
301
|
target = (GLenum)NUM2INT(arg1);
|
302
302
|
level = (GLint)NUM2INT(arg2);
|
303
303
|
xoffset = (GLint)NUM2INT(arg3);
|
@@ -316,7 +316,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
316
316
|
pixels = RSTRING_PTR(data);
|
317
317
|
fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels);
|
318
318
|
}
|
319
|
-
|
319
|
+
CHECK_GLERROR_FROM("glCompressedTexSubImage2D");
|
320
320
|
return Qnil;
|
321
321
|
}
|
322
322
|
|
@@ -332,7 +332,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
332
332
|
GLenum format;
|
333
333
|
GLsizei imagesize;
|
334
334
|
GLvoid *pixels;
|
335
|
-
LOAD_GL_FUNC(glCompressedTexSubImage1D,"1.3")
|
335
|
+
LOAD_GL_FUNC(glCompressedTexSubImage1D, "1.3");
|
336
336
|
target = (GLenum)NUM2INT(arg1);
|
337
337
|
level = (GLint)NUM2INT(arg2);
|
338
338
|
xoffset = (GLint)NUM2INT(arg3);
|
@@ -349,7 +349,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
349
349
|
pixels = RSTRING_PTR(data);
|
350
350
|
fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels);
|
351
351
|
}
|
352
|
-
|
352
|
+
CHECK_GLERROR_FROM("glCompressedTexSubImage1D");
|
353
353
|
return Qnil;
|
354
354
|
}
|
355
355
|
|
@@ -366,7 +366,7 @@ VALUE obj;
|
|
366
366
|
VALUE data;
|
367
367
|
VALUE args[3];
|
368
368
|
int numargs;
|
369
|
-
LOAD_GL_FUNC(glGetCompressedTexImage,"1.3")
|
369
|
+
LOAD_GL_FUNC(glGetCompressedTexImage, "1.3");
|
370
370
|
numargs = rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2]);
|
371
371
|
target = (GLenum)NUM2INT(args[0]);
|
372
372
|
lod = (GLenum)NUM2INT(args[1]);
|
@@ -376,14 +376,14 @@ VALUE obj;
|
|
376
376
|
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
377
377
|
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
378
378
|
glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */
|
379
|
-
|
379
|
+
CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
|
380
380
|
data = allocate_buffer_with_string(size);
|
381
381
|
fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING_PTR(data));
|
382
|
-
|
382
|
+
CHECK_GLERROR_FROM("glGetCompressedTexImage");
|
383
383
|
return data;
|
384
384
|
case 3:
|
385
385
|
fptr_glGetCompressedTexImage(target,lod,(GLvoid*)NUM2LONG(args[2]));
|
386
|
-
|
386
|
+
CHECK_GLERROR_FROM("glGetCompressedTexImage");
|
387
387
|
return Qnil;
|
388
388
|
}
|
389
389
|
}
|
data/ext/{gl → opengl}/gl-1.4.c
RENAMED
@@ -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 1.4 functions */
|
19
19
|
|
@@ -45,11 +45,11 @@ gl_FogCoordfv(obj,arg1)
|
|
45
45
|
VALUE obj,arg1;
|
46
46
|
{
|
47
47
|
GLfloat coord;
|
48
|
-
LOAD_GL_FUNC(glFogCoordfv,"1.4")
|
48
|
+
LOAD_GL_FUNC(glFogCoordfv, "1.4");
|
49
49
|
Check_Type(arg1,T_ARRAY);
|
50
50
|
ary2cflt(arg1,&coord,1);
|
51
51
|
fptr_glFogCoordfv(&coord);
|
52
|
-
|
52
|
+
CHECK_GLERROR_FROM("glFogCoordfv");
|
53
53
|
return Qnil;
|
54
54
|
}
|
55
55
|
|
@@ -59,11 +59,11 @@ gl_FogCoorddv(obj,arg1)
|
|
59
59
|
VALUE obj,arg1;
|
60
60
|
{
|
61
61
|
GLdouble coord;
|
62
|
-
LOAD_GL_FUNC(glFogCoorddv,"1.4")
|
62
|
+
LOAD_GL_FUNC(glFogCoorddv, "1.4");
|
63
63
|
Check_Type(arg1,T_ARRAY);
|
64
64
|
ary2cdbl(arg1,&coord,1);
|
65
65
|
fptr_glFogCoorddv(&coord);
|
66
|
-
|
66
|
+
CHECK_GLERROR_FROM("glFogCoorddv");
|
67
67
|
return Qnil;
|
68
68
|
}
|
69
69
|
|
@@ -75,7 +75,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
75
75
|
{
|
76
76
|
GLenum type;
|
77
77
|
GLsizei stride;
|
78
|
-
LOAD_GL_FUNC(glFogCoordPointer,"1.4")
|
78
|
+
LOAD_GL_FUNC(glFogCoordPointer, "1.4");
|
79
79
|
type = (GLenum)NUM2INT(arg1);
|
80
80
|
stride = (GLsizei)NUM2UINT(arg2);
|
81
81
|
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
@@ -88,7 +88,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
88
88
|
g_FogCoord_ptr = data;
|
89
89
|
fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
|
90
90
|
}
|
91
|
-
|
91
|
+
CHECK_GLERROR_FROM("glFogCoordPointer");
|
92
92
|
return Qnil;
|
93
93
|
}
|
94
94
|
|
@@ -101,7 +101,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
101
101
|
GLint *ary1;
|
102
102
|
GLsizei *ary2;
|
103
103
|
int len1,len2;
|
104
|
-
LOAD_GL_FUNC(glMultiDrawArrays,"1.4")
|
104
|
+
LOAD_GL_FUNC(glMultiDrawArrays, "1.4");
|
105
105
|
len1 = (int)RARRAY_LENINT(arg2);
|
106
106
|
len2 = (int)RARRAY_LENINT(arg3);
|
107
107
|
if (len1!=len2)
|
@@ -114,7 +114,7 @@ VALUE obj,arg1,arg2,arg3;
|
|
114
114
|
fptr_glMultiDrawArrays(mode,ary1,ary2,len1);
|
115
115
|
xfree(ary1);
|
116
116
|
xfree(ary2);
|
117
|
-
|
117
|
+
CHECK_GLERROR_FROM("glMultiDrawArrays");
|
118
118
|
return Qnil;
|
119
119
|
}
|
120
120
|
|
@@ -132,7 +132,7 @@ VALUE obj;
|
|
132
132
|
GLint size;
|
133
133
|
int i;
|
134
134
|
VALUE ary, args[4];
|
135
|
-
LOAD_GL_FUNC(glMultiDrawElements,"1.4")
|
135
|
+
LOAD_GL_FUNC(glMultiDrawElements, "1.4");
|
136
136
|
switch (rb_scan_args(argc, argv, "31", &args[0], &args[1], &args[2],&args[3])) {
|
137
137
|
default:
|
138
138
|
case 3:
|
@@ -178,7 +178,7 @@ VALUE obj;
|
|
178
178
|
xfree(indices);
|
179
179
|
break;
|
180
180
|
}
|
181
|
-
|
181
|
+
CHECK_GLERROR_FROM("glMultiDrawElements");
|
182
182
|
return Qnil;
|
183
183
|
}
|
184
184
|
|
@@ -190,7 +190,7 @@ VALUE obj,arg1,arg2;
|
|
190
190
|
GLenum pname;
|
191
191
|
GLfloat params[3] = {(GLfloat)0.0,(GLfloat)0.0,(GLfloat)0.0};
|
192
192
|
GLint size;
|
193
|
-
LOAD_GL_FUNC(glPointParameterfv,"1.4")
|
193
|
+
LOAD_GL_FUNC(glPointParameterfv, "1.4");
|
194
194
|
pname = (GLenum)NUM2INT(arg1);
|
195
195
|
Check_Type(arg2,T_ARRAY);
|
196
196
|
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
@@ -198,8 +198,8 @@ VALUE obj,arg1,arg2;
|
|
198
198
|
else
|
199
199
|
size = 1;
|
200
200
|
ary2cflt(arg2,params,size);
|
201
|
-
fptr_glPointParameterfv(pname,params);
|
202
|
-
|
201
|
+
fptr_glPointParameterfv(pname,params);
|
202
|
+
CHECK_GLERROR_FROM("glPointParameterfv");
|
203
203
|
return Qnil;
|
204
204
|
}
|
205
205
|
|
@@ -211,7 +211,7 @@ VALUE obj,arg1,arg2;
|
|
211
211
|
GLenum pname;
|
212
212
|
GLint params[3] = {0,0,0};
|
213
213
|
GLint size;
|
214
|
-
LOAD_GL_FUNC(glPointParameteriv,"1.4")
|
214
|
+
LOAD_GL_FUNC(glPointParameteriv, "1.4");
|
215
215
|
pname = (GLenum)NUM2INT(arg1);
|
216
216
|
Check_Type(arg2,T_ARRAY);
|
217
217
|
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
@@ -219,8 +219,8 @@ VALUE obj,arg1,arg2;
|
|
219
219
|
else
|
220
220
|
size = 1;
|
221
221
|
ary2cint(arg2,params,size);
|
222
|
-
fptr_glPointParameteriv(pname,params);
|
223
|
-
|
222
|
+
fptr_glPointParameteriv(pname,params);
|
223
|
+
CHECK_GLERROR_FROM("glPointParameteriv");
|
224
224
|
return Qnil;
|
225
225
|
}
|
226
226
|
|
@@ -229,11 +229,11 @@ static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
|
|
229
229
|
VALUE gl_##_name_(VALUE obj,VALUE arg1) \
|
230
230
|
{ \
|
231
231
|
_type_ cary[3] = {0,0,0}; \
|
232
|
-
LOAD_GL_FUNC(gl##_name_,"1.4") \
|
232
|
+
LOAD_GL_FUNC(gl##_name_, "1.4"); \
|
233
233
|
Check_Type(arg1,T_ARRAY); \
|
234
234
|
_conv_(arg1,cary,3); \
|
235
235
|
fptr_gl##_name_(cary); \
|
236
|
-
|
236
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
237
237
|
return Qnil; \
|
238
238
|
}
|
239
239
|
|
@@ -256,7 +256,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
256
256
|
GLint size;
|
257
257
|
GLenum type;
|
258
258
|
GLsizei stride;
|
259
|
-
LOAD_GL_FUNC(glSecondaryColorPointer,"1.4")
|
259
|
+
LOAD_GL_FUNC(glSecondaryColorPointer, "1.4");
|
260
260
|
size = (GLint)NUM2INT(arg1);
|
261
261
|
type = (GLenum)NUM2INT(arg2);
|
262
262
|
stride = (GLsizei)NUM2UINT(arg3);
|
@@ -270,7 +270,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
270
270
|
g_SecondaryColor_ptr = data;
|
271
271
|
fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING_PTR(data));
|
272
272
|
}
|
273
|
-
|
273
|
+
CHECK_GLERROR_FROM("glSecondaryColorPointer");
|
274
274
|
return Qnil;
|
275
275
|
}
|
276
276
|
|
@@ -279,11 +279,11 @@ static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
|
|
279
279
|
VALUE gl_##_name_(VALUE obj,VALUE arg1) \
|
280
280
|
{ \
|
281
281
|
_type_ cary[3] = {0,0,0}; \
|
282
|
-
LOAD_GL_FUNC(gl##_name_,"1.4") \
|
282
|
+
LOAD_GL_FUNC(gl##_name_, "1.4"); \
|
283
283
|
Check_Type(arg1,T_ARRAY); \
|
284
284
|
_conv_(arg1,cary,_size_); \
|
285
285
|
fptr_gl##_name_(cary); \
|
286
|
-
|
286
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
287
287
|
return Qnil; \
|
288
288
|
}
|
289
289
|
|
data/ext/{gl → opengl}/gl-1.5.c
RENAMED
@@ -13,19 +13,19 @@
|
|
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 1.5 functions */
|
19
19
|
|
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")
|
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");
|
29
29
|
|
30
30
|
static void (APIENTRY * fptr_glGetQueryiv)(GLenum,GLenum,GLint *);
|
31
31
|
static VALUE
|
@@ -35,11 +35,11 @@ VALUE obj,arg1,arg2;
|
|
35
35
|
GLenum target;
|
36
36
|
GLenum pname;
|
37
37
|
GLint params = 0;
|
38
|
-
LOAD_GL_FUNC(glGetQueryiv,"1.5")
|
38
|
+
LOAD_GL_FUNC(glGetQueryiv, "1.5");
|
39
39
|
target = (GLenum)NUM2INT(arg1);
|
40
40
|
pname = (GLenum)NUM2INT(arg2);
|
41
41
|
fptr_glGetQueryiv(target,pname,¶ms);
|
42
|
-
|
42
|
+
CHECK_GLERROR_FROM("glGetQueryiv");
|
43
43
|
return RETCONV_GLint(params);
|
44
44
|
}
|
45
45
|
|
@@ -51,11 +51,11 @@ VALUE obj,arg1,arg2;
|
|
51
51
|
GLuint id;
|
52
52
|
GLenum pname;
|
53
53
|
GLint params = 0;
|
54
|
-
LOAD_GL_FUNC(glGetQueryObjectiv,"1.5")
|
54
|
+
LOAD_GL_FUNC(glGetQueryObjectiv, "1.5");
|
55
55
|
id = (GLuint)NUM2UINT(arg1);
|
56
56
|
pname = (GLenum)NUM2INT(arg2);
|
57
57
|
fptr_glGetQueryObjectiv(id,pname,¶ms);
|
58
|
-
|
58
|
+
CHECK_GLERROR_FROM("glGetQueryObjectiv");
|
59
59
|
return cond_GLBOOL2RUBY(pname,params);
|
60
60
|
}
|
61
61
|
|
@@ -67,11 +67,11 @@ VALUE obj,arg1,arg2;
|
|
67
67
|
GLuint id;
|
68
68
|
GLenum pname;
|
69
69
|
GLuint params = 0;
|
70
|
-
LOAD_GL_FUNC(glGetQueryObjectuiv,"1.5")
|
70
|
+
LOAD_GL_FUNC(glGetQueryObjectuiv, "1.5");
|
71
71
|
id = (GLuint)NUM2UINT(arg1);
|
72
72
|
pname = (GLenum)NUM2INT(arg2);
|
73
73
|
fptr_glGetQueryObjectuiv(id,pname,¶ms);
|
74
|
-
|
74
|
+
CHECK_GLERROR_FROM("glGetQueryObjectuiv");
|
75
75
|
return cond_GLBOOL2RUBY_U(pname,params);
|
76
76
|
}
|
77
77
|
|
@@ -83,7 +83,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
83
83
|
GLenum target;
|
84
84
|
GLsizeiptr size;
|
85
85
|
GLenum usage;
|
86
|
-
LOAD_GL_FUNC(glBufferData,"1.5")
|
86
|
+
LOAD_GL_FUNC(glBufferData, "1.5");
|
87
87
|
target = (GLenum)NUM2INT(arg1);
|
88
88
|
size = (GLsizeiptr)NUM2INT(arg2);
|
89
89
|
usage = (GLenum)NUM2INT(arg4);
|
@@ -92,9 +92,9 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
92
92
|
} else if (NIL_P(arg3)) {
|
93
93
|
fptr_glBufferData(target,size,NULL,usage);
|
94
94
|
} else {
|
95
|
-
Check_Type(arg3,T_STRING); /* force exception */
|
95
|
+
Check_Type(arg3,T_STRING); /* force exception - HACK do it right */
|
96
96
|
}
|
97
|
-
|
97
|
+
CHECK_GLERROR_FROM("glBufferData");
|
98
98
|
return Qnil;
|
99
99
|
}
|
100
100
|
|
@@ -106,13 +106,13 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
106
106
|
GLenum target;
|
107
107
|
GLintptr offset;
|
108
108
|
GLsizeiptr size;
|
109
|
-
LOAD_GL_FUNC(glBufferSubData,"1.5")
|
109
|
+
LOAD_GL_FUNC(glBufferSubData, "1.5");
|
110
110
|
target = (GLenum)NUM2INT(arg1);
|
111
111
|
offset = (GLintptr)NUM2INT(arg2);
|
112
112
|
size = (GLsizeiptr)NUM2INT(arg3);
|
113
113
|
Check_Type(arg4,T_STRING);
|
114
114
|
fptr_glBufferSubData(target,offset,size,(GLvoid *)RSTRING_PTR(arg4));
|
115
|
-
|
115
|
+
CHECK_GLERROR_FROM("glBufferSubData");
|
116
116
|
return Qnil;
|
117
117
|
}
|
118
118
|
|
@@ -125,13 +125,13 @@ VALUE obj,arg1,arg2,arg3;
|
|
125
125
|
GLintptr offset;
|
126
126
|
GLsizeiptr size;
|
127
127
|
VALUE data;
|
128
|
-
LOAD_GL_FUNC(glGetBufferSubData,"1.5")
|
128
|
+
LOAD_GL_FUNC(glGetBufferSubData, "1.5");
|
129
129
|
target = (GLenum)NUM2INT(arg1);
|
130
130
|
offset = (GLintptr)NUM2INT(arg2);
|
131
131
|
size = (GLsizeiptr)NUM2INT(arg3);
|
132
132
|
data = allocate_buffer_with_string((long)size);
|
133
133
|
fptr_glGetBufferSubData(target,offset,size,(GLvoid *)RSTRING_PTR(data));
|
134
|
-
|
134
|
+
CHECK_GLERROR_FROM("glGetBufferSubData");
|
135
135
|
return data;
|
136
136
|
}
|
137
137
|
|
@@ -143,37 +143,36 @@ VALUE obj,arg1,arg2;
|
|
143
143
|
GLenum target;
|
144
144
|
GLenum value;
|
145
145
|
GLint data = 0;
|
146
|
-
LOAD_GL_FUNC(glGetBufferParameteriv,"1.5")
|
146
|
+
LOAD_GL_FUNC(glGetBufferParameteriv, "1.5");
|
147
147
|
target = (GLenum)NUM2INT(arg1);
|
148
148
|
value = (GLenum)NUM2INT(arg2);
|
149
149
|
fptr_glGetBufferParameteriv(target,value,&data);
|
150
|
-
|
150
|
+
CHECK_GLERROR_FROM("glGetBufferParameteriv");
|
151
151
|
return cond_GLBOOL2RUBY(value,data);
|
152
152
|
}
|
153
153
|
|
154
154
|
static GLvoid * (APIENTRY * fptr_glMapBuffer)(GLenum,GLenum);
|
155
155
|
static VALUE
|
156
|
-
gl_MapBuffer(
|
157
|
-
|
158
|
-
|
159
|
-
GLenum target;
|
160
|
-
GLenum access;
|
156
|
+
gl_MapBuffer(VALUE self, VALUE _target, VALUE _access) {
|
157
|
+
GLenum target = CONV_GLenum(_target);
|
158
|
+
GLenum access = CONV_GLenum(_access);
|
161
159
|
GLint size = 0;
|
162
|
-
VALUE data;
|
163
160
|
GLvoid *buffer_ptr = NULL;
|
164
|
-
|
165
|
-
LOAD_GL_FUNC(
|
166
|
-
|
167
|
-
|
168
|
-
fptr_glGetBufferParameteriv(target,GL_BUFFER_SIZE
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
161
|
+
|
162
|
+
LOAD_GL_FUNC(glMapBuffer, "1.5");
|
163
|
+
LOAD_GL_FUNC(glGetBufferParameteriv, "1.5");
|
164
|
+
|
165
|
+
fptr_glGetBufferParameteriv(target, GL_BUFFER_SIZE, &size);
|
166
|
+
CHECK_GLERROR_FROM("glGetBufferParameteriv");
|
167
|
+
|
168
|
+
buffer_ptr = fptr_glMapBuffer(target, access);
|
169
|
+
CHECK_GLERROR_FROM("glMapBuffer");
|
170
|
+
|
171
|
+
/* fail late to avoid GL_INVALID_OPERATION from glUnampBuffer */
|
172
|
+
if (buffer_ptr == NULL || size <= 0)
|
173
173
|
return Qnil;
|
174
|
-
|
175
|
-
|
176
|
-
return data;
|
174
|
+
|
175
|
+
return rb_str_new(buffer_ptr, size);
|
177
176
|
}
|
178
177
|
|
179
178
|
static GLboolean (APIENTRY * fptr_glUnmapBuffer)(GLenum);
|
@@ -183,10 +182,10 @@ VALUE obj,arg1;
|
|
183
182
|
{
|
184
183
|
GLenum target;
|
185
184
|
GLboolean ret;
|
186
|
-
LOAD_GL_FUNC(glUnmapBuffer,"1.5")
|
185
|
+
LOAD_GL_FUNC(glUnmapBuffer, "1.5");
|
187
186
|
target = (GLenum)NUM2INT(arg1);
|
188
187
|
ret = fptr_glUnmapBuffer(target);
|
189
|
-
|
188
|
+
CHECK_GLERROR_FROM("glUnmapBuffer");
|
190
189
|
return GLBOOL2RUBY(ret);
|
191
190
|
}
|
192
191
|
|
@@ -195,9 +194,9 @@ static VALUE
|
|
195
194
|
gl_GetBufferPointerv(obj,arg1,arg2,arg3)
|
196
195
|
VALUE obj,arg1,arg2,arg3;
|
197
196
|
{
|
198
|
-
LOAD_GL_FUNC(glGetBufferPointerv,"1.5")
|
197
|
+
LOAD_GL_FUNC(glGetBufferPointerv, "1.5");
|
199
198
|
rb_raise(rb_eArgError, "glGetBufferPointerv not implemented");
|
200
|
-
|
199
|
+
CHECK_GLERROR_FROM("glGetBufferPointerv");
|
201
200
|
return Qnil;
|
202
201
|
}
|
203
202
|
|