ruby-opengl 0.33.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +42 -15
- data/doc/build_install.txt +70 -25
- data/doc/history.txt +4 -0
- data/doc/requirements_and_design.txt +2 -3
- data/doc/roadmap.txt +15 -2
- data/doc/screenshots.txt +23 -0
- data/doc/supplies/page_template.html +2 -1
- data/doc/thanks.txt +3 -0
- data/doc/tutorial.txt +5 -3
- data/examples/README +57 -7
- data/examples/legacy/COPYRIGHT +8 -0
- data/examples/{aaindex.rb → legacy/aaindex.rb} +6 -5
- data/examples/legacy/aapoly.rb +153 -0
- data/examples/legacy/aargb.rb +139 -0
- data/examples/legacy/accanti.rb +159 -0
- data/examples/legacy/accpersp.rb +216 -0
- data/examples/legacy/alpha.rb +133 -0
- data/examples/legacy/alpha3D.rb +165 -0
- data/examples/legacy/bezcurve.rb +107 -0
- data/examples/legacy/bezmesh.rb +131 -0
- data/examples/legacy/checker.rb +121 -0
- data/examples/legacy/clip.rb +104 -0
- data/examples/legacy/colormat.rb +145 -0
- data/examples/legacy/cube.rb +73 -0
- data/examples/legacy/depthcue.rb +101 -0
- data/examples/legacy/dof.rb +212 -0
- data/examples/legacy/double.rb +104 -0
- data/examples/legacy/drawf.rb +98 -0
- data/examples/legacy/feedback.rb +152 -0
- data/examples/legacy/fog.rb +172 -0
- data/examples/legacy/font-glut.rb +41 -0
- data/examples/legacy/font.rb +158 -0
- data/examples/legacy/hello.rb +75 -0
- data/examples/legacy/image.rb +145 -0
- data/examples/legacy/jitter.rb +209 -0
- data/examples/legacy/lines.rb +135 -0
- data/examples/legacy/list.rb +120 -0
- data/examples/legacy/material.rb +290 -0
- data/examples/legacy/mipmap.rb +159 -0
- data/examples/legacy/model.rb +119 -0
- data/examples/legacy/movelight.rb +140 -0
- data/examples/legacy/pickdepth.rb +180 -0
- data/examples/legacy/planet.rb +112 -0
- data/examples/legacy/quadric.rb +180 -0
- data/examples/legacy/readpixel.rb +59 -0
- data/examples/legacy/robot.rb +120 -0
- data/examples/legacy/select.rb +207 -0
- data/examples/{smooth_prev.rb → legacy/smooth.rb} +3 -2
- data/examples/legacy/stencil.rb +154 -0
- data/examples/legacy/stroke.rb +170 -0
- data/examples/legacy/surface.rb +170 -0
- data/examples/legacy/teaambient.rb +132 -0
- data/examples/legacy/teapots.rb +188 -0
- data/examples/legacy/tess.rb +222 -0
- data/examples/legacy/texbind.rb +157 -0
- data/examples/legacy/texgen.rb +171 -0
- data/examples/legacy/texturesurf.rb +128 -0
- data/examples/legacy/varray.rb +167 -0
- data/examples/legacy/wrap.rb +158 -0
- data/examples/nehe_lesson02.rb +117 -0
- data/examples/nehe_lesson03.rb +122 -0
- data/examples/nehe_lesson04.rb +133 -0
- data/examples/nehe_lesson05.rb +186 -0
- data/examples/plane.rb +1 -1
- data/examples/smooth.rb +4 -2
- data/examples/test.rb +3 -2
- data/ext/common/{rbogl.c → common.h} +99 -32
- data/ext/common/gl-enums.h +39 -1
- data/ext/gl/gl-1.0-1.1.c +350 -305
- data/ext/gl/gl-1.2.c +933 -38
- data/ext/gl/gl-1.3.c +725 -0
- data/ext/gl/gl-1.4.c +647 -0
- data/ext/gl/gl-1.5.c +362 -0
- data/ext/gl/gl-2.0.c +1632 -0
- data/ext/gl/gl-2.1.c +154 -0
- data/ext/gl/gl-enums.c +1 -2
- data/ext/gl/gl.c +58 -2
- data/ext/gl/mkrf_conf.rb +4 -1
- data/ext/glu/glu.c +5 -4
- data/ext/glu/mkrf_conf.rb +4 -1
- data/ext/glut/glut.c +7 -1
- data/ext/glut/mkrf_conf.rb +5 -0
- data/lib/gl_prev.rb +4 -3
- data/lib/glu_prev.rb +4 -3
- data/lib/glut_prev.rb +3 -3
- data/{examples/all_tests.rb → lib/opengl.rb} +9 -12
- data/test/README +5 -18
- data/test/tc_common.rb +79 -0
- data/test/tc_func_10_11.rb +1255 -0
- data/test/tc_func_12.rb +186 -0
- data/test/tc_func_13.rb +203 -0
- data/test/tc_func_14.rb +197 -0
- data/test/tc_func_15.rb +82 -0
- data/test/tc_func_20.rb +320 -0
- data/test/tc_func_21.rb +67 -0
- data/test/tc_include_gl.rb +1 -1
- data/test/{tc_opengl_namespace.rb → tc_misc.rb} +20 -20
- data/test/tc_require_gl.rb +1 -1
- metadata +99 -27
- data/ext/common/Rakefile +0 -39
- data/ext/common/rbogl.h +0 -52
- data/test/runtests.sh +0 -7
- data/test/tc_gl_vertex.rb +0 -180
data/ext/gl/gl-1.2.c
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
|
3
3
|
* Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
|
4
|
+
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
4
5
|
*
|
5
6
|
* This program is distributed under the terms of the MIT license.
|
6
7
|
* See the included MIT-LICENSE file for the terms of this license.
|
@@ -22,13 +23,42 @@
|
|
22
23
|
#else
|
23
24
|
#include <GL/gl.h>
|
24
25
|
#endif
|
25
|
-
#include "../common/
|
26
|
-
#include "../common/gl-enums.h"
|
26
|
+
#include "../common/common.h"
|
27
27
|
|
28
28
|
/* OpenGL 1.2 functions */
|
29
29
|
|
30
|
-
|
31
|
-
VALUE
|
30
|
+
static void (APIENTRY * fptr_glBlendColor)(GLclampf,GLclampf,GLclampf,GLclampf);
|
31
|
+
static VALUE
|
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
|
+
}
|
59
|
+
|
60
|
+
static void (APIENTRY * fptr_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,GLvoid*);
|
61
|
+
static VALUE
|
32
62
|
gl_DrawRangeElements(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
33
63
|
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
34
64
|
{
|
@@ -37,16 +67,815 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
|
37
67
|
GLuint end;
|
38
68
|
GLsizei count;
|
39
69
|
GLenum type;
|
70
|
+
LOAD_GL_FUNC(glDrawRangeElements)
|
40
71
|
mode = (GLenum)NUM2INT(arg1);
|
41
|
-
start = (GLuint)
|
42
|
-
end = (GLuint)
|
43
|
-
count = (GLsizei)
|
72
|
+
start = (GLuint)NUM2UINT(arg2);
|
73
|
+
end = (GLuint)NUM2UINT(arg3);
|
74
|
+
count = (GLsizei)NUM2UINT(arg4);
|
44
75
|
type = (GLenum)NUM2INT(arg5);
|
45
76
|
Check_Type(arg6, T_STRING);
|
46
|
-
|
77
|
+
fptr_glDrawRangeElements(mode, start, end, count, type, RSTRING(arg6)->ptr);
|
78
|
+
return Qnil;
|
79
|
+
}
|
80
|
+
|
81
|
+
static void (APIENTRY * fptr_glColorTable)(GLenum,GLenum,GLsizei,GLenum,GLenum,GLvoid*);
|
82
|
+
static VALUE
|
83
|
+
gl_ColorTable(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
84
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
85
|
+
{
|
86
|
+
GLenum target;
|
87
|
+
GLenum internalformat;
|
88
|
+
GLsizei width;
|
89
|
+
GLenum format;
|
90
|
+
GLenum type;
|
91
|
+
GLsizei format_size;
|
92
|
+
GLsizei type_size;
|
93
|
+
GLsizei size;
|
94
|
+
LOAD_GL_FUNC(glColorTable)
|
95
|
+
target = (GLenum)NUM2INT(arg1);
|
96
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
97
|
+
width = (GLsizei)NUM2UINT(arg3);
|
98
|
+
format = (GLenum)NUM2INT(arg4);
|
99
|
+
type = (GLenum)NUM2INT(arg5);
|
100
|
+
Check_Type(arg6,T_STRING);
|
101
|
+
format_size = glformat_size(format);
|
102
|
+
type_size = gltype_size(type);
|
103
|
+
if (type_size == -1 || format_size == -1)
|
104
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
105
|
+
size = format_size*type_size*width;
|
106
|
+
if (RSTRING(arg6)->len < size)
|
107
|
+
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len);
|
108
|
+
fptr_glColorTable(target,internalformat,width,format,type,RSTRING(arg6)->ptr);
|
109
|
+
return Qnil;
|
110
|
+
}
|
111
|
+
|
112
|
+
static void (APIENTRY * fptr_glColorTableParameterfv)(GLenum,GLenum,const GLfloat*);
|
113
|
+
static VALUE
|
114
|
+
gl_ColorTableParameterfv(obj,arg1,arg2,arg3)
|
115
|
+
VALUE obj,arg1,arg2,arg3;
|
116
|
+
{
|
117
|
+
GLenum target;
|
118
|
+
GLenum pname;
|
119
|
+
GLfloat params[4] = {0.0,0.0,0.0,0.0};
|
120
|
+
LOAD_GL_FUNC(glColorTableParameterfv)
|
121
|
+
target = (GLenum)NUM2INT(arg1);
|
122
|
+
pname = (GLenum)NUM2INT(arg2);
|
123
|
+
Check_Type(arg3,T_ARRAY);
|
124
|
+
ary2cflt(arg3,params,4);
|
125
|
+
fptr_glColorTableParameterfv(target,pname,params);
|
126
|
+
return Qnil;
|
127
|
+
}
|
128
|
+
|
129
|
+
static void (APIENTRY * fptr_glColorTableParameteriv)(GLenum,GLenum,const GLint*);
|
130
|
+
static VALUE
|
131
|
+
gl_ColorTableParameteriv(obj,arg1,arg2,arg3)
|
132
|
+
VALUE obj,arg1,arg2,arg3;
|
133
|
+
{
|
134
|
+
GLenum target;
|
135
|
+
GLenum pname;
|
136
|
+
GLint params[4] = {0,0,0,0};
|
137
|
+
LOAD_GL_FUNC(glColorTableParameteriv)
|
138
|
+
target = (GLenum)NUM2INT(arg1);
|
139
|
+
pname = (GLenum)NUM2INT(arg2);
|
140
|
+
Check_Type(arg3,T_ARRAY);
|
141
|
+
ary2cint(arg3,params,4);
|
142
|
+
fptr_glColorTableParameteriv(target,pname,params);
|
143
|
+
return Qnil;
|
144
|
+
}
|
145
|
+
|
146
|
+
static void (APIENTRY * fptr_glCopyColorTable)(GLenum,GLenum,GLint,GLint,GLsizei);
|
147
|
+
static VALUE
|
148
|
+
gl_CopyColorTable(obj,arg1,arg2,arg3,arg4,arg5)
|
149
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
150
|
+
{
|
151
|
+
GLenum target;
|
152
|
+
GLenum internalformat;
|
153
|
+
GLint x;
|
154
|
+
GLint y;
|
155
|
+
GLsizei width;
|
156
|
+
LOAD_GL_FUNC(glCopyColorTable)
|
157
|
+
target = (GLenum)NUM2INT(arg1);
|
158
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
159
|
+
x = (GLenum)NUM2INT(arg3);
|
160
|
+
y = (GLenum)NUM2INT(arg4);
|
161
|
+
width = (GLenum)NUM2INT(arg5);
|
162
|
+
fptr_glCopyColorTable(target,internalformat,x,y,width);
|
163
|
+
return Qnil;
|
164
|
+
}
|
165
|
+
|
166
|
+
static void (APIENTRY * fptr_glGetColorTableParameterfv)(GLenum,GLenum,GLfloat *);
|
167
|
+
static VALUE
|
168
|
+
gl_GetColorTableParameterfv(obj,arg1,arg2)
|
169
|
+
VALUE obj,arg1,arg2;
|
170
|
+
{
|
171
|
+
GLenum target;
|
172
|
+
GLenum pname;
|
173
|
+
GLfloat params[4] = {0.0,0.0,0.0,0.0};
|
174
|
+
GLsizei size;
|
175
|
+
VALUE retary;
|
176
|
+
int i;
|
177
|
+
LOAD_GL_FUNC(glGetColorTableParameterfv)
|
178
|
+
target = (GLenum)NUM2INT(arg1);
|
179
|
+
pname = (GLenum)NUM2INT(arg2);
|
180
|
+
switch (pname) {
|
181
|
+
case GL_COLOR_TABLE_SCALE:
|
182
|
+
case GL_COLOR_TABLE_BIAS:
|
183
|
+
size = 4;
|
184
|
+
break;
|
185
|
+
default:
|
186
|
+
size = 1;
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
fptr_glGetColorTableParameterfv(target,pname,params);
|
190
|
+
retary = rb_ary_new2(size);
|
191
|
+
for(i=0;i<size;i++)
|
192
|
+
rb_ary_push(retary, rb_float_new(params[i]));
|
193
|
+
return retary;
|
194
|
+
}
|
195
|
+
|
196
|
+
static void (APIENTRY * fptr_glGetColorTableParameteriv)(GLenum,GLenum,GLint *);
|
197
|
+
static VALUE
|
198
|
+
gl_GetColorTableParameteriv(obj,arg1,arg2)
|
199
|
+
VALUE obj,arg1,arg2;
|
200
|
+
{
|
201
|
+
GLenum target;
|
202
|
+
GLenum pname;
|
203
|
+
GLint params[4] = {0,0,0,0};
|
204
|
+
GLsizei size;
|
205
|
+
VALUE retary;
|
206
|
+
int i;
|
207
|
+
LOAD_GL_FUNC(glGetColorTableParameteriv)
|
208
|
+
target = (GLenum)NUM2INT(arg1);
|
209
|
+
pname = (GLenum)NUM2INT(arg2);
|
210
|
+
switch (pname) {
|
211
|
+
case GL_COLOR_TABLE_SCALE:
|
212
|
+
case GL_COLOR_TABLE_BIAS:
|
213
|
+
size = 4;
|
214
|
+
break;
|
215
|
+
default:
|
216
|
+
size = 1;
|
217
|
+
break;
|
218
|
+
}
|
219
|
+
fptr_glGetColorTableParameteriv(target,pname,params);
|
220
|
+
retary = rb_ary_new2(size);
|
221
|
+
for(i=0;i<size;i++)
|
222
|
+
rb_ary_push(retary, INT2NUM(params[i]));
|
223
|
+
return retary;
|
224
|
+
}
|
225
|
+
|
226
|
+
static void (APIENTRY * fptr_glGetColorTable)(GLenum,GLenum,GLenum,GLvoid *);
|
227
|
+
static VALUE
|
228
|
+
gl_GetColorTable(obj,arg1,arg2,arg3)
|
229
|
+
VALUE obj,arg1,arg2,arg3;
|
230
|
+
{
|
231
|
+
GLenum target;
|
232
|
+
GLenum format;
|
233
|
+
GLenum type;
|
234
|
+
GLsizei format_size;
|
235
|
+
GLsizei type_size;
|
236
|
+
GLsizei size;
|
237
|
+
GLsizei width = 0;
|
238
|
+
VALUE data;
|
239
|
+
LOAD_GL_FUNC(glGetColorTable)
|
240
|
+
LOAD_GL_FUNC(glGetColorTableParameteriv)
|
241
|
+
target = (GLenum)NUM2INT(arg1);
|
242
|
+
format = (GLenum)NUM2INT(arg2);
|
243
|
+
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
|
+
fptr_glGetColorTableParameteriv(target,GL_COLOR_TABLE_WIDTH,&width);
|
249
|
+
if (type==GL_BITMAP)
|
250
|
+
size = format_size*(width/8);
|
251
|
+
else
|
252
|
+
size = type_size*format_size*width;
|
253
|
+
data = allocate_buffer_with_string(size);
|
254
|
+
FORCE_PIXEL_STORE_MODE
|
255
|
+
fptr_glGetColorTable(target,format,type,(GLvoid*)RSTRING(data)->ptr);
|
256
|
+
RESTORE_PIXEL_STORE_MODE
|
257
|
+
return data;
|
258
|
+
}
|
259
|
+
|
260
|
+
static void (APIENTRY * fptr_glColorSubTable)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *data);
|
261
|
+
static VALUE
|
262
|
+
gl_ColorSubTable(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
263
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
264
|
+
{
|
265
|
+
GLenum target;
|
266
|
+
GLsizei start;
|
267
|
+
GLsizei count;
|
268
|
+
GLenum format;
|
269
|
+
GLenum type;
|
270
|
+
GLsizei format_size;
|
271
|
+
GLsizei type_size;
|
272
|
+
GLsizei size;
|
273
|
+
LOAD_GL_FUNC(glColorSubTable)
|
274
|
+
target = (GLenum)NUM2INT(arg1);
|
275
|
+
start = (GLsizei)NUM2UINT(arg2);
|
276
|
+
count = (GLsizei)NUM2UINT(arg3);
|
277
|
+
format = (GLenum)NUM2INT(arg4);
|
278
|
+
type = (GLenum)NUM2INT(arg5);
|
279
|
+
Check_Type(arg6,T_STRING);
|
280
|
+
format_size = glformat_size(format);
|
281
|
+
type_size = gltype_size(type);
|
282
|
+
if (type_size == -1 || format_size == -1)
|
283
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
284
|
+
size = format_size*type_size*count;
|
285
|
+
if (RSTRING(arg6)->len < size)
|
286
|
+
rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len);
|
287
|
+
fptr_glColorSubTable(target,start,count,format,type,RSTRING(arg6)->ptr);
|
288
|
+
return Qnil;
|
289
|
+
}
|
290
|
+
|
291
|
+
static void (APIENTRY * fptr_glCopyColorSubTable)(GLenum,GLsizei,GLint,GLint,GLsizei);
|
292
|
+
static VALUE
|
293
|
+
gl_CopyColorSubTable(obj,arg1,arg2,arg3,arg4,arg5)
|
294
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
295
|
+
{
|
296
|
+
GLenum target;
|
297
|
+
GLsizei start;
|
298
|
+
GLint x;
|
299
|
+
GLint y;
|
300
|
+
GLsizei width;
|
301
|
+
LOAD_GL_FUNC(glCopyColorSubTable)
|
302
|
+
target = (GLenum)NUM2INT(arg1);
|
303
|
+
start = (GLsizei)NUM2UINT(arg2);
|
304
|
+
x = (GLint)NUM2INT(arg3);
|
305
|
+
y = (GLint)NUM2INT(arg4);
|
306
|
+
width = (GLsizei)NUM2UINT(arg5);
|
307
|
+
fptr_glCopyColorSubTable(target,start,x,y,width);
|
308
|
+
return Qnil;
|
309
|
+
}
|
310
|
+
|
311
|
+
static void (APIENTRY * fptr_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid *);
|
312
|
+
static VALUE
|
313
|
+
gl_ConvolutionFilter1D(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
314
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
315
|
+
{
|
316
|
+
GLenum target;
|
317
|
+
GLenum internalformat;
|
318
|
+
GLsizei width;
|
319
|
+
GLenum format;
|
320
|
+
GLenum type;
|
321
|
+
GLsizei format_size;
|
322
|
+
GLsizei type_size;
|
323
|
+
GLsizei size;
|
324
|
+
LOAD_GL_FUNC(glConvolutionFilter1D)
|
325
|
+
target = (GLenum)NUM2INT(arg1);
|
326
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
327
|
+
width = (GLsizei)NUM2UINT(arg3);
|
328
|
+
format = (GLenum)NUM2INT(arg4);
|
329
|
+
type = (GLenum)NUM2INT(arg5);
|
330
|
+
Check_Type(arg6,T_STRING);
|
331
|
+
format_size = glformat_size(format);
|
332
|
+
type_size = gltype_size(type);
|
333
|
+
if (type_size == -1 || format_size == -1)
|
334
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
335
|
+
if (type==GL_BITMAP)
|
336
|
+
size = format_size*(width/8);
|
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);
|
342
|
+
return Qnil;
|
343
|
+
}
|
344
|
+
|
345
|
+
static void (APIENTRY * fptr_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *);
|
346
|
+
static VALUE
|
347
|
+
gl_ConvolutionFilter2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
348
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
349
|
+
{
|
350
|
+
GLenum target;
|
351
|
+
GLenum internalformat;
|
352
|
+
GLsizei width;
|
353
|
+
GLsizei height;
|
354
|
+
GLenum format;
|
355
|
+
GLenum type;
|
356
|
+
GLsizei format_size;
|
357
|
+
GLsizei type_size;
|
358
|
+
GLsizei size;
|
359
|
+
LOAD_GL_FUNC(glConvolutionFilter2D)
|
360
|
+
target = (GLenum)NUM2INT(arg1);
|
361
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
362
|
+
width = (GLsizei)NUM2UINT(arg3);
|
363
|
+
height = (GLsizei)NUM2UINT(arg4);
|
364
|
+
format = (GLenum)NUM2INT(arg5);
|
365
|
+
type = (GLenum)NUM2INT(arg6);
|
366
|
+
Check_Type(arg7,T_STRING);
|
367
|
+
format_size = glformat_size(format);
|
368
|
+
type_size = gltype_size(type);
|
369
|
+
if (type_size == -1 || format_size == -1)
|
370
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
371
|
+
if (type==GL_BITMAP)
|
372
|
+
size = format_size*((width*height)/8);
|
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);
|
47
378
|
return Qnil;
|
48
379
|
}
|
49
|
-
|
380
|
+
|
381
|
+
static void (APIENTRY * fptr_glConvolutionParameterf)(GLenum,GLenum,GLfloat);
|
382
|
+
static VALUE
|
383
|
+
gl_ConvolutionParameterf(obj,arg1,arg2,arg3)
|
384
|
+
VALUE obj,arg1,arg2,arg3;
|
385
|
+
{
|
386
|
+
GLenum target;
|
387
|
+
GLenum pname;
|
388
|
+
GLfloat params;
|
389
|
+
LOAD_GL_FUNC(glConvolutionParameterf)
|
390
|
+
target = (GLenum)NUM2INT(arg1);
|
391
|
+
pname = (GLenum)NUM2INT(arg2);
|
392
|
+
params = (GLfloat)NUM2INT(arg3);
|
393
|
+
fptr_glConvolutionParameterf(target,pname,params);
|
394
|
+
return Qnil;
|
395
|
+
}
|
396
|
+
|
397
|
+
static void (APIENTRY * fptr_glConvolutionParameterfv)(GLenum,GLenum,const GLfloat *);
|
398
|
+
static VALUE
|
399
|
+
gl_ConvolutionParameterfv(obj,arg1,arg2,arg3)
|
400
|
+
VALUE obj,arg1,arg2,arg3;
|
401
|
+
{
|
402
|
+
GLenum target;
|
403
|
+
GLenum pname;
|
404
|
+
GLfloat params[4] = {0.0,0.0,0.0,0.0};
|
405
|
+
LOAD_GL_FUNC(glConvolutionParameterfv)
|
406
|
+
target = (GLenum)NUM2INT(arg1);
|
407
|
+
pname = (GLenum)NUM2INT(arg2);
|
408
|
+
Check_Type(arg3,T_ARRAY);
|
409
|
+
ary2cflt(arg3,params,4);
|
410
|
+
fptr_glConvolutionParameterfv(target,pname,params);
|
411
|
+
return Qnil;
|
412
|
+
}
|
413
|
+
|
414
|
+
static void (APIENTRY * fptr_glConvolutionParameteri)(GLenum,GLenum,GLint);
|
415
|
+
static VALUE
|
416
|
+
gl_ConvolutionParameteri(obj,arg1,arg2,arg3)
|
417
|
+
VALUE obj,arg1,arg2,arg3;
|
418
|
+
{
|
419
|
+
GLenum target;
|
420
|
+
GLenum pname;
|
421
|
+
GLint params;
|
422
|
+
LOAD_GL_FUNC(glConvolutionParameteri)
|
423
|
+
target = (GLenum)NUM2INT(arg1);
|
424
|
+
pname = (GLenum)NUM2INT(arg2);
|
425
|
+
params = (GLint)NUM2INT(arg3);
|
426
|
+
fptr_glConvolutionParameteri(target,pname,params);
|
427
|
+
return Qnil;
|
428
|
+
}
|
429
|
+
|
430
|
+
static void (APIENTRY * fptr_glConvolutionParameteriv)(GLenum,GLenum,const GLint *);
|
431
|
+
static VALUE
|
432
|
+
gl_ConvolutionParameteriv(obj,arg1,arg2,arg3)
|
433
|
+
VALUE obj,arg1,arg2,arg3;
|
434
|
+
{
|
435
|
+
GLenum target;
|
436
|
+
GLenum pname;
|
437
|
+
GLint params[4] = {0,0,0,0};
|
438
|
+
LOAD_GL_FUNC(glConvolutionParameteriv)
|
439
|
+
target = (GLenum)NUM2INT(arg1);
|
440
|
+
pname = (GLenum)NUM2INT(arg2);
|
441
|
+
Check_Type(arg3,T_ARRAY);
|
442
|
+
ary2cint(arg3,params,4);
|
443
|
+
fptr_glConvolutionParameteriv(target,pname,params);
|
444
|
+
return Qnil;
|
445
|
+
}
|
446
|
+
|
447
|
+
static void (APIENTRY * fptr_glCopyConvolutionFilter1D)(GLenum,GLenum,GLint,GLint,GLsizei);
|
448
|
+
static VALUE
|
449
|
+
gl_CopyConvolutionFilter1D(obj,arg1,arg2,arg3,arg4,arg5)
|
450
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
451
|
+
{
|
452
|
+
GLenum target;
|
453
|
+
GLenum internalformat;
|
454
|
+
GLint x;
|
455
|
+
GLint y;
|
456
|
+
GLsizei width;
|
457
|
+
LOAD_GL_FUNC(glCopyConvolutionFilter1D)
|
458
|
+
target = (GLenum)NUM2INT(arg1);
|
459
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
460
|
+
x = (GLint)NUM2INT(arg3);
|
461
|
+
y = (GLint)NUM2INT(arg4);
|
462
|
+
width = (GLsizei)NUM2UINT(arg5);
|
463
|
+
fptr_glCopyConvolutionFilter1D(target,internalformat,x,y,width);
|
464
|
+
return Qnil;
|
465
|
+
}
|
466
|
+
|
467
|
+
static void (APIENTRY * fptr_glCopyConvolutionFilter2D)(GLenum,GLenum,GLint,GLint,GLsizei,GLsizei);
|
468
|
+
static VALUE
|
469
|
+
gl_CopyConvolutionFilter2D(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
470
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
471
|
+
{
|
472
|
+
GLenum target;
|
473
|
+
GLenum internalformat;
|
474
|
+
GLint x;
|
475
|
+
GLint y;
|
476
|
+
GLsizei width;
|
477
|
+
GLsizei height;
|
478
|
+
LOAD_GL_FUNC(glCopyConvolutionFilter2D)
|
479
|
+
target = (GLenum)NUM2INT(arg1);
|
480
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
481
|
+
x = (GLint)NUM2INT(arg3);
|
482
|
+
y = (GLint)NUM2INT(arg4);
|
483
|
+
width = (GLsizei)NUM2UINT(arg5);
|
484
|
+
height = (GLsizei)NUM2UINT(arg6);
|
485
|
+
fptr_glCopyConvolutionFilter2D(target,internalformat,x,y,width,height);
|
486
|
+
return Qnil;
|
487
|
+
}
|
488
|
+
|
489
|
+
static void (APIENTRY * fptr_glGetConvolutionParameterfv)(GLenum,GLenum,GLfloat *);
|
490
|
+
static VALUE
|
491
|
+
gl_GetConvolutionParameterfv(obj,arg1,arg2)
|
492
|
+
VALUE obj,arg1,arg2;
|
493
|
+
{
|
494
|
+
GLenum target;
|
495
|
+
GLenum pname;
|
496
|
+
GLfloat params[4] = {0.0,0.0,0.0,0.0};
|
497
|
+
GLsizei size;
|
498
|
+
int i;
|
499
|
+
VALUE retary;
|
500
|
+
LOAD_GL_FUNC(glGetConvolutionParameterfv)
|
501
|
+
target = (GLenum)NUM2INT(arg1);
|
502
|
+
pname = (GLenum)NUM2INT(arg2);
|
503
|
+
switch(pname) {
|
504
|
+
case GL_CONVOLUTION_BORDER_COLOR:
|
505
|
+
case GL_CONVOLUTION_FILTER_SCALE:
|
506
|
+
case GL_CONVOLUTION_FILTER_BIAS:
|
507
|
+
size = 4;
|
508
|
+
break;
|
509
|
+
default:
|
510
|
+
size = 1;
|
511
|
+
break;
|
512
|
+
}
|
513
|
+
fptr_glGetConvolutionParameterfv(target,pname,params);
|
514
|
+
retary = rb_ary_new2(size);
|
515
|
+
for(i=0;i<size;i++)
|
516
|
+
rb_ary_push(retary, rb_float_new(params[i]));
|
517
|
+
return retary;
|
518
|
+
}
|
519
|
+
|
520
|
+
static void (APIENTRY * fptr_glGetConvolutionParameteriv)(GLenum,GLenum,GLint *);
|
521
|
+
static VALUE
|
522
|
+
gl_GetConvolutionParameteriv(obj,arg1,arg2)
|
523
|
+
VALUE obj,arg1,arg2;
|
524
|
+
{
|
525
|
+
GLenum target;
|
526
|
+
GLenum pname;
|
527
|
+
GLint params[4] = {0,0,0,0};
|
528
|
+
GLsizei size;
|
529
|
+
int i;
|
530
|
+
VALUE retary;
|
531
|
+
LOAD_GL_FUNC(glGetConvolutionParameteriv)
|
532
|
+
target = (GLenum)NUM2INT(arg1);
|
533
|
+
pname = (GLenum)NUM2INT(arg2);
|
534
|
+
switch(pname) {
|
535
|
+
case GL_CONVOLUTION_BORDER_COLOR:
|
536
|
+
case GL_CONVOLUTION_FILTER_SCALE:
|
537
|
+
case GL_CONVOLUTION_FILTER_BIAS:
|
538
|
+
size = 4;
|
539
|
+
break;
|
540
|
+
default:
|
541
|
+
size = 1;
|
542
|
+
break;
|
543
|
+
}
|
544
|
+
fptr_glGetConvolutionParameteriv(target,pname,params);
|
545
|
+
retary = rb_ary_new2(size);
|
546
|
+
for(i=0;i<size;i++)
|
547
|
+
rb_ary_push(retary, INT2NUM(params[i]));
|
548
|
+
return retary;
|
549
|
+
}
|
550
|
+
|
551
|
+
static void (APIENTRY * fptr_glGetConvolutionFilter)(GLenum,GLenum,GLenum,GLvoid *);
|
552
|
+
static VALUE
|
553
|
+
gl_GetConvolutionFilter(obj,arg1,arg2,arg3)
|
554
|
+
VALUE obj,arg1,arg2,arg3;
|
555
|
+
{
|
556
|
+
GLenum target;
|
557
|
+
GLenum format;
|
558
|
+
GLenum type;
|
559
|
+
GLsizei format_size;
|
560
|
+
GLsizei type_size;
|
561
|
+
GLint size = 0;
|
562
|
+
VALUE data;
|
563
|
+
LOAD_GL_FUNC(glGetConvolutionFilter)
|
564
|
+
LOAD_GL_FUNC(glGetConvolutionParameteriv)
|
565
|
+
target = (GLenum)NUM2INT(arg1);
|
566
|
+
format = (GLenum)NUM2INT(arg2);
|
567
|
+
type = (GLenum)NUM2INT(arg3);
|
568
|
+
format_size = glformat_size(format);
|
569
|
+
type_size = gltype_size(type);
|
570
|
+
if (type_size == -1 || format_size == -1)
|
571
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
572
|
+
if (target==GL_CONVOLUTION_1D) {
|
573
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&size);
|
574
|
+
} else {
|
575
|
+
GLint tmp = 0;
|
576
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&tmp);
|
577
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_HEIGHT,&size);
|
578
|
+
size *=tmp;
|
579
|
+
}
|
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
|
+
}
|
590
|
+
|
591
|
+
static void (APIENTRY * fptr_glGetSeparableFilter)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*);
|
592
|
+
static VALUE
|
593
|
+
gl_GetSeparableFilter(obj,arg1,arg2,arg3)
|
594
|
+
VALUE obj,arg1,arg2,arg3;
|
595
|
+
{
|
596
|
+
GLenum target;
|
597
|
+
GLenum format;
|
598
|
+
GLenum type;
|
599
|
+
GLsizei format_size;
|
600
|
+
GLsizei type_size;
|
601
|
+
GLint size_row = 0;
|
602
|
+
GLint size_column = 0;
|
603
|
+
VALUE data_row;
|
604
|
+
VALUE data_column;
|
605
|
+
VALUE retary;
|
606
|
+
LOAD_GL_FUNC(glGetSeparableFilter)
|
607
|
+
LOAD_GL_FUNC(glGetConvolutionParameteriv)
|
608
|
+
target = (GLenum)NUM2INT(arg1);
|
609
|
+
format = (GLenum)NUM2INT(arg2);
|
610
|
+
type = (GLenum)NUM2INT(arg3);
|
611
|
+
format_size = glformat_size(format);
|
612
|
+
type_size = gltype_size(type);
|
613
|
+
if (type_size == -1 || format_size == -1)
|
614
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
615
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&size_row);
|
616
|
+
fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_HEIGHT,&size_column);
|
617
|
+
if (type==GL_BITMAP) {
|
618
|
+
size_row = (size_row/8)*format_size;
|
619
|
+
size_column = (size_column/8)*format_size;
|
620
|
+
} else {
|
621
|
+
size_row *= type_size*format_size;
|
622
|
+
size_column *= type_size*format_size;
|
623
|
+
}
|
624
|
+
data_row = allocate_buffer_with_string(size_row);
|
625
|
+
data_column = allocate_buffer_with_string(size_column);
|
626
|
+
FORCE_PIXEL_STORE_MODE
|
627
|
+
fptr_glGetSeparableFilter(target,format,type,(GLvoid*)RSTRING(data_row)->ptr,(GLvoid*)RSTRING(data_column)->ptr,0);
|
628
|
+
RESTORE_PIXEL_STORE_MODE
|
629
|
+
retary = rb_ary_new2(2);
|
630
|
+
rb_ary_push(retary, data_row);
|
631
|
+
rb_ary_push(retary, data_column);
|
632
|
+
return retary;
|
633
|
+
}
|
634
|
+
|
635
|
+
static void (APIENTRY * fptr_glSeparableFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *,const GLvoid *);
|
636
|
+
static VALUE
|
637
|
+
gl_SeparableFilter2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
|
638
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
639
|
+
{
|
640
|
+
GLenum target;
|
641
|
+
GLenum internalformat;
|
642
|
+
GLsizei width;
|
643
|
+
GLsizei height;
|
644
|
+
GLenum format;
|
645
|
+
GLenum type;
|
646
|
+
GLsizei format_size;
|
647
|
+
GLsizei type_size;
|
648
|
+
GLsizei size_row;
|
649
|
+
GLsizei size_column;
|
650
|
+
LOAD_GL_FUNC(glSeparableFilter2D)
|
651
|
+
target = (GLenum)NUM2INT(arg1);
|
652
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
653
|
+
width = (GLsizei)NUM2UINT(arg3);
|
654
|
+
height = (GLsizei)NUM2UINT(arg4);
|
655
|
+
format = (GLenum)NUM2INT(arg5);
|
656
|
+
type = (GLenum)NUM2INT(arg6);
|
657
|
+
Check_Type(arg7,T_STRING);
|
658
|
+
Check_Type(arg8,T_STRING);
|
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);
|
666
|
+
} else {
|
667
|
+
size_row = type_size*format_size*width;
|
668
|
+
size_column = type_size*format_size*height;
|
669
|
+
}
|
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
|
+
return Qnil;
|
677
|
+
}
|
678
|
+
|
679
|
+
static void (APIENTRY * fptr_glGetHistogramParameterfv)(GLenum,GLenum,GLfloat *);
|
680
|
+
static VALUE
|
681
|
+
gl_GetHistogramParameterfv(obj,arg1,arg2,arg3)
|
682
|
+
VALUE obj,arg1,arg2,arg3;
|
683
|
+
{
|
684
|
+
GLenum target;
|
685
|
+
GLenum pname;
|
686
|
+
GLfloat params = 0.0;
|
687
|
+
VALUE retary;
|
688
|
+
LOAD_GL_FUNC(glGetHistogramParameterfv)
|
689
|
+
target = (GLenum)NUM2INT(arg1);
|
690
|
+
pname = (GLenum)NUM2INT(arg2);
|
691
|
+
fptr_glGetHistogramParameterfv(target,pname,¶ms);
|
692
|
+
retary = rb_ary_new2(1);
|
693
|
+
rb_ary_push(retary, rb_float_new(params));
|
694
|
+
return retary;
|
695
|
+
}
|
696
|
+
|
697
|
+
static void (APIENTRY * fptr_glGetHistogramParameteriv)(GLenum,GLenum,GLint *);
|
698
|
+
static VALUE
|
699
|
+
gl_GetHistogramParameteriv(obj,arg1,arg2,arg3)
|
700
|
+
VALUE obj,arg1,arg2,arg3;
|
701
|
+
{
|
702
|
+
GLenum target;
|
703
|
+
GLenum pname;
|
704
|
+
GLint params = 0;
|
705
|
+
VALUE retary;
|
706
|
+
LOAD_GL_FUNC(glGetHistogramParameteriv)
|
707
|
+
target = (GLenum)NUM2INT(arg1);
|
708
|
+
pname = (GLenum)NUM2INT(arg2);
|
709
|
+
fptr_glGetHistogramParameteriv(target,pname,¶ms);
|
710
|
+
retary = rb_ary_new2(1);
|
711
|
+
rb_ary_push(retary, INT2NUM(params));
|
712
|
+
return retary;
|
713
|
+
}
|
714
|
+
|
715
|
+
static void (APIENTRY * fptr_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,GLvoid*);
|
716
|
+
static VALUE
|
717
|
+
gl_GetHistogram(obj,arg1,arg2,arg3,arg4)
|
718
|
+
VALUE obj,arg1,arg2,arg3,arg4;
|
719
|
+
{
|
720
|
+
GLenum target;
|
721
|
+
GLboolean reset;
|
722
|
+
GLenum format;
|
723
|
+
GLenum type;
|
724
|
+
GLsizei format_size;
|
725
|
+
GLsizei type_size;
|
726
|
+
GLint size = 0;
|
727
|
+
VALUE data;
|
728
|
+
LOAD_GL_FUNC(glGetHistogram)
|
729
|
+
LOAD_GL_FUNC(glGetHistogramParameteriv)
|
730
|
+
target = (GLenum)NUM2INT(arg1);
|
731
|
+
reset = (GLboolean)NUM2INT(arg2);
|
732
|
+
format = (GLenum)NUM2INT(arg3);
|
733
|
+
type = (GLenum)NUM2INT(arg4);
|
734
|
+
format_size = glformat_size(format);
|
735
|
+
type_size = gltype_size(type);
|
736
|
+
if (type_size == -1 || format_size == -1)
|
737
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
738
|
+
fptr_glGetHistogramParameteriv(target,GL_HISTOGRAM_WIDTH,&size);
|
739
|
+
if (type==GL_BITMAP)
|
740
|
+
size = (size/8)*format_size;
|
741
|
+
else
|
742
|
+
size = size*type_size*format_size;
|
743
|
+
data = allocate_buffer_with_string(size);
|
744
|
+
FORCE_PIXEL_STORE_MODE
|
745
|
+
fptr_glGetHistogram(target,reset,format,type,(GLvoid*)RSTRING(data)->ptr);
|
746
|
+
RESTORE_PIXEL_STORE_MODE
|
747
|
+
return data;
|
748
|
+
}
|
749
|
+
|
750
|
+
static void (APIENTRY * fptr_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,GLvoid *);
|
751
|
+
static VALUE
|
752
|
+
gl_GetMinmax(obj,arg1,arg2,arg3,arg4)
|
753
|
+
VALUE obj,arg1,arg2,arg3,arg4;
|
754
|
+
{
|
755
|
+
GLenum target;
|
756
|
+
GLboolean reset;
|
757
|
+
GLenum format;
|
758
|
+
GLenum type;
|
759
|
+
GLsizei format_size;
|
760
|
+
GLsizei type_size;
|
761
|
+
GLint size;
|
762
|
+
VALUE data;
|
763
|
+
LOAD_GL_FUNC(glGetMinmax)
|
764
|
+
target = (GLenum)NUM2INT(arg1);
|
765
|
+
reset = (GLboolean)NUM2INT(arg2);
|
766
|
+
format = (GLenum)NUM2INT(arg3);
|
767
|
+
type = (GLenum)NUM2INT(arg4);
|
768
|
+
format_size = glformat_size(format);
|
769
|
+
type_size = gltype_size(type);
|
770
|
+
if (type_size == -1 || format_size == -1)
|
771
|
+
rb_raise(rb_eTypeError, "type/format mismatch");
|
772
|
+
if (type==GL_BITMAP)
|
773
|
+
size = format_size*(2/8);
|
774
|
+
else
|
775
|
+
size = type_size*format_size*2;
|
776
|
+
data = allocate_buffer_with_string(size);
|
777
|
+
FORCE_PIXEL_STORE_MODE
|
778
|
+
fptr_glGetMinmax(target,reset,format,type,(GLvoid*)RSTRING(data)->ptr);
|
779
|
+
RESTORE_PIXEL_STORE_MODE
|
780
|
+
return data;
|
781
|
+
}
|
782
|
+
|
783
|
+
static void (APIENTRY * fptr_glGetMinmaxParameterfv)(GLenum,GLenum,GLfloat *);
|
784
|
+
static VALUE
|
785
|
+
gl_GetMinmaxParameterfv(obj,arg1,arg2)
|
786
|
+
VALUE obj,arg1,arg2;
|
787
|
+
{
|
788
|
+
GLenum target;
|
789
|
+
GLenum pname;
|
790
|
+
GLfloat params = 0.0;
|
791
|
+
VALUE retary;
|
792
|
+
LOAD_GL_FUNC(glGetMinmaxParameterfv)
|
793
|
+
target = (GLenum)NUM2INT(arg1);
|
794
|
+
pname = (GLenum)NUM2INT(arg2);
|
795
|
+
fptr_glGetMinmaxParameterfv(target,pname,¶ms);
|
796
|
+
retary = rb_ary_new2(1);
|
797
|
+
rb_ary_push(retary, rb_float_new(params));
|
798
|
+
return retary;
|
799
|
+
}
|
800
|
+
|
801
|
+
static void (APIENTRY * fptr_glGetMinmaxParameteriv)(GLenum,GLenum,GLint *);
|
802
|
+
static VALUE
|
803
|
+
gl_GetMinmaxParameteriv(obj,arg1,arg2)
|
804
|
+
VALUE obj,arg1,arg2;
|
805
|
+
{
|
806
|
+
GLenum target;
|
807
|
+
GLenum pname;
|
808
|
+
GLint params = 0;
|
809
|
+
VALUE retary;
|
810
|
+
LOAD_GL_FUNC(glGetMinmaxParameteriv)
|
811
|
+
target = (GLenum)NUM2INT(arg1);
|
812
|
+
pname = (GLenum)NUM2INT(arg2);
|
813
|
+
fptr_glGetMinmaxParameteriv(target,pname,¶ms);
|
814
|
+
retary = rb_ary_new2(1);
|
815
|
+
rb_ary_push(retary, INT2NUM(params));
|
816
|
+
return retary;
|
817
|
+
}
|
818
|
+
|
819
|
+
static void (APIENTRY * fptr_glHistogram)(GLenum,GLsizei,GLenum,GLboolean);
|
820
|
+
static VALUE
|
821
|
+
gl_Histogram(obj,arg1,arg2,arg3,arg4)
|
822
|
+
VALUE obj,arg1,arg2,arg3,arg4;
|
823
|
+
{
|
824
|
+
GLenum target;
|
825
|
+
GLsizei width;
|
826
|
+
GLenum internalformat;
|
827
|
+
GLboolean sink;
|
828
|
+
LOAD_GL_FUNC(glHistogram)
|
829
|
+
target = (GLenum)NUM2INT(arg1);
|
830
|
+
width = (GLsizei)NUM2UINT(arg2);
|
831
|
+
internalformat = (GLenum)NUM2INT(arg3);
|
832
|
+
sink = (GLboolean)NUM2INT(arg4);
|
833
|
+
fptr_glHistogram(target,width,internalformat,sink);
|
834
|
+
return Qnil;
|
835
|
+
}
|
836
|
+
|
837
|
+
static void (APIENTRY * fptr_glMinmax)(GLenum,GLenum,GLboolean);
|
838
|
+
static VALUE
|
839
|
+
gl_Minmax(obj,arg1,arg2,arg3)
|
840
|
+
VALUE obj,arg1,arg2,arg3;
|
841
|
+
{
|
842
|
+
GLenum target;
|
843
|
+
GLenum internalformat;
|
844
|
+
GLboolean sink;
|
845
|
+
LOAD_GL_FUNC(glMinmax)
|
846
|
+
target = (GLenum)NUM2INT(arg1);
|
847
|
+
internalformat = (GLenum)NUM2INT(arg2);
|
848
|
+
sink = (GLboolean)NUM2INT(arg3);
|
849
|
+
fptr_glMinmax(target,internalformat,sink);
|
850
|
+
return Qnil;
|
851
|
+
}
|
852
|
+
|
853
|
+
static void (APIENTRY * fptr_glResetHistogram)(GLenum);
|
854
|
+
static VALUE
|
855
|
+
gl_ResetHistogram(obj,arg1)
|
856
|
+
VALUE obj,arg1;
|
857
|
+
{
|
858
|
+
GLenum target;
|
859
|
+
LOAD_GL_FUNC(glResetHistogram)
|
860
|
+
target = (GLenum)NUM2INT(arg1);
|
861
|
+
fptr_glResetHistogram(target);
|
862
|
+
return Qnil;
|
863
|
+
}
|
864
|
+
|
865
|
+
static void (APIENTRY * fptr_glResetMinmax)(GLenum);
|
866
|
+
static VALUE
|
867
|
+
gl_ResetMinmax(obj,arg1)
|
868
|
+
VALUE obj,arg1;
|
869
|
+
{
|
870
|
+
GLenum target;
|
871
|
+
LOAD_GL_FUNC(glResetMinmax)
|
872
|
+
target = (GLenum)NUM2INT(arg1);
|
873
|
+
fptr_glResetMinmax(target);
|
874
|
+
return Qnil;
|
875
|
+
}
|
876
|
+
|
877
|
+
static void (APIENTRY * fptr_glTexImage3D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*);
|
878
|
+
static VALUE
|
50
879
|
gl_TexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
|
51
880
|
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
52
881
|
{
|
@@ -59,32 +888,51 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
|
59
888
|
GLint border;
|
60
889
|
GLenum format;
|
61
890
|
GLenum type;
|
891
|
+
const char *pixels;
|
62
892
|
int size;
|
63
893
|
int type_size;
|
64
894
|
int format_size;
|
895
|
+
LOAD_GL_FUNC(glTexImage3D)
|
65
896
|
target = (GLenum)NUM2INT(arg1);
|
66
897
|
level = (GLint)NUM2INT(arg2);
|
67
898
|
internalFormat = (GLint)NUM2INT(arg3);
|
68
|
-
width = (GLsizei)
|
69
|
-
height = (GLsizei)
|
70
|
-
depth = (GLsizei)
|
899
|
+
width = (GLsizei)NUM2UINT(arg4);
|
900
|
+
height = (GLsizei)NUM2UINT(arg5);
|
901
|
+
depth = (GLsizei)NUM2UINT(arg6);
|
71
902
|
border = (GLint)NUM2INT(arg7);
|
72
903
|
format = (GLenum)NUM2INT(arg8);
|
73
904
|
type = (GLenum)NUM2INT(arg9);
|
74
905
|
Check_Type(arg10, T_STRING);
|
75
|
-
type_size = gltype_size(type)
|
906
|
+
type_size = gltype_size(type);
|
76
907
|
format_size = glformat_size(format);
|
77
908
|
if (type_size == -1 || format_size == -1)
|
78
909
|
return Qnil;
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
910
|
+
if (type==GL_BITMAP)
|
911
|
+
size = format_size*((height*width*depth)/8);
|
912
|
+
else
|
913
|
+
size = type_size*format_size*height*width*depth;
|
914
|
+
|
915
|
+
if (target == GL_PROXY_TEXTURE_3D || NIL_P(arg10)) { /* proxy texture, no data read */
|
916
|
+
pixels = NULL;
|
917
|
+
} else {
|
918
|
+
if (TYPE(arg10) == T_FIXNUM || TYPE(arg10) == T_BIGNUM) { /* arg10 is offset to unpack buffer */
|
919
|
+
pixels = (const char *)NUM2UINT(arg10);
|
920
|
+
} else if (TYPE(arg10) == T_STRING) { /* image data */
|
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
|
+
}
|
928
|
+
}
|
929
|
+
fptr_glTexImage3D( target, level, internalFormat, width, height,
|
930
|
+
depth, border, format, type,pixels);
|
85
931
|
return Qnil;
|
86
932
|
}
|
87
|
-
|
933
|
+
|
934
|
+
static void (APIENTRY * fptr_glTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
|
935
|
+
static VALUE
|
88
936
|
gl_TexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
|
89
937
|
VALUE arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
90
938
|
{
|
@@ -98,33 +946,50 @@ VALUE arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
|
98
946
|
GLsizei depth;
|
99
947
|
GLenum format;
|
100
948
|
GLenum type;
|
949
|
+
const char *pixels;
|
101
950
|
int size;
|
102
951
|
int type_size;
|
103
952
|
int format_size;
|
953
|
+
LOAD_GL_FUNC(glTexSubImage3D)
|
104
954
|
target = (GLenum)NUM2INT(arg1);
|
105
955
|
level = (GLint)NUM2INT(arg2);
|
106
956
|
xoffset = (GLint)NUM2INT(arg3);
|
107
957
|
yoffset = (GLint)NUM2INT(arg4);
|
108
958
|
zoffset = (GLint)NUM2INT(arg5);
|
109
|
-
width = (GLsizei)
|
110
|
-
height = (GLsizei)
|
111
|
-
depth = (GLsizei)
|
959
|
+
width = (GLsizei)NUM2UINT(arg6);
|
960
|
+
height = (GLsizei)NUM2UINT(arg7);
|
961
|
+
depth = (GLsizei)NUM2UINT(arg8);
|
112
962
|
format = (GLenum)NUM2INT(arg9);
|
113
963
|
type = (GLenum)NUM2INT(arg10);
|
114
964
|
Check_Type(arg11, T_STRING);
|
115
|
-
type_size = gltype_size(type)
|
965
|
+
type_size = gltype_size(type);
|
116
966
|
format_size = glformat_size(format);
|
117
967
|
if (type_size == -1 || format_size == -1)
|
118
968
|
return Qnil;
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
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);
|
980
|
+
} else {
|
981
|
+
Check_Type(arg11,T_STRING); /* force exception */
|
982
|
+
return Qnil;
|
983
|
+
}
|
984
|
+
|
985
|
+
fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
|
123
986
|
width, height, depth,
|
124
|
-
format, type,
|
987
|
+
format, type, pixels);
|
125
988
|
return Qnil;
|
126
989
|
}
|
127
|
-
|
990
|
+
|
991
|
+
static void (APIENTRY * fptr_glCopyTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei);
|
992
|
+
static VALUE
|
128
993
|
gl_CopyTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
129
994
|
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
130
995
|
{
|
@@ -137,6 +1002,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
137
1002
|
GLint y;
|
138
1003
|
GLsizei width;
|
139
1004
|
GLsizei height;
|
1005
|
+
LOAD_GL_FUNC(glCopyTexSubImage3D)
|
140
1006
|
target = (GLenum)NUM2INT(arg1);
|
141
1007
|
level = (GLint)NUM2INT(arg2);
|
142
1008
|
xoffset = (GLint)NUM2INT(arg3);
|
@@ -144,23 +1010,52 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
|
144
1010
|
zoffset = (GLint)NUM2INT(arg5);
|
145
1011
|
x = (GLint)NUM2INT(arg6);
|
146
1012
|
y = (GLint)NUM2INT(arg7);
|
147
|
-
width = (GLsizei)
|
148
|
-
height = (GLsizei)
|
149
|
-
|
1013
|
+
width = (GLsizei)NUM2UINT(arg8);
|
1014
|
+
height = (GLsizei)NUM2UINT(arg9);
|
1015
|
+
fptr_glCopyTexSubImage3D( target, level,
|
150
1016
|
xoffset, yoffset, zoffset,
|
151
1017
|
x, y, width, height );
|
152
1018
|
return Qnil;
|
153
1019
|
}
|
154
|
-
*/
|
155
|
-
|
156
|
-
|
157
1020
|
|
158
1021
|
void gl_init_functions_1_2(VALUE module)
|
159
1022
|
{
|
160
|
-
|
1023
|
+
rb_define_module_function(module, "glBlendColor", gl_BlendColor, 4);
|
1024
|
+
rb_define_module_function(module, "glBlendEquation", gl_BlendEquation, 1);
|
161
1025
|
rb_define_module_function(module, "glDrawRangeElements", gl_DrawRangeElements, 6);
|
1026
|
+
rb_define_module_function(module, "glColorTable", gl_ColorTable, 6);
|
1027
|
+
rb_define_module_function(module, "glColorTableParameterfv", gl_ColorTableParameterfv, 3);
|
1028
|
+
rb_define_module_function(module, "glColorTableParameteriv", gl_ColorTableParameteriv, 3);
|
1029
|
+
rb_define_module_function(module, "glCopyColorTable", gl_CopyColorTable, 5);
|
1030
|
+
rb_define_module_function(module, "glGetColorTable", gl_GetColorTable, 3);
|
1031
|
+
rb_define_module_function(module, "glGetColorTableParameterfv", gl_GetColorTableParameterfv, 2);
|
1032
|
+
rb_define_module_function(module, "glGetColorTableParameteriv", gl_GetColorTableParameteriv, 2);
|
1033
|
+
rb_define_module_function(module, "glColorSubTable", gl_ColorSubTable, 6);
|
1034
|
+
rb_define_module_function(module, "glCopyColorSubTable", gl_CopyColorSubTable, 5);
|
1035
|
+
rb_define_module_function(module, "glConvolutionFilter1D", gl_ConvolutionFilter1D, 6);
|
1036
|
+
rb_define_module_function(module, "glConvolutionFilter2D", gl_ConvolutionFilter2D, 7);
|
1037
|
+
rb_define_module_function(module, "glConvolutionParameterf", gl_ConvolutionParameterf, 3);
|
1038
|
+
rb_define_module_function(module, "glConvolutionParameterfv", gl_ConvolutionParameterfv, 3);
|
1039
|
+
rb_define_module_function(module, "glConvolutionParameteri", gl_ConvolutionParameteri, 3);
|
1040
|
+
rb_define_module_function(module, "glConvolutionParameteriv", gl_ConvolutionParameteriv, 3);
|
1041
|
+
rb_define_module_function(module, "glCopyConvolutionFilter1D", gl_CopyConvolutionFilter1D, 5);
|
1042
|
+
rb_define_module_function(module, "glCopyConvolutionFilter2D", gl_CopyConvolutionFilter2D, 6);
|
1043
|
+
rb_define_module_function(module, "glGetConvolutionFilter", gl_GetConvolutionFilter, 3);
|
1044
|
+
rb_define_module_function(module, "glGetConvolutionParameterfv", gl_GetConvolutionParameterfv, 2);
|
1045
|
+
rb_define_module_function(module, "glGetConvolutionParameteriv", gl_GetConvolutionParameteriv, 2);
|
1046
|
+
rb_define_module_function(module, "glGetSeparableFilter", gl_GetSeparableFilter, 3);
|
1047
|
+
rb_define_module_function(module, "glSeparableFilter2D", gl_SeparableFilter2D, 8);
|
1048
|
+
rb_define_module_function(module, "glGetHistogram", gl_GetHistogram, 4);
|
1049
|
+
rb_define_module_function(module, "glGetHistogramParameterfv", gl_GetHistogramParameterfv, 2);
|
1050
|
+
rb_define_module_function(module, "glGetHistogramParameteriv", gl_GetHistogramParameteriv, 2);
|
1051
|
+
rb_define_module_function(module, "glGetMinmax", gl_GetMinmax, 4);
|
1052
|
+
rb_define_module_function(module, "glGetMinmaxParameterfv", gl_GetMinmaxParameterfv, 2);
|
1053
|
+
rb_define_module_function(module, "glGetMinmaxParameteriv", gl_GetMinmaxParameteriv, 2);
|
1054
|
+
rb_define_module_function(module, "glHistogram", gl_Histogram, 4);
|
1055
|
+
rb_define_module_function(module, "glMinmax", gl_Minmax, 3);
|
1056
|
+
rb_define_module_function(module, "glResetHistogram", gl_ResetHistogram, 1);
|
1057
|
+
rb_define_module_function(module, "glResetMinmax", gl_ResetMinmax, 1);
|
162
1058
|
rb_define_module_function(module, "glTexImage3D", gl_TexImage3D, 10);
|
163
1059
|
rb_define_module_function(module, "glTexSubImage3D", gl_TexSubImage3D, 11);
|
164
1060
|
rb_define_module_function(module, "glCopyTexSubImage3D", gl_CopyTexSubImage3D, 9);
|
165
|
-
*/
|
166
1061
|
}
|