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.5.c
CHANGED
@@ -13,18 +13,12 @@
|
|
13
13
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
14
|
*/
|
15
15
|
|
16
|
-
#ifdef __APPLE__
|
17
|
-
#include <OpenGL/gl.h>
|
18
|
-
#elif defined WIN32
|
19
|
-
#include <windows.h>
|
20
|
-
#include <GL/gl.h>
|
21
|
-
#else
|
22
|
-
#include <GL/gl.h>
|
23
|
-
#endif
|
24
16
|
#include "../common/common.h"
|
25
17
|
|
26
18
|
/* OpenGL 1.5 functions */
|
27
19
|
|
20
|
+
GL_SIMPLE_FUNC_LOAD(EndQuery,1,GLenum,NUM2INT)
|
21
|
+
|
28
22
|
static void (APIENTRY * fptr_glGenQueries)(GLsizei,GLuint *);
|
29
23
|
static VALUE
|
30
24
|
gl_GenQueries(obj,arg1)
|
@@ -53,12 +47,17 @@ VALUE obj,arg1;
|
|
53
47
|
GLsizei n;
|
54
48
|
GLuint *queries;
|
55
49
|
LOAD_GL_FUNC(glDeleteQueries)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
50
|
+
if (TYPE(arg1)==T_ARRAY) {
|
51
|
+
n = RARRAY(arg1)->len;
|
52
|
+
queries = ALLOC_N(GLuint,n);
|
53
|
+
ary2cuint(arg1,queries,n);
|
54
|
+
fptr_glDeleteQueries( n, queries);
|
55
|
+
xfree(queries);
|
56
|
+
} else {
|
57
|
+
GLuint query;
|
58
|
+
query = NUM2INT(arg1);
|
59
|
+
fptr_glDeleteQueries( 1, &query);
|
60
|
+
}
|
62
61
|
return Qnil;
|
63
62
|
}
|
64
63
|
|
@@ -89,18 +88,6 @@ VALUE obj,arg1,arg2;
|
|
89
88
|
return Qnil;
|
90
89
|
}
|
91
90
|
|
92
|
-
static void (APIENTRY * fptr_glEndQuery)(GLenum);
|
93
|
-
static VALUE
|
94
|
-
gl_EndQuery(obj,arg1)
|
95
|
-
VALUE obj,arg1;
|
96
|
-
{
|
97
|
-
GLenum target;
|
98
|
-
LOAD_GL_FUNC(glEndQuery)
|
99
|
-
target = (GLenum)NUM2INT(arg1);
|
100
|
-
fptr_glEndQuery(target);
|
101
|
-
return Qnil;
|
102
|
-
}
|
103
|
-
|
104
91
|
static void (APIENTRY * fptr_glGetQueryiv)(GLenum,GLenum,GLint *);
|
105
92
|
static VALUE
|
106
93
|
gl_GetQueryiv(obj,arg1,arg2)
|
@@ -177,12 +164,17 @@ VALUE obj,arg1;
|
|
177
164
|
GLsizei n;
|
178
165
|
GLuint *buffers;
|
179
166
|
LOAD_GL_FUNC(glDeleteBuffers)
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
167
|
+
if (TYPE(arg1)==T_ARRAY) {
|
168
|
+
n = RARRAY(arg1)->len;
|
169
|
+
buffers = ALLOC_N(GLuint,n);
|
170
|
+
ary2cuint(arg1,buffers,n);
|
171
|
+
fptr_glDeleteBuffers(n, buffers);
|
172
|
+
xfree(buffers);
|
173
|
+
} else {
|
174
|
+
GLuint buffer;
|
175
|
+
buffer = NUM2INT(arg1);
|
176
|
+
fptr_glDeleteBuffers(1, &buffer);
|
177
|
+
}
|
186
178
|
return Qnil;
|
187
179
|
}
|
188
180
|
|
@@ -303,13 +295,15 @@ VALUE obj,arg1,arg2;
|
|
303
295
|
GLenum access;
|
304
296
|
GLint size = 0;
|
305
297
|
VALUE data;
|
306
|
-
GLvoid *buffer_ptr;
|
298
|
+
GLvoid *buffer_ptr = NULL;
|
307
299
|
LOAD_GL_FUNC(glMapBuffer)
|
308
300
|
LOAD_GL_FUNC(glGetBufferParameteriv)
|
309
301
|
target = (GLenum)NUM2INT(arg1);
|
310
302
|
access = (GLenum)NUM2INT(arg2);
|
311
303
|
fptr_glGetBufferParameteriv(target,GL_BUFFER_SIZE,&size);
|
312
304
|
buffer_ptr = fptr_glMapBuffer(target,access);
|
305
|
+
if (buffer_ptr==NULL || size<=0)
|
306
|
+
return Qnil;
|
313
307
|
data = allocate_buffer_with_string(size);
|
314
308
|
memcpy(RSTRING(data)->ptr, buffer_ptr, size);
|
315
309
|
return data;
|
@@ -334,7 +328,7 @@ gl_GetBufferPointerv(obj,arg1,arg2,arg3)
|
|
334
328
|
VALUE obj,arg1,arg2,arg3;
|
335
329
|
{
|
336
330
|
LOAD_GL_FUNC(glGetBufferPointerv)
|
337
|
-
|
331
|
+
rb_raise(rb_eArgError, "glGetBufferPointerv not implemented");
|
338
332
|
return Qnil;
|
339
333
|
}
|
340
334
|
|
data/ext/gl/gl-2.0.c
CHANGED
@@ -13,29 +13,24 @@
|
|
13
13
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
14
|
*/
|
15
15
|
|
16
|
-
#ifdef __APPLE__
|
17
|
-
#include <OpenGL/gl.h>
|
18
|
-
#elif defined WIN32
|
19
|
-
#include <windows.h>
|
20
|
-
#include <GL/gl.h>
|
21
|
-
#else
|
22
|
-
#include <GL/gl.h>
|
23
|
-
#endif
|
24
16
|
#include "../common/common.h"
|
25
17
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
18
|
+
GL_SIMPLE_FUNC_LOAD(BlendEquationSeparate,2,GLenum,NUM2INT)
|
19
|
+
GL_SIMPLE_FUNC_LOAD(StencilOpSeparate,4,GLenum,NUM2INT)
|
20
|
+
GL_SIMPLE_FUNC_LOAD(AttachShader,2,GLuint,NUM2UINT)
|
21
|
+
GL_SIMPLE_FUNC_LOAD(CompileShader,1,GLuint,NUM2UINT)
|
22
|
+
GL_SIMPLE_FUNC_LOAD(DeleteProgram,1,GLuint,NUM2UINT)
|
23
|
+
GL_SIMPLE_FUNC_LOAD(DeleteShader,1,GLuint,NUM2UINT)
|
24
|
+
GL_SIMPLE_FUNC_LOAD(DetachShader,2,GLuint,NUM2UINT)
|
25
|
+
GL_SIMPLE_FUNC_LOAD(DisableVertexAttribArray,1,GLuint,NUM2UINT)
|
26
|
+
GL_SIMPLE_FUNC_LOAD(EnableVertexAttribArray,1,GLuint,NUM2UINT)
|
27
|
+
GL_SIMPLE_FUNC_LOAD(LinkProgram,1,GLuint,NUM2UINT)
|
28
|
+
GL_SIMPLE_FUNC_LOAD(UseProgram,1,GLuint,NUM2UINT)
|
29
|
+
GL_SIMPLE_FUNC_LOAD(ValidateProgram,1,GLuint,NUM2UINT)
|
30
|
+
GL_SIMPLE_FUNC_LOAD(Uniform1i,2,GLint,NUM2INT)
|
31
|
+
GL_SIMPLE_FUNC_LOAD(Uniform2i,3,GLint,NUM2INT)
|
32
|
+
GL_SIMPLE_FUNC_LOAD(Uniform3i,4,GLint,NUM2INT)
|
33
|
+
GL_SIMPLE_FUNC_LOAD(Uniform4i,5,GLint,NUM2INT)
|
39
34
|
|
40
35
|
static void (APIENTRY * fptr_glDrawBuffers)(GLsizei,GLenum *);
|
41
36
|
static VALUE
|
@@ -54,24 +49,6 @@ VALUE obj,arg1;
|
|
54
49
|
return Qnil;
|
55
50
|
}
|
56
51
|
|
57
|
-
static void (APIENTRY * fptr_glStencilOpSeparate)(GLenum,GLenum,GLenum,GLenum);
|
58
|
-
static VALUE
|
59
|
-
gl_StencilOpSeparate(obj,arg1,arg2,arg3,arg4)
|
60
|
-
VALUE obj,arg1,arg2,arg3,arg4;
|
61
|
-
{
|
62
|
-
GLenum face;
|
63
|
-
GLenum sfail;
|
64
|
-
GLenum dpfail;
|
65
|
-
GLenum dppass;
|
66
|
-
LOAD_GL_FUNC(glStencilOpSeparate)
|
67
|
-
face = (GLenum)NUM2INT(arg1);
|
68
|
-
sfail = (GLenum)NUM2INT(arg2);
|
69
|
-
dpfail = (GLenum)NUM2INT(arg3);
|
70
|
-
dppass = (GLenum)NUM2INT(arg4);
|
71
|
-
fptr_glStencilOpSeparate(face,sfail,dpfail,dppass);
|
72
|
-
return Qnil;
|
73
|
-
}
|
74
|
-
|
75
52
|
static void (APIENTRY * fptr_glStencilFuncSeparate)(GLenum,GLenum,GLint,GLuint);
|
76
53
|
static VALUE
|
77
54
|
gl_StencilFuncSeparate(obj,arg1,arg2,arg3,arg4)
|
@@ -104,20 +81,6 @@ VALUE obj,arg1,arg2;
|
|
104
81
|
return Qnil;
|
105
82
|
}
|
106
83
|
|
107
|
-
static void (APIENTRY * fptr_glAttachShader)(GLuint,GLuint);
|
108
|
-
static VALUE
|
109
|
-
gl_AttachShader(obj,arg1,arg2)
|
110
|
-
VALUE obj,arg1,arg2;
|
111
|
-
{
|
112
|
-
GLuint program;
|
113
|
-
GLuint shader;
|
114
|
-
LOAD_GL_FUNC(glAttachShader)
|
115
|
-
program = (GLuint)NUM2UINT(arg1);
|
116
|
-
shader = (GLuint)NUM2UINT(arg2);
|
117
|
-
fptr_glAttachShader(program,shader);
|
118
|
-
return Qnil;
|
119
|
-
}
|
120
|
-
|
121
84
|
static void (APIENTRY * fptr_glBindAttribLocation)(GLuint,GLuint,GLchar *);
|
122
85
|
static VALUE
|
123
86
|
gl_BindAttribLocation(obj,arg1,arg2,arg3)
|
@@ -133,18 +96,6 @@ VALUE obj,arg1,arg2,arg3;
|
|
133
96
|
return Qnil;
|
134
97
|
}
|
135
98
|
|
136
|
-
static void (APIENTRY * fptr_glCompileShader)(GLuint);
|
137
|
-
static VALUE
|
138
|
-
gl_CompileShader(obj,arg1)
|
139
|
-
VALUE obj,arg1;
|
140
|
-
{
|
141
|
-
GLuint shader;
|
142
|
-
LOAD_GL_FUNC(glCompileShader)
|
143
|
-
shader = (GLuint)NUM2UINT(arg1);
|
144
|
-
fptr_glCompileShader(shader);
|
145
|
-
return Qnil;
|
146
|
-
}
|
147
|
-
|
148
99
|
static GLuint (APIENTRY * fptr_glCreateProgram)(void);
|
149
100
|
static VALUE
|
150
101
|
gl_CreateProgram(obj)
|
@@ -169,68 +120,6 @@ VALUE obj,arg1;
|
|
169
120
|
return INT2NUM(ret);
|
170
121
|
}
|
171
122
|
|
172
|
-
static void (APIENTRY * fptr_glDeleteProgram)(GLuint);
|
173
|
-
static VALUE
|
174
|
-
gl_DeleteProgram(obj,arg1)
|
175
|
-
VALUE obj,arg1;
|
176
|
-
{
|
177
|
-
GLuint program;
|
178
|
-
LOAD_GL_FUNC(glDeleteProgram)
|
179
|
-
program = (GLuint)NUM2UINT(arg1);
|
180
|
-
fptr_glDeleteProgram(program);
|
181
|
-
return Qnil;
|
182
|
-
}
|
183
|
-
|
184
|
-
static void (APIENTRY * fptr_glDeleteShader)(GLuint);
|
185
|
-
static VALUE
|
186
|
-
gl_DeleteShader(obj,arg1)
|
187
|
-
VALUE obj,arg1;
|
188
|
-
{
|
189
|
-
GLuint shader;
|
190
|
-
LOAD_GL_FUNC(glDeleteShader)
|
191
|
-
shader = (GLuint)NUM2UINT(arg1);
|
192
|
-
fptr_glDeleteShader(shader);
|
193
|
-
return Qnil;
|
194
|
-
}
|
195
|
-
|
196
|
-
static void (APIENTRY * fptr_glDetachShader)(GLuint,GLuint);
|
197
|
-
static VALUE
|
198
|
-
gl_DetachShader(obj,arg1,arg2)
|
199
|
-
VALUE obj,arg1,arg2;
|
200
|
-
{
|
201
|
-
GLuint program;
|
202
|
-
GLuint shader;
|
203
|
-
LOAD_GL_FUNC(glDetachShader)
|
204
|
-
program=(GLuint)NUM2UINT(arg1);
|
205
|
-
shader=(GLuint)NUM2UINT(arg2);
|
206
|
-
fptr_glDetachShader(program,shader);
|
207
|
-
return Qnil;
|
208
|
-
}
|
209
|
-
|
210
|
-
static void (APIENTRY * fptr_glDisableVertexAttribArray)(GLuint);
|
211
|
-
static VALUE
|
212
|
-
gl_DisableVertexAttribArray(obj,arg1)
|
213
|
-
VALUE obj,arg1;
|
214
|
-
{
|
215
|
-
GLuint index;
|
216
|
-
LOAD_GL_FUNC(glDisableVertexAttribArray)
|
217
|
-
index=(GLuint)NUM2UINT(arg1);
|
218
|
-
fptr_glDisableVertexAttribArray(index);
|
219
|
-
return Qnil;
|
220
|
-
}
|
221
|
-
|
222
|
-
static void (APIENTRY * fptr_glEnableVertexAttribArray)(GLuint);
|
223
|
-
static VALUE
|
224
|
-
gl_EnableVertexAttribArray(obj,arg1)
|
225
|
-
VALUE obj,arg1;
|
226
|
-
{
|
227
|
-
GLuint index;
|
228
|
-
LOAD_GL_FUNC(glEnableVertexAttribArray)
|
229
|
-
index=(GLuint)NUM2UINT(arg1);
|
230
|
-
fptr_glEnableVertexAttribArray(index);
|
231
|
-
return Qnil;
|
232
|
-
}
|
233
|
-
|
234
123
|
static void (APIENTRY * fptr_glGetProgramiv)(GLuint,GLenum,GLint *);
|
235
124
|
static VALUE
|
236
125
|
gl_GetProgramiv(obj,arg1,arg2)
|
@@ -673,18 +562,6 @@ VALUE obj,arg1;
|
|
673
562
|
return INT2NUM(ret);
|
674
563
|
}
|
675
564
|
|
676
|
-
static void (APIENTRY * fptr_glLinkProgram)(GLuint);
|
677
|
-
static VALUE
|
678
|
-
gl_LinkProgram(obj,arg1)
|
679
|
-
VALUE obj,arg1;
|
680
|
-
{
|
681
|
-
GLuint program;
|
682
|
-
LOAD_GL_FUNC(glLinkProgram)
|
683
|
-
program = (GLuint)NUM2UINT(arg1);
|
684
|
-
fptr_glLinkProgram(program);
|
685
|
-
return Qnil;
|
686
|
-
}
|
687
|
-
|
688
565
|
static void (APIENTRY * fptr_glShaderSource)(GLuint,GLsizei,GLchar**,GLint *);
|
689
566
|
static VALUE
|
690
567
|
gl_ShaderSource(obj,arg1,arg2)
|
@@ -702,18 +579,6 @@ VALUE obj,arg1,arg2;
|
|
702
579
|
return Qnil;
|
703
580
|
}
|
704
581
|
|
705
|
-
static void (APIENTRY * fptr_glUseProgram)(GLuint);
|
706
|
-
static VALUE
|
707
|
-
gl_UseProgram(obj,arg1)
|
708
|
-
VALUE obj,arg1;
|
709
|
-
{
|
710
|
-
GLuint program;
|
711
|
-
LOAD_GL_FUNC(glUseProgram)
|
712
|
-
program = (GLuint)NUM2UINT(arg1);
|
713
|
-
fptr_glUseProgram(program);
|
714
|
-
return Qnil;
|
715
|
-
}
|
716
|
-
|
717
582
|
static void (APIENTRY * fptr_glUniform1f)(GLint,GLfloat);
|
718
583
|
static VALUE
|
719
584
|
gl_Uniform1f(obj,arg1,arg2)
|
@@ -782,74 +647,6 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
|
782
647
|
return Qnil;
|
783
648
|
}
|
784
649
|
|
785
|
-
static void (APIENTRY * fptr_glUniform1i)(GLint,GLint);
|
786
|
-
static VALUE
|
787
|
-
gl_Uniform1i(obj,arg1,arg2)
|
788
|
-
VALUE obj,arg1,arg2;
|
789
|
-
{
|
790
|
-
GLint location;
|
791
|
-
GLint v0;
|
792
|
-
LOAD_GL_FUNC(glUniform1i)
|
793
|
-
location = (GLint)NUM2INT(arg1);
|
794
|
-
v0 = (GLint)NUM2INT(arg2);
|
795
|
-
fptr_glUniform1i(location,v0);
|
796
|
-
return Qnil;
|
797
|
-
}
|
798
|
-
|
799
|
-
static void (APIENTRY * fptr_glUniform2i)(GLint,GLint,GLint);
|
800
|
-
static VALUE
|
801
|
-
gl_Uniform2i(obj,arg1,arg2,arg3)
|
802
|
-
VALUE obj,arg1,arg2,arg3;
|
803
|
-
{
|
804
|
-
GLint location;
|
805
|
-
GLint v0;
|
806
|
-
GLint v1;
|
807
|
-
LOAD_GL_FUNC(glUniform2i)
|
808
|
-
location = (GLint)NUM2INT(arg1);
|
809
|
-
v0 = (GLint)NUM2INT(arg2);
|
810
|
-
v1 = (GLint)NUM2INT(arg3);
|
811
|
-
fptr_glUniform2i(location,v0,v1);
|
812
|
-
return Qnil;
|
813
|
-
}
|
814
|
-
|
815
|
-
static void (APIENTRY * fptr_glUniform3i)(GLint,GLint,GLint,GLint);
|
816
|
-
static VALUE
|
817
|
-
gl_Uniform3i(obj,arg1,arg2,arg3,arg4)
|
818
|
-
VALUE obj,arg1,arg2,arg3,arg4;
|
819
|
-
{
|
820
|
-
GLint location;
|
821
|
-
GLint v0;
|
822
|
-
GLint v1;
|
823
|
-
GLint v2;
|
824
|
-
LOAD_GL_FUNC(glUniform3i)
|
825
|
-
location = (GLint)NUM2INT(arg1);
|
826
|
-
v0 = (GLint)NUM2INT(arg2);
|
827
|
-
v1 = (GLint)NUM2INT(arg3);
|
828
|
-
v2 = (GLint)NUM2INT(arg4);
|
829
|
-
fptr_glUniform3i(location,v0,v1,v2);
|
830
|
-
return Qnil;
|
831
|
-
}
|
832
|
-
|
833
|
-
static void (APIENTRY * fptr_glUniform4i)(GLint,GLint,GLint,GLint,GLint);
|
834
|
-
static VALUE
|
835
|
-
gl_Uniform4i(obj,arg1,arg2,arg3,arg4,arg5)
|
836
|
-
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
837
|
-
{
|
838
|
-
GLint location;
|
839
|
-
GLint v0;
|
840
|
-
GLint v1;
|
841
|
-
GLint v2;
|
842
|
-
GLint v3;
|
843
|
-
LOAD_GL_FUNC(glUniform4i)
|
844
|
-
location = (GLint)NUM2INT(arg1);
|
845
|
-
v0 = (GLint)NUM2INT(arg2);
|
846
|
-
v1 = (GLint)NUM2INT(arg3);
|
847
|
-
v2 = (GLint)NUM2INT(arg4);
|
848
|
-
v3 = (GLint)NUM2INT(arg5);
|
849
|
-
fptr_glUniform4i(location,v0,v1,v2,v3);
|
850
|
-
return Qnil;
|
851
|
-
}
|
852
|
-
|
853
650
|
static void (APIENTRY * fptr_glUniform1fv)(GLint,GLsizei,GLfloat *);
|
854
651
|
static VALUE
|
855
652
|
gl_Uniform1fv(obj,arg1,arg2,arg3)
|
@@ -1054,18 +851,6 @@ VALUE obj,arg1,arg2,arg3,arg4;
|
|
1054
851
|
return Qnil;
|
1055
852
|
}
|
1056
853
|
|
1057
|
-
static void (APIENTRY * fptr_glValidateProgram)(GLuint);
|
1058
|
-
static VALUE
|
1059
|
-
gl_ValidateProgram(obj,arg1)
|
1060
|
-
VALUE obj,arg1;
|
1061
|
-
{
|
1062
|
-
GLuint program;
|
1063
|
-
LOAD_GL_FUNC(glValidateProgram)
|
1064
|
-
program = (GLuint)NUM2UINT(arg1);
|
1065
|
-
fptr_glValidateProgram(program);
|
1066
|
-
return Qnil;
|
1067
|
-
}
|
1068
|
-
|
1069
854
|
static void (APIENTRY * fptr_glVertexAttrib1d)(GLuint,GLdouble);
|
1070
855
|
static VALUE
|
1071
856
|
gl_VertexAttrib1d(obj,arg1,arg2)
|
@@ -1519,10 +1304,16 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
|
1519
1304
|
stride = (GLsizei)NUM2UINT(arg5);
|
1520
1305
|
if (index>_MAX_VERTEX_ATTRIBS)
|
1521
1306
|
rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1307
|
+
|
1308
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
1309
|
+
g_VertexAttrib_ptr[index] = arg6;
|
1310
|
+
fptr_glVertexAttribPointer(index,size,type,normalized,stride,(GLvoid *)NUM2INT(arg6));
|
1311
|
+
} else {
|
1312
|
+
Check_Type(arg6, T_STRING);
|
1313
|
+
rb_str_freeze(arg6);
|
1314
|
+
g_VertexAttrib_ptr[index] = arg6;
|
1315
|
+
fptr_glVertexAttribPointer(index,size,type,normalized,stride,(GLvoid *)RSTRING(arg6)->ptr);
|
1316
|
+
}
|
1526
1317
|
return Qnil;
|
1527
1318
|
}
|
1528
1319
|
|
data/ext/gl/gl-2.1.c
CHANGED
@@ -13,135 +13,42 @@
|
|
13
13
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
14
|
*/
|
15
15
|
|
16
|
-
#ifdef __APPLE__
|
17
|
-
#include <OpenGL/gl.h>
|
18
|
-
#elif defined WIN32
|
19
|
-
#include <windows.h>
|
20
|
-
#include <GL/gl.h>
|
21
|
-
#else
|
22
|
-
#include <GL/gl.h>
|
23
|
-
#endif
|
24
16
|
#include "../common/common.h"
|
25
17
|
|
26
|
-
|
27
|
-
static
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
{
|
51
|
-
GLint location;
|
52
|
-
GLsizei count;
|
53
|
-
GLboolean transpose;
|
54
|
-
GLfloat *value;
|
55
|
-
LOAD_GL_FUNC(glUniformMatrix3x2fv)
|
56
|
-
location = (GLint)NUM2INT(arg1);
|
57
|
-
count = (GLint)NUM2INT(arg2);
|
58
|
-
transpose = (GLboolean)NUM2INT(arg3);
|
59
|
-
value = ALLOC_N(GLfloat, 3*2*count);
|
60
|
-
ary2cflt(arg4,value,3*2*count);
|
61
|
-
fptr_glUniformMatrix3x2fv(location,count,transpose,value);
|
62
|
-
xfree(value);
|
63
|
-
return Qnil;
|
64
|
-
}
|
65
|
-
|
66
|
-
static void (APIENTRY * fptr_glUniformMatrix2x4fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
67
|
-
static VALUE
|
68
|
-
gl_UniformMatrix2x4fv(obj,arg1,arg2,arg3,arg4)
|
69
|
-
VALUE obj,arg1,arg2,arg3,arg4;
|
70
|
-
{
|
71
|
-
GLint location;
|
72
|
-
GLsizei count;
|
73
|
-
GLboolean transpose;
|
74
|
-
GLfloat *value;
|
75
|
-
LOAD_GL_FUNC(glUniformMatrix2x4fv)
|
76
|
-
location = (GLint)NUM2INT(arg1);
|
77
|
-
count = (GLint)NUM2INT(arg2);
|
78
|
-
transpose = (GLboolean)NUM2INT(arg3);
|
79
|
-
value = ALLOC_N(GLfloat, 2*4*count);
|
80
|
-
ary2cflt(arg4,value,2*4*count);
|
81
|
-
fptr_glUniformMatrix2x4fv(location,count,transpose,value);
|
82
|
-
xfree(value);
|
83
|
-
return Qnil;
|
18
|
+
#define UNIFORMMATRIX_FUNC(_x_,_y_) \
|
19
|
+
static void (APIENTRY * fptr_glUniformMatrix##_x_##x##_y_##fv)(GLint,GLsizei,GLboolean,GLfloat *); \
|
20
|
+
static VALUE \
|
21
|
+
gl_UniformMatrix##_x_##x##_y_##fv(obj,arg1,arg2,arg3,arg4) \
|
22
|
+
VALUE obj,arg1,arg2,arg3,arg4; \
|
23
|
+
{ \
|
24
|
+
GLint location; \
|
25
|
+
GLsizei count; \
|
26
|
+
GLboolean transpose; \
|
27
|
+
GLfloat *value; \
|
28
|
+
VALUE ary; \
|
29
|
+
LOAD_GL_FUNC(glUniformMatrix##_x_##x##_y_##fv) \
|
30
|
+
location = (GLint)NUM2INT(arg1); \
|
31
|
+
count = (GLint)NUM2INT(arg2); \
|
32
|
+
transpose = (GLboolean)NUM2INT(arg3); \
|
33
|
+
ary = rb_ary_new(); \
|
34
|
+
mary2ary(arg4, ary); \
|
35
|
+
if (RARRAY(ary)->len!=(_x_*_y_*count)) \
|
36
|
+
rb_raise(rb_eArgError, "Incorrect array length %i",RARRAY(ary)->len); \
|
37
|
+
value = ALLOC_N(GLfloat, _x_*_y_*count); \
|
38
|
+
ary2cflt(arg4,value,_x_*_y_*count); \
|
39
|
+
fptr_glUniformMatrix##_x_##x##_y_##fv(location,count,transpose,value); \
|
40
|
+
xfree(value); \
|
41
|
+
return Qnil; \
|
84
42
|
}
|
85
43
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
GLsizei count;
|
93
|
-
GLboolean transpose;
|
94
|
-
GLfloat *value;
|
95
|
-
LOAD_GL_FUNC(glUniformMatrix4x2fv)
|
96
|
-
location = (GLint)NUM2INT(arg1);
|
97
|
-
count = (GLint)NUM2INT(arg2);
|
98
|
-
transpose = (GLboolean)NUM2INT(arg3);
|
99
|
-
value = ALLOC_N(GLfloat, 4*2*count);
|
100
|
-
ary2cflt(arg4,value,4*2*count);
|
101
|
-
fptr_glUniformMatrix4x2fv(location,count,transpose,value);
|
102
|
-
xfree(value);
|
103
|
-
return Qnil;
|
104
|
-
}
|
44
|
+
UNIFORMMATRIX_FUNC(2,3)
|
45
|
+
UNIFORMMATRIX_FUNC(3,2)
|
46
|
+
UNIFORMMATRIX_FUNC(2,4)
|
47
|
+
UNIFORMMATRIX_FUNC(4,2)
|
48
|
+
UNIFORMMATRIX_FUNC(3,4)
|
49
|
+
UNIFORMMATRIX_FUNC(4,3)
|
105
50
|
|
106
|
-
|
107
|
-
static VALUE
|
108
|
-
gl_UniformMatrix3x4fv(obj,arg1,arg2,arg3,arg4)
|
109
|
-
VALUE obj,arg1,arg2,arg3,arg4;
|
110
|
-
{
|
111
|
-
GLint location;
|
112
|
-
GLsizei count;
|
113
|
-
GLboolean transpose;
|
114
|
-
GLfloat *value;
|
115
|
-
LOAD_GL_FUNC(glUniformMatrix3x4fv)
|
116
|
-
location = (GLint)NUM2INT(arg1);
|
117
|
-
count = (GLint)NUM2INT(arg2);
|
118
|
-
transpose = (GLboolean)NUM2INT(arg3);
|
119
|
-
value = ALLOC_N(GLfloat, 3*4*count);
|
120
|
-
ary2cflt(arg4,value,3*4*count);
|
121
|
-
fptr_glUniformMatrix3x4fv(location,count,transpose,value);
|
122
|
-
xfree(value);
|
123
|
-
return Qnil;
|
124
|
-
}
|
125
|
-
|
126
|
-
static void (APIENTRY * fptr_glUniformMatrix4x3fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
127
|
-
static VALUE
|
128
|
-
gl_UniformMatrix4x3fv(obj,arg1,arg2,arg3,arg4)
|
129
|
-
VALUE obj,arg1,arg2,arg3,arg4;
|
130
|
-
{
|
131
|
-
GLint location;
|
132
|
-
GLsizei count;
|
133
|
-
GLboolean transpose;
|
134
|
-
GLfloat *value;
|
135
|
-
LOAD_GL_FUNC(glUniformMatrix4x3fv)
|
136
|
-
location = (GLint)NUM2INT(arg1);
|
137
|
-
count = (GLint)NUM2INT(arg2);
|
138
|
-
transpose = (GLboolean)NUM2INT(arg3);
|
139
|
-
value = ALLOC_N(GLfloat, 4*3*count);
|
140
|
-
ary2cflt(arg4,value,4*3*count);
|
141
|
-
fptr_glUniformMatrix4x3fv(location,count,transpose,value);
|
142
|
-
xfree(value);
|
143
|
-
return Qnil;
|
144
|
-
}
|
51
|
+
#undef UNIFORMMATRIX_FUNC
|
145
52
|
|
146
53
|
void gl_init_functions_2_1(VALUE module)
|
147
54
|
{
|