ruby-opengl 0.40.1 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/doc/build_install.txt +48 -28
- data/doc/extensions.txt +361 -0
- data/doc/history.txt +8 -2
- data/doc/requirements_and_design.txt +0 -13
- data/doc/roadmap.txt +11 -13
- data/doc/supplies/page_template.html +11 -5
- data/doc/thanks.txt +2 -4
- data/doc/tutorial.txt +1 -4
- data/examples/{nehe_lesson02.rb → NeHe/nehe_lesson02.rb} +0 -0
- data/examples/{nehe_lesson03.rb → NeHe/nehe_lesson03.rb} +0 -0
- data/examples/{nehe_lesson04.rb → NeHe/nehe_lesson04.rb} +0 -0
- data/examples/{nehe_lesson05.rb → NeHe/nehe_lesson05.rb} +0 -0
- data/examples/NeHe/nehe_lesson36.rb +303 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +388 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +424 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +13 -83
- data/examples/RedBook/aaindex.rb +97 -0
- data/examples/RedBook/aapoly.rb +142 -0
- data/examples/RedBook/aargb.rb +119 -0
- data/examples/RedBook/accanti.rb +162 -0
- data/examples/RedBook/accpersp.rb +215 -0
- data/examples/RedBook/alpha.rb +123 -0
- data/examples/RedBook/alpha3D.rb +158 -0
- data/examples/RedBook/bezcurve.rb +105 -0
- data/examples/RedBook/bezmesh.rb +137 -0
- data/examples/RedBook/checker.rb +124 -0
- data/examples/RedBook/clip.rb +95 -0
- data/examples/RedBook/colormat.rb +135 -0
- data/examples/RedBook/cube.rb +69 -0
- data/examples/RedBook/depthcue.rb +99 -0
- data/examples/RedBook/dof.rb +205 -0
- data/examples/{legacy → RedBook}/double.rb +59 -58
- data/examples/{legacy → RedBook}/drawf.rb +47 -54
- data/examples/RedBook/feedback.rb +145 -0
- data/examples/RedBook/fog.rb +167 -0
- data/examples/RedBook/font.rb +151 -0
- data/examples/RedBook/hello.rb +79 -0
- data/examples/RedBook/image.rb +137 -0
- data/examples/{legacy → RedBook}/jitter.rb +60 -62
- data/examples/RedBook/lines.rb +128 -0
- data/examples/RedBook/list.rb +111 -0
- data/examples/RedBook/material.rb +275 -0
- data/examples/RedBook/mipmap.rb +156 -0
- data/examples/{legacy → RedBook}/model.rb +66 -72
- data/examples/{legacy → RedBook}/movelight.rb +67 -75
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/{legacy → RedBook}/planet.rb +62 -66
- data/examples/RedBook/quadric.rb +158 -0
- data/examples/RedBook/robot.rb +115 -0
- data/examples/RedBook/select.rb +196 -0
- data/examples/RedBook/smooth.rb +95 -0
- data/examples/RedBook/stencil.rb +163 -0
- data/examples/RedBook/stroke.rb +167 -0
- data/examples/RedBook/surface.rb +166 -0
- data/examples/RedBook/teaambient.rb +132 -0
- data/examples/RedBook/teapots.rb +182 -0
- data/examples/RedBook/tess.rb +183 -0
- data/examples/RedBook/texbind.rb +147 -0
- data/examples/RedBook/texgen.rb +169 -0
- data/examples/RedBook/texturesurf.rb +128 -0
- data/examples/RedBook/varray.rb +159 -0
- data/examples/RedBook/wrap.rb +148 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/{plane.rb → misc/plane.rb} +0 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/{smooth.rb → misc/smooth.rb} +0 -0
- data/examples/{test.rb → misc/test.rb} +0 -0
- data/ext/common/common.h +252 -70
- data/ext/common/gl-enums.h +6102 -7334
- data/ext/common/gl-types.h +47 -0
- data/ext/common/glu-enums.h +469 -0
- data/ext/gl/gl-1.0-1.1.c +842 -2464
- data/ext/gl/gl-1.2.c +217 -281
- data/ext/gl/gl-1.3.c +113 -133
- data/ext/gl/gl-1.4.c +98 -334
- data/ext/gl/gl-1.5.c +28 -34
- data/ext/gl/gl-2.0.c +26 -235
- data/ext/gl/gl-2.1.c +31 -124
- data/ext/gl/gl-enums.c +786 -631
- data/ext/gl/gl-ext-arb.c +66 -0
- data/ext/gl/gl-ext-ext.c +218 -0
- data/ext/gl/gl.c +138 -31
- data/ext/gl/mkrf_conf.rb +1 -0
- data/ext/glu/glu-enums.c +163 -0
- data/ext/glu/glu.c +1003 -1205
- data/ext/glu/mkrf_conf.rb +1 -0
- data/ext/glut/glut.c +1056 -1175
- data/lib/opengl.rb +90 -3
- data/test/tc_common.rb +26 -13
- data/test/tc_ext_arb.rb +73 -0
- data/test/tc_ext_ext.rb +74 -0
- data/test/tc_func_12.rb +8 -8
- data/test/tc_func_13.rb +17 -11
- data/test/tc_func_14.rb +8 -8
- data/test/tc_func_15.rb +190 -2
- data/test/tc_func_20.rb +36 -10
- data/test/tc_func_21.rb +445 -2
- data/test/tc_glu.rb +305 -0
- data/test/tc_misc.rb +1 -0
- metadata +84 -68
- data/doc/screenshots.txt +0 -23
- data/examples/legacy/COPYRIGHT +0 -8
- data/examples/legacy/aaindex.rb +0 -98
- data/examples/legacy/aapoly.rb +0 -153
- data/examples/legacy/aargb.rb +0 -139
- data/examples/legacy/accanti.rb +0 -159
- data/examples/legacy/accpersp.rb +0 -216
- data/examples/legacy/alpha.rb +0 -133
- data/examples/legacy/alpha3D.rb +0 -165
- data/examples/legacy/bezcurve.rb +0 -107
- data/examples/legacy/bezmesh.rb +0 -131
- data/examples/legacy/checker.rb +0 -121
- data/examples/legacy/clip.rb +0 -104
- data/examples/legacy/colormat.rb +0 -145
- data/examples/legacy/cube.rb +0 -73
- data/examples/legacy/depthcue.rb +0 -101
- data/examples/legacy/dof.rb +0 -212
- data/examples/legacy/feedback.rb +0 -152
- data/examples/legacy/fog.rb +0 -172
- data/examples/legacy/font-glut.rb +0 -41
- data/examples/legacy/font.rb +0 -158
- data/examples/legacy/hello.rb +0 -75
- data/examples/legacy/image.rb +0 -145
- data/examples/legacy/lines.rb +0 -135
- data/examples/legacy/list.rb +0 -120
- data/examples/legacy/material.rb +0 -290
- data/examples/legacy/mipmap.rb +0 -159
- data/examples/legacy/pickdepth.rb +0 -180
- data/examples/legacy/quadric.rb +0 -180
- data/examples/legacy/readpixel.rb +0 -59
- data/examples/legacy/robot.rb +0 -120
- data/examples/legacy/select.rb +0 -207
- data/examples/legacy/smooth.rb +0 -41
- data/examples/legacy/stencil.rb +0 -154
- data/examples/legacy/stroke.rb +0 -170
- data/examples/legacy/surface.rb +0 -170
- data/examples/legacy/teaambient.rb +0 -132
- data/examples/legacy/teapots.rb +0 -188
- data/examples/legacy/tess.rb +0 -222
- data/examples/legacy/texbind.rb +0 -157
- data/examples/legacy/texgen.rb +0 -171
- data/examples/legacy/texturesurf.rb +0 -128
- data/examples/legacy/varray.rb +0 -167
- data/examples/legacy/wrap.rb +0 -158
- data/lib/gl_prev.rb +0 -46
- data/lib/glu_prev.rb +0 -46
- data/lib/glut_prev.rb +0 -45
data/ext/gl/gl-1.2.c
CHANGED
@@ -15,47 +15,12 @@
|
|
15
15
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
16
|
*/
|
17
17
|
|
18
|
-
#ifdef __APPLE__
|
19
|
-
#include <OpenGL/gl.h>
|
20
|
-
#elif defined WIN32
|
21
|
-
#include <windows.h>
|
22
|
-
#include <GL/gl.h>
|
23
|
-
#else
|
24
|
-
#include <GL/gl.h>
|
25
|
-
#endif
|
26
18
|
#include "../common/common.h"
|
27
19
|
|
28
20
|
/* OpenGL 1.2 functions */
|
29
21
|
|
30
|
-
|
31
|
-
|
32
|
-
gl_BlendColor(obj,arg1,arg2,arg3,arg4)
|
33
|
-
VALUE obj,arg1,arg2,arg3,arg4;
|
34
|
-
{
|
35
|
-
GLclampf red;
|
36
|
-
GLclampf green;
|
37
|
-
GLclampf blue;
|
38
|
-
GLclampf alpha;
|
39
|
-
LOAD_GL_FUNC(glBlendColor)
|
40
|
-
red = (GLclampf)NUM2DBL(arg1);
|
41
|
-
green = (GLclampf)NUM2DBL(arg2);
|
42
|
-
blue = (GLclampf)NUM2DBL(arg3);
|
43
|
-
alpha = (GLclampf)NUM2DBL(arg4);
|
44
|
-
fptr_glBlendColor(red,green,blue,alpha);
|
45
|
-
return Qnil;
|
46
|
-
}
|
47
|
-
|
48
|
-
static void (APIENTRY * fptr_glBlendEquation)(GLenum);
|
49
|
-
static VALUE
|
50
|
-
gl_BlendEquation(obj,arg1)
|
51
|
-
VALUE obj,arg1;
|
52
|
-
{
|
53
|
-
GLenum mode;
|
54
|
-
LOAD_GL_FUNC(glBlendEquation)
|
55
|
-
mode = (GLenum)NUM2INT(arg1);
|
56
|
-
fptr_glBlendEquation(mode);
|
57
|
-
return Qnil;
|
58
|
-
}
|
22
|
+
GL_SIMPLE_FUNC_LOAD(BlendColor,4,GLclampf,NUM2DBL)
|
23
|
+
GL_SIMPLE_FUNC_LOAD(BlendEquation,1,GLenum,NUM2INT)
|
59
24
|
|
60
25
|
static void (APIENTRY * fptr_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,GLvoid*);
|
61
26
|
static VALUE
|
@@ -73,8 +38,12 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
|
73
38
|
end = (GLuint)NUM2UINT(arg3);
|
74
39
|
count = (GLsizei)NUM2UINT(arg4);
|
75
40
|
type = (GLenum)NUM2INT(arg5);
|
76
|
-
|
77
|
-
|
41
|
+
if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
|
42
|
+
fptr_glDrawRangeElements(mode, start, end, count, type, (GLvoid *)NUM2INT(arg6));
|
43
|
+
} else {
|
44
|
+
Check_Type(arg6, T_STRING);
|
45
|
+
fptr_glDrawRangeElements(mode, start, end, count, type, RSTRING(arg6)->ptr);
|
46
|
+
}
|
78
47
|
return Qnil;
|
79
48
|
}
|
80
49
|
|
@@ -88,24 +57,19 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
|
88
57
|
GLsizei width;
|
89
58
|
GLenum format;
|
90
59
|
GLenum type;
|
91
|
-
GLsizei format_size;
|
92
|
-
GLsizei type_size;
|
93
|
-
GLsizei size;
|
94
60
|
LOAD_GL_FUNC(glColorTable)
|
95
61
|
target = (GLenum)NUM2INT(arg1);
|
96
62
|
internalformat = (GLenum)NUM2INT(arg2);
|
97
63
|
width = (GLsizei)NUM2UINT(arg3);
|
98
64
|
format = (GLenum)NUM2INT(arg4);
|
99
65
|
type = (GLenum)NUM2INT(arg5);
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len);
|
108
|
-
fptr_glColorTable(target,internalformat,width,format,type,RSTRING(arg6)->ptr);
|
66
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
67
|
+
fptr_glColorTable(target,internalformat,width,format,type,(GLvoid *)NUM2INT(arg6));
|
68
|
+
} else {
|
69
|
+
Check_Type(arg6,T_STRING);
|
70
|
+
CheckDataSize(type,format,width,arg6);
|
71
|
+
fptr_glColorTable(target,internalformat,width,format,type,RSTRING(arg6)->ptr);
|
72
|
+
}
|
109
73
|
return Qnil;
|
110
74
|
}
|
111
75
|
|
@@ -156,9 +120,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
|
156
120
|
LOAD_GL_FUNC(glCopyColorTable)
|
157
121
|
target = (GLenum)NUM2INT(arg1);
|
158
122
|
internalformat = (GLenum)NUM2INT(arg2);
|
159
|
-
x = (
|
160
|
-
y = (
|
161
|
-
width = (
|
123
|
+
x = (GLint)NUM2INT(arg3);
|
124
|
+
y = (GLint)NUM2INT(arg4);
|
125
|
+
width = (GLsizei)NUM2INT(arg5);
|
162
126
|
fptr_glCopyColorTable(target,internalformat,x,y,width);
|
163
127
|
return Qnil;
|
164
128
|
}
|
@@ -231,9 +195,6 @@ VALUE obj,arg1,arg2,arg3;
|
|
231
195
|
GLenum target;
|
232
196
|
GLenum format;
|
233
197
|
GLenum type;
|
234
|
-
GLsizei format_size;
|
235
|
-
GLsizei type_size;
|
236
|
-
GLsizei size;
|
237
198
|
GLsizei width = 0;
|
238
199
|
VALUE data;
|
239
200
|
LOAD_GL_FUNC(glGetColorTable)
|
@@ -241,16 +202,8 @@ VALUE obj,arg1,arg2,arg3;
|
|
241
202
|
target = (GLenum)NUM2INT(arg1);
|
242
203
|
format = (GLenum)NUM2INT(arg2);
|
243
204
|
type = (GLenum)NUM2INT(arg3);
|
244
|
-
format_size = glformat_size(format);
|
245
|
-
type_size = gltype_size(type);
|
246
|
-
if (type_size == -1 || format_size == -1)
|
247
|
-
rb_raise(rb_eTypeError, "type/format mismatch");
|
248
205
|
fptr_glGetColorTableParameteriv(target,GL_COLOR_TABLE_WIDTH,&width);
|
249
|
-
|
250
|
-
size = format_size*(width/8);
|
251
|
-
else
|
252
|
-
size = type_size*format_size*width;
|
253
|
-
data = allocate_buffer_with_string(size);
|
206
|
+
data = allocate_buffer_with_string(GetDataSize(type,format,width));
|
254
207
|
FORCE_PIXEL_STORE_MODE
|
255
208
|
fptr_glGetColorTable(target,format,type,(GLvoid*)RSTRING(data)->ptr);
|
256
209
|
RESTORE_PIXEL_STORE_MODE
|
@@ -267,24 +220,19 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
|
267
220
|
GLsizei count;
|
268
221
|
GLenum format;
|
269
222
|
GLenum type;
|
270
|
-
GLsizei format_size;
|
271
|
-
GLsizei type_size;
|
272
|
-
GLsizei size;
|
273
223
|
LOAD_GL_FUNC(glColorSubTable)
|
274
224
|
target = (GLenum)NUM2INT(arg1);
|
275
225
|
start = (GLsizei)NUM2UINT(arg2);
|
276
226
|
count = (GLsizei)NUM2UINT(arg3);
|
277
227
|
format = (GLenum)NUM2INT(arg4);
|
278
228
|
type = (GLenum)NUM2INT(arg5);
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len);
|
287
|
-
fptr_glColorSubTable(target,start,count,format,type,RSTRING(arg6)->ptr);
|
229
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
230
|
+
fptr_glColorSubTable(target,start,count,format,type,(GLvoid *)NUM2INT(arg6));
|
231
|
+
} else {
|
232
|
+
Check_Type(arg6,T_STRING);
|
233
|
+
CheckDataSize(type,format,count,arg6);
|
234
|
+
fptr_glColorSubTable(target,start,count,format,type,RSTRING(arg6)->ptr);
|
235
|
+
}
|
288
236
|
return Qnil;
|
289
237
|
}
|
290
238
|
|
@@ -318,27 +266,19 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
|
318
266
|
GLsizei width;
|
319
267
|
GLenum format;
|
320
268
|
GLenum type;
|
321
|
-
GLsizei format_size;
|
322
|
-
GLsizei type_size;
|
323
|
-
GLsizei size;
|
324
269
|
LOAD_GL_FUNC(glConvolutionFilter1D)
|
325
270
|
target = (GLenum)NUM2INT(arg1);
|
326
271
|
internalformat = (GLenum)NUM2INT(arg2);
|
327
272
|
width = (GLsizei)NUM2UINT(arg3);
|
328
273
|
format = (GLenum)NUM2INT(arg4);
|
329
274
|
type = (GLenum)NUM2INT(arg5);
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
else
|
338
|
-
size = type_size*format_size*width;
|
339
|
-
if (RSTRING(arg6)->len < size)
|
340
|
-
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len);
|
341
|
-
fptr_glConvolutionFilter1D(target,internalformat,width,format,type,RSTRING(arg6)->ptr);
|
275
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
276
|
+
fptr_glConvolutionFilter1D(target,internalformat,width,format,type,(GLvoid *)NUM2INT(arg6));
|
277
|
+
} else {
|
278
|
+
Check_Type(arg6,T_STRING);
|
279
|
+
CheckDataSize(type,format,width,arg6);
|
280
|
+
fptr_glConvolutionFilter1D(target,internalformat,width,format,type,RSTRING(arg6)->ptr);
|
281
|
+
}
|
342
282
|
return Qnil;
|
343
283
|
}
|
344
284
|
|
@@ -353,9 +293,6 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
353
293
|
GLsizei height;
|
354
294
|
GLenum format;
|
355
295
|
GLenum type;
|
356
|
-
GLsizei format_size;
|
357
|
-
GLsizei type_size;
|
358
|
-
GLsizei size;
|
359
296
|
LOAD_GL_FUNC(glConvolutionFilter2D)
|
360
297
|
target = (GLenum)NUM2INT(arg1);
|
361
298
|
internalformat = (GLenum)NUM2INT(arg2);
|
@@ -363,18 +300,13 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
|
363
300
|
height = (GLsizei)NUM2UINT(arg4);
|
364
301
|
format = (GLenum)NUM2INT(arg5);
|
365
302
|
type = (GLenum)NUM2INT(arg6);
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
else
|
374
|
-
size = type_size*format_size*width*height;
|
375
|
-
if (RSTRING(arg7)->len < size)
|
376
|
-
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len);
|
377
|
-
fptr_glConvolutionFilter2D(target,internalformat,width,height,format,type,RSTRING(arg7)->ptr);
|
303
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
304
|
+
fptr_glConvolutionFilter2D(target,internalformat,width,height,format,type,(GLvoid *)NUM2INT(arg7));
|
305
|
+
} else {
|
306
|
+
Check_Type(arg7,T_STRING);
|
307
|
+
CheckDataSize(type,format,width*height,arg7);
|
308
|
+
fptr_glConvolutionFilter2D(target,internalformat,width,height,format,type,RSTRING(arg7)->ptr);
|
309
|
+
}
|
378
310
|
return Qnil;
|
379
311
|
}
|
380
312
|
|
@@ -550,86 +482,107 @@ VALUE obj,arg1,arg2;
|
|
550
482
|
|
551
483
|
static void (APIENTRY * fptr_glGetConvolutionFilter)(GLenum,GLenum,GLenum,GLvoid *);
|
552
484
|
static VALUE
|
553
|
-
gl_GetConvolutionFilter(
|
554
|
-
|
485
|
+
gl_GetConvolutionFilter(argc,argv,obj)
|
486
|
+
int argc;
|
487
|
+
VALUE *argv;
|
488
|
+
VALUE obj;
|
555
489
|
{
|
556
490
|
GLenum target;
|
557
491
|
GLenum format;
|
558
492
|
GLenum type;
|
559
|
-
GLsizei format_size;
|
560
|
-
GLsizei type_size;
|
493
|
+
//GLsizei format_size;
|
494
|
+
//GLsizei type_size;
|
561
495
|
GLint size = 0;
|
562
496
|
VALUE data;
|
497
|
+
VALUE args[4];
|
498
|
+
int numargs;
|
563
499
|
LOAD_GL_FUNC(glGetConvolutionFilter)
|
564
500
|
LOAD_GL_FUNC(glGetConvolutionParameteriv)
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
501
|
+
numargs = rb_scan_args(argc, argv, "31", &args[0], &args[1], &args[2], &args[3]);
|
502
|
+
target = (GLenum)NUM2INT(args[0]);
|
503
|
+
format = (GLenum)NUM2INT(args[1]);
|
504
|
+
type = (GLenum)NUM2INT(args[2]);
|
505
|
+
|
506
|
+
switch(numargs) {
|
507
|
+
default:
|
508
|
+
case 3:
|
509
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
510
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
511
|
+
|
512
|
+
if (target==GL_CONVOLUTION_1D) {
|
513
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&size);
|
514
|
+
} else {
|
515
|
+
GLint tmp = 0;
|
516
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&tmp);
|
517
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_HEIGHT,&size);
|
518
|
+
size *=tmp;
|
519
|
+
}
|
520
|
+
data = allocate_buffer_with_string(GetDataSize(type,format,size));
|
521
|
+
FORCE_PIXEL_STORE_MODE
|
522
|
+
fptr_glGetConvolutionFilter(target,format,type,(GLvoid*)RSTRING(data)->ptr);
|
523
|
+
RESTORE_PIXEL_STORE_MODE
|
524
|
+
return data;
|
525
|
+
case 4:
|
526
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
527
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
528
|
+
|
529
|
+
FORCE_PIXEL_STORE_MODE
|
530
|
+
fptr_glGetConvolutionFilter(target,format,type,(GLvoid*)NUM2INT(args[3]));
|
531
|
+
RESTORE_PIXEL_STORE_MODE
|
532
|
+
return Qnil;
|
579
533
|
}
|
580
|
-
if (type==GL_BITMAP)
|
581
|
-
size = (size/8)*format_size;
|
582
|
-
else
|
583
|
-
size = size*type_size*format_size;
|
584
|
-
data = allocate_buffer_with_string(size);
|
585
|
-
FORCE_PIXEL_STORE_MODE
|
586
|
-
fptr_glGetConvolutionFilter(target,format,type,(GLvoid*)RSTRING(data)->ptr);
|
587
|
-
RESTORE_PIXEL_STORE_MODE
|
588
|
-
return data;
|
589
534
|
}
|
590
535
|
|
591
536
|
static void (APIENTRY * fptr_glGetSeparableFilter)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*);
|
592
537
|
static VALUE
|
593
|
-
gl_GetSeparableFilter(
|
594
|
-
|
538
|
+
gl_GetSeparableFilter(argc,argv,obj)
|
539
|
+
int argc;
|
540
|
+
VALUE *argv;
|
541
|
+
VALUE obj;
|
595
542
|
{
|
596
543
|
GLenum target;
|
597
544
|
GLenum format;
|
598
545
|
GLenum type;
|
599
|
-
GLsizei format_size;
|
600
|
-
GLsizei type_size;
|
601
546
|
GLint size_row = 0;
|
602
547
|
GLint size_column = 0;
|
603
548
|
VALUE data_row;
|
604
549
|
VALUE data_column;
|
605
550
|
VALUE retary;
|
551
|
+
VALUE args[6];
|
552
|
+
int numargs;
|
606
553
|
LOAD_GL_FUNC(glGetSeparableFilter)
|
607
554
|
LOAD_GL_FUNC(glGetConvolutionParameteriv)
|
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
|
-
|
555
|
+
numargs = rb_scan_args(argc, argv, "33", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5]);
|
556
|
+
target = (GLenum)NUM2INT(args[0]);
|
557
|
+
format = (GLenum)NUM2INT(args[1]);
|
558
|
+
type = (GLenum)NUM2INT(args[2]);
|
559
|
+
|
560
|
+
switch(numargs) {
|
561
|
+
default:
|
562
|
+
case 3:
|
563
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
564
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset arguments missing");
|
565
|
+
|
566
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&size_row);
|
567
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_HEIGHT,&size_column);
|
568
|
+
data_row = allocate_buffer_with_string(GetDataSize(type,format,size_row));
|
569
|
+
data_column = allocate_buffer_with_string(GetDataSize(type,format,size_column));
|
570
|
+
FORCE_PIXEL_STORE_MODE
|
571
|
+
fptr_glGetSeparableFilter(target,format,type,(GLvoid*)RSTRING(data_row)->ptr,(GLvoid*)RSTRING(data_column)->ptr,0);
|
572
|
+
RESTORE_PIXEL_STORE_MODE
|
573
|
+
retary = rb_ary_new2(2);
|
574
|
+
rb_ary_push(retary, data_row);
|
575
|
+
rb_ary_push(retary, data_column);
|
576
|
+
return retary;
|
577
|
+
break;
|
578
|
+
case 6:
|
579
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
580
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
581
|
+
FORCE_PIXEL_STORE_MODE
|
582
|
+
fptr_glGetSeparableFilter(target,format,type,(GLvoid*)NUM2INT(args[3]),(GLvoid*)NUM2INT(args[4]),(GLvoid*)NUM2INT(args[5]));
|
583
|
+
RESTORE_PIXEL_STORE_MODE
|
584
|
+
return Qnil;
|
585
|
+
}
|
633
586
|
}
|
634
587
|
|
635
588
|
static void (APIENTRY * fptr_glSeparableFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *,const GLvoid *);
|
@@ -643,10 +596,6 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
|
643
596
|
GLsizei height;
|
644
597
|
GLenum format;
|
645
598
|
GLenum type;
|
646
|
-
GLsizei format_size;
|
647
|
-
GLsizei type_size;
|
648
|
-
GLsizei size_row;
|
649
|
-
GLsizei size_column;
|
650
599
|
LOAD_GL_FUNC(glSeparableFilter2D)
|
651
600
|
target = (GLenum)NUM2INT(arg1);
|
652
601
|
internalformat = (GLenum)NUM2INT(arg2);
|
@@ -654,25 +603,15 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
|
654
603
|
height = (GLsizei)NUM2UINT(arg4);
|
655
604
|
format = (GLenum)NUM2INT(arg5);
|
656
605
|
type = (GLenum)NUM2INT(arg6);
|
657
|
-
|
658
|
-
|
659
|
-
format_size = glformat_size(format);
|
660
|
-
type_size = gltype_size(type);
|
661
|
-
if (type_size == -1 || format_size == -1)
|
662
|
-
rb_raise(rb_eTypeError, "type/format mismatch");
|
663
|
-
if (type==GL_BITMAP) {
|
664
|
-
size_row = format_size*(width/8);
|
665
|
-
size_column = format_size*(height/8);
|
606
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
607
|
+
fptr_glSeparableFilter2D(target,internalformat,width,height,format,type,(GLvoid *)NUM2INT(arg7),(GLvoid *)NUM2INT(arg8));
|
666
608
|
} else {
|
667
|
-
|
668
|
-
|
609
|
+
Check_Type(arg7,T_STRING);
|
610
|
+
Check_Type(arg8,T_STRING);
|
611
|
+
CheckDataSize(type,format,width,arg7);
|
612
|
+
CheckDataSize(type,format,height,arg8);
|
613
|
+
fptr_glSeparableFilter2D(target,internalformat,width,height,format,type,RSTRING(arg7)->ptr,RSTRING(arg8)->ptr);
|
669
614
|
}
|
670
|
-
if (RSTRING(arg7)->len < size_row)
|
671
|
-
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len);
|
672
|
-
if (RSTRING(arg8)->len < size_column)
|
673
|
-
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg8)->len);
|
674
|
-
|
675
|
-
fptr_glSeparableFilter2D(target,internalformat,width,height,format,type,RSTRING(arg7)->ptr,RSTRING(arg8)->ptr);
|
676
615
|
return Qnil;
|
677
616
|
}
|
678
617
|
|
@@ -714,70 +653,93 @@ VALUE obj,arg1,arg2,arg3;
|
|
714
653
|
|
715
654
|
static void (APIENTRY * fptr_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,GLvoid*);
|
716
655
|
static VALUE
|
717
|
-
gl_GetHistogram(
|
718
|
-
|
656
|
+
gl_GetHistogram(argc,argv,obj)
|
657
|
+
int argc;
|
658
|
+
VALUE *argv;
|
659
|
+
VALUE obj;
|
719
660
|
{
|
720
661
|
GLenum target;
|
721
662
|
GLboolean reset;
|
722
663
|
GLenum format;
|
723
664
|
GLenum type;
|
724
|
-
GLsizei format_size;
|
725
|
-
GLsizei type_size;
|
726
665
|
GLint size = 0;
|
727
666
|
VALUE data;
|
667
|
+
VALUE args[5];
|
668
|
+
int numargs;
|
728
669
|
LOAD_GL_FUNC(glGetHistogram)
|
729
670
|
LOAD_GL_FUNC(glGetHistogramParameteriv)
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
671
|
+
numargs = rb_scan_args(argc, argv, "41", &args[0], &args[1], &args[2], &args[3], &args[4]);
|
672
|
+
target = (GLenum)NUM2INT(args[0]);
|
673
|
+
reset = (GLboolean)NUM2INT(args[1]);
|
674
|
+
format = (GLenum)NUM2INT(args[2]);
|
675
|
+
type = (GLenum)NUM2INT(args[3]);
|
676
|
+
|
677
|
+
switch(numargs) {
|
678
|
+
default:
|
679
|
+
case 4:
|
680
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
681
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
682
|
+
|
683
|
+
fptr_glGetHistogramParameteriv(target,GL_HISTOGRAM_WIDTH,&size);
|
684
|
+
data = allocate_buffer_with_string(GetDataSize(type,format,size));
|
685
|
+
FORCE_PIXEL_STORE_MODE
|
686
|
+
fptr_glGetHistogram(target,reset,format,type,(GLvoid*)RSTRING(data)->ptr);
|
687
|
+
RESTORE_PIXEL_STORE_MODE
|
688
|
+
return data;
|
689
|
+
break;
|
690
|
+
case 5:
|
691
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
692
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
693
|
+
|
694
|
+
FORCE_PIXEL_STORE_MODE
|
695
|
+
fptr_glGetHistogram(target,reset,format,type,(GLvoid*)NUM2INT(args[4]));
|
696
|
+
RESTORE_PIXEL_STORE_MODE
|
697
|
+
return Qnil;
|
698
|
+
}
|
748
699
|
}
|
749
700
|
|
750
701
|
static void (APIENTRY * fptr_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,GLvoid *);
|
751
702
|
static VALUE
|
752
|
-
gl_GetMinmax(
|
753
|
-
|
703
|
+
gl_GetMinmax(argc,argv,obj)
|
704
|
+
int argc;
|
705
|
+
VALUE *argv;
|
706
|
+
VALUE obj;
|
754
707
|
{
|
755
708
|
GLenum target;
|
756
709
|
GLboolean reset;
|
757
710
|
GLenum format;
|
758
711
|
GLenum type;
|
759
|
-
GLsizei format_size;
|
760
|
-
GLsizei type_size;
|
761
|
-
GLint size;
|
762
712
|
VALUE data;
|
713
|
+
VALUE args[5];
|
714
|
+
int numargs;
|
763
715
|
LOAD_GL_FUNC(glGetMinmax)
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
716
|
+
numargs = rb_scan_args(argc, argv, "41", &args[0], &args[1], &args[2], &args[3], &args[4]);
|
717
|
+
target = (GLenum)NUM2INT(args[0]);
|
718
|
+
reset = (GLboolean)NUM2INT(args[1]);
|
719
|
+
format = (GLenum)NUM2INT(args[2]);
|
720
|
+
type = (GLenum)NUM2INT(args[3]);
|
721
|
+
|
722
|
+
switch(numargs) {
|
723
|
+
default:
|
724
|
+
case 4:
|
725
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
726
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
727
|
+
|
728
|
+
data = allocate_buffer_with_string(GetDataSize(type,format,2));
|
729
|
+
FORCE_PIXEL_STORE_MODE
|
730
|
+
fptr_glGetMinmax(target,reset,format,type,(GLvoid*)RSTRING(data)->ptr);
|
731
|
+
RESTORE_PIXEL_STORE_MODE
|
732
|
+
return data;
|
733
|
+
break;
|
734
|
+
case 5:
|
735
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
736
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
737
|
+
|
738
|
+
FORCE_PIXEL_STORE_MODE
|
739
|
+
fptr_glGetMinmax(target,reset,format,type,(GLvoid*)NUM2INT(args[4]));
|
740
|
+
RESTORE_PIXEL_STORE_MODE
|
741
|
+
return Qnil;
|
742
|
+
}
|
781
743
|
}
|
782
744
|
|
783
745
|
static void (APIENTRY * fptr_glGetMinmaxParameterfv)(GLenum,GLenum,GLfloat *);
|
@@ -889,9 +851,6 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
|
889
851
|
GLenum format;
|
890
852
|
GLenum type;
|
891
853
|
const char *pixels;
|
892
|
-
int size;
|
893
|
-
int type_size;
|
894
|
-
int format_size;
|
895
854
|
LOAD_GL_FUNC(glTexImage3D)
|
896
855
|
target = (GLenum)NUM2INT(arg1);
|
897
856
|
level = (GLint)NUM2INT(arg2);
|
@@ -902,29 +861,23 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
|
902
861
|
border = (GLint)NUM2INT(arg7);
|
903
862
|
format = (GLenum)NUM2INT(arg8);
|
904
863
|
type = (GLenum)NUM2INT(arg9);
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
864
|
+
|
865
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
866
|
+
fptr_glTexImage3D( target, level, internalFormat, width, height,
|
867
|
+
depth, border, format, type,(GLvoid *)NUM2INT(arg10));
|
909
868
|
return Qnil;
|
910
|
-
|
911
|
-
size = format_size*((height*width*depth)/8);
|
912
|
-
else
|
913
|
-
size = type_size*format_size*height*width*depth;
|
869
|
+
}
|
914
870
|
|
915
|
-
if (target == GL_PROXY_TEXTURE_3D
|
871
|
+
if (target == GL_PROXY_TEXTURE_3D ||
|
872
|
+
target == GL_PROXY_TEXTURE_1D_STACK_MESAX ||
|
873
|
+
target == GL_PROXY_TEXTURE_2D_STACK_MESAX ||
|
874
|
+
target == GL_PROXY_TEXTURE_2D_ARRAY_EXT ||
|
875
|
+
NIL_P(arg10)) { /* proxy texture, no data read */
|
916
876
|
pixels = NULL;
|
917
877
|
} else {
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
if (RSTRING(arg10)->len < size)
|
922
|
-
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg10)->len);
|
923
|
-
pixels = RSTRING(arg10)->ptr;
|
924
|
-
} else {
|
925
|
-
Check_Type(arg10,T_STRING); /* force exception */
|
926
|
-
return Qnil;
|
927
|
-
}
|
878
|
+
Check_Type(arg10,T_STRING);
|
879
|
+
CheckDataSize(type,format,width*height*depth,arg10);
|
880
|
+
pixels = RSTRING(arg10)->ptr;
|
928
881
|
}
|
929
882
|
fptr_glTexImage3D( target, level, internalFormat, width, height,
|
930
883
|
depth, border, format, type,pixels);
|
@@ -946,10 +899,6 @@ VALUE arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
|
946
899
|
GLsizei depth;
|
947
900
|
GLenum format;
|
948
901
|
GLenum type;
|
949
|
-
const char *pixels;
|
950
|
-
int size;
|
951
|
-
int type_size;
|
952
|
-
int format_size;
|
953
902
|
LOAD_GL_FUNC(glTexSubImage3D)
|
954
903
|
target = (GLenum)NUM2INT(arg1);
|
955
904
|
level = (GLint)NUM2INT(arg2);
|
@@ -961,30 +910,17 @@ VALUE arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
|
961
910
|
depth = (GLsizei)NUM2UINT(arg8);
|
962
911
|
format = (GLenum)NUM2INT(arg9);
|
963
912
|
type = (GLenum)NUM2INT(arg10);
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
return Qnil;
|
969
|
-
if (type==GL_BITMAP)
|
970
|
-
size = format_size*((height*width*depth)/8);
|
971
|
-
else
|
972
|
-
size = type_size*format_size*height*width*depth;
|
973
|
-
|
974
|
-
if (TYPE(arg11) == T_STRING) {
|
975
|
-
if (RSTRING(arg11)->len < size)
|
976
|
-
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len);
|
977
|
-
pixels = RSTRING(arg11)->ptr;
|
978
|
-
} else if (TYPE(arg11) == T_FIXNUM || TYPE(arg11) == T_BIGNUM) { /* arg11 is offset to unpack buffer */
|
979
|
-
pixels = (const char *)NUM2UINT(arg11);
|
913
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
914
|
+
fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
|
915
|
+
width, height, depth,
|
916
|
+
format, type, (GLvoid *)NUM2INT(arg11));
|
980
917
|
} else {
|
981
|
-
Check_Type(arg11,T_STRING);
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
|
918
|
+
Check_Type(arg11, T_STRING);
|
919
|
+
CheckDataSize(type,format,height*width*depth,arg11);
|
920
|
+
fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
|
986
921
|
width, height, depth,
|
987
|
-
format, type,
|
922
|
+
format, type, RSTRING(arg11)->ptr);
|
923
|
+
}
|
988
924
|
return Qnil;
|
989
925
|
}
|
990
926
|
|
@@ -1040,15 +976,15 @@ void gl_init_functions_1_2(VALUE module)
|
|
1040
976
|
rb_define_module_function(module, "glConvolutionParameteriv", gl_ConvolutionParameteriv, 3);
|
1041
977
|
rb_define_module_function(module, "glCopyConvolutionFilter1D", gl_CopyConvolutionFilter1D, 5);
|
1042
978
|
rb_define_module_function(module, "glCopyConvolutionFilter2D", gl_CopyConvolutionFilter2D, 6);
|
1043
|
-
rb_define_module_function(module, "glGetConvolutionFilter", gl_GetConvolutionFilter,
|
979
|
+
rb_define_module_function(module, "glGetConvolutionFilter", gl_GetConvolutionFilter, -1);
|
1044
980
|
rb_define_module_function(module, "glGetConvolutionParameterfv", gl_GetConvolutionParameterfv, 2);
|
1045
981
|
rb_define_module_function(module, "glGetConvolutionParameteriv", gl_GetConvolutionParameteriv, 2);
|
1046
|
-
rb_define_module_function(module, "glGetSeparableFilter", gl_GetSeparableFilter,
|
982
|
+
rb_define_module_function(module, "glGetSeparableFilter", gl_GetSeparableFilter, -1);
|
1047
983
|
rb_define_module_function(module, "glSeparableFilter2D", gl_SeparableFilter2D, 8);
|
1048
|
-
rb_define_module_function(module, "glGetHistogram", gl_GetHistogram,
|
984
|
+
rb_define_module_function(module, "glGetHistogram", gl_GetHistogram, -1);
|
1049
985
|
rb_define_module_function(module, "glGetHistogramParameterfv", gl_GetHistogramParameterfv, 2);
|
1050
986
|
rb_define_module_function(module, "glGetHistogramParameteriv", gl_GetHistogramParameteriv, 2);
|
1051
|
-
rb_define_module_function(module, "glGetMinmax", gl_GetMinmax,
|
987
|
+
rb_define_module_function(module, "glGetMinmax", gl_GetMinmax, -1);
|
1052
988
|
rb_define_module_function(module, "glGetMinmaxParameterfv", gl_GetMinmaxParameterfv, 2);
|
1053
989
|
rb_define_module_function(module, "glGetMinmaxParameteriv", gl_GetMinmaxParameteriv, 2);
|
1054
990
|
rb_define_module_function(module, "glHistogram", gl_Histogram, 4);
|