opengl 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -1
- data/.travis.yml +19 -0
- data/History.rdoc +26 -0
- data/Manifest.txt +3 -23
- data/README.rdoc +43 -37
- data/Rakefile +6 -62
- data/examples/NeHe/nehe_lesson02.rb +3 -2
- data/examples/NeHe/nehe_lesson03.rb +3 -2
- data/examples/NeHe/nehe_lesson04.rb +3 -1
- data/examples/NeHe/nehe_lesson05.rb +4 -1
- data/examples/NeHe/nehe_lesson06.rb +9 -6
- data/examples/NeHe/nehe_lesson07.rb +9 -6
- data/examples/NeHe/nehe_lesson08.rb +9 -6
- data/examples/NeHe/nehe_lesson09.rb +10 -6
- data/examples/NeHe/nehe_lesson11.rb +9 -6
- data/examples/NeHe/nehe_lesson12.rb +9 -6
- data/examples/NeHe/nehe_lesson16.rb +50 -47
- data/examples/NeHe/nehe_lesson19.rb +10 -7
- data/examples/NeHe/nehe_lesson36.rb +234 -229
- data/examples/OrangeBook/brick.rb +227 -225
- data/examples/OrangeBook/particle.rb +233 -231
- data/examples/RedBook/aapoly.rb +71 -70
- data/examples/RedBook/aargb.rb +54 -52
- data/examples/RedBook/accanti.rb +96 -94
- data/examples/RedBook/accpersp.rb +106 -104
- data/examples/RedBook/alpha.rb +54 -52
- data/examples/RedBook/alpha3D.rb +90 -88
- data/examples/RedBook/bezcurve.rb +48 -46
- data/examples/RedBook/bezmesh.rb +71 -69
- data/examples/RedBook/checker.rb +57 -55
- data/examples/RedBook/clip.rb +41 -39
- data/examples/RedBook/colormat.rb +72 -70
- data/examples/RedBook/cube.rb +39 -37
- data/examples/RedBook/depthcue.rb +37 -35
- data/examples/RedBook/dof.rb +110 -109
- data/examples/RedBook/double.rb +40 -38
- data/examples/RedBook/drawf.rb +30 -28
- data/examples/RedBook/feedback.rb +79 -77
- data/examples/RedBook/fog.rb +90 -89
- data/examples/RedBook/font.rb +78 -76
- data/examples/RedBook/hello.rb +29 -27
- data/examples/RedBook/image.rb +57 -55
- data/examples/RedBook/jitter.rb +131 -131
- data/examples/RedBook/light.rb +2 -1
- data/examples/RedBook/lines.rb +70 -68
- data/examples/RedBook/list.rb +48 -46
- data/examples/RedBook/material.rb +200 -199
- data/examples/RedBook/mipmap.rb +84 -82
- data/examples/RedBook/model.rb +55 -53
- data/examples/RedBook/movelight.rb +52 -50
- data/examples/RedBook/pickdepth.rb +103 -101
- data/examples/RedBook/planet.rb +46 -44
- data/examples/RedBook/quadric.rb +97 -95
- data/examples/RedBook/robot.rb +55 -53
- data/examples/RedBook/select.rb +118 -116
- data/examples/RedBook/smooth.rb +35 -33
- data/examples/RedBook/stencil.rb +96 -94
- data/examples/RedBook/stroke.rb +75 -73
- data/examples/RedBook/surface.rb +93 -91
- data/examples/RedBook/teaambient.rb +71 -69
- data/examples/RedBook/teapots.rb +105 -103
- data/examples/RedBook/tess.rb +96 -94
- data/examples/RedBook/texbind.rb +79 -77
- data/examples/RedBook/texgen.rb +88 -86
- data/examples/RedBook/texturesurf.rb +57 -55
- data/examples/RedBook/varray.rb +85 -83
- data/examples/RedBook/wrap.rb +76 -74
- data/examples/misc/OGLBench.rb +114 -113
- data/examples/misc/anisotropic.rb +154 -152
- data/examples/misc/fbo_test.rb +37 -36
- data/examples/misc/font-glut.rb +47 -46
- data/examples/misc/glfwtest.rb +16 -16
- data/examples/misc/plane.rb +13 -13
- data/examples/misc/readpixel.rb +66 -65
- data/examples/misc/sdltest.rb +21 -19
- data/examples/misc/trislam.rb +548 -547
- data/ext/opengl/common.h +16 -38
- data/ext/opengl/conv.h +39 -41
- data/ext/opengl/extconf.rb +4 -31
- data/ext/opengl/funcdef.h +126 -124
- data/ext/opengl/gl-1.0-1.1.c +1917 -1917
- data/ext/opengl/gl-1.2.c +4 -667
- data/ext/opengl/gl-1.3.c +9 -9
- data/ext/opengl/gl-1.4.c +8 -8
- data/ext/opengl/gl-1.5.c +1 -1
- data/ext/opengl/gl-2.0.c +392 -388
- data/ext/opengl/gl-3.0.c +493 -0
- data/ext/opengl/gl-enums.c +1523 -5
- data/ext/opengl/gl-enums.h +4679 -122
- data/ext/opengl/gl-error.c +7 -7
- data/ext/opengl/gl-error.h +4 -4
- data/ext/opengl/gl-ext-arb.c +468 -464
- data/ext/opengl/gl-ext-ext.c +18 -18
- data/ext/opengl/gl-ext-nv.c +15 -15
- data/ext/opengl/gl.c +2 -0
- data/ext/opengl/gl_buffer.c +92 -92
- data/ext/opengl/opengl.c +1 -7
- data/lib/opengl.rb +23 -59
- data/lib/opengl/test_case.rb +1 -2
- data/test/dummy.xorg.conf +140 -0
- data/test/test_gl.rb +18 -22
- data/test/test_gl_10_11.rb +220 -220
- data/test/test_gl_12.rb +11 -122
- data/test/test_gl_13.rb +202 -210
- data/test/test_gl_14.rb +16 -19
- data/test/test_gl_15.rb +2 -4
- data/test/test_gl_20.rb +45 -58
- data/test/test_gl_21.rb +46 -163
- data/test/test_gl_ext_arb.rb +54 -72
- data/test/test_gl_ext_ati.rb +0 -2
- data/test/test_gl_ext_ext.rb +66 -66
- data/test/test_gl_ext_gremedy.rb +8 -15
- data/test/test_gl_ext_nv.rb +109 -112
- data/test/test_opengl_buffer.rb +8 -25
- data/utils/README +0 -5
- data/utils/enumgen.rb +72 -76
- data/utils/extlistgen.rb +55 -55
- metadata +87 -66
- metadata.gz.sig +2 -0
- data/Rakefile.cross +0 -107
- data/docs/build_install.txt +0 -119
- data/docs/extensions.txt.in +0 -348
- data/docs/history.txt +0 -66
- data/docs/requirements_and_design.txt +0 -117
- data/docs/roadmap.txt +0 -28
- data/docs/scientific_use.txt +0 -35
- data/docs/supplies/page_template.html +0 -71
- data/docs/thanks.txt +0 -29
- data/docs/tutorial.txt +0 -469
- data/ext/opengl/glu-enums.c +0 -164
- data/ext/opengl/glu-enums.h +0 -463
- data/ext/opengl/glu.c +0 -1534
- data/ext/opengl/glut.c +0 -1145
- data/ext/opengl/glut_callbacks.c +0 -845
- data/lib/glu.rb +0 -1
- data/lib/glut.rb +0 -1
- data/test/test_glu.rb +0 -309
- data/utils/mkdn2html.rb +0 -59
- data/utils/post-mkdn2html.rb +0 -91
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +0 -198
data/ext/opengl/gl-3.0.c
ADDED
@@ -0,0 +1,493 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2013 Blaž Hrastnik <speed.the.bboy@gmail.com>
|
3
|
+
*
|
4
|
+
* This program is distributed under the terms of the MIT license.
|
5
|
+
* See the included MIT-LICENSE file for the terms of this license.
|
6
|
+
*
|
7
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
9
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
10
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
11
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
12
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
13
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
|
+
*/
|
15
|
+
|
16
|
+
#include "common.h"
|
17
|
+
|
18
|
+
/*
|
19
|
+
GL_APPLE_flush_buffer_range -> actually ARB_map_buffer_range
|
20
|
+
|
21
|
+
GL_EXT_framebuffer_object -> GL_ARB_framebuffer_object
|
22
|
+
|
23
|
+
GL_NV_half_float
|
24
|
+
|
25
|
+
GL_EXT_transform_feedback
|
26
|
+
GL_APPLE_vertex_array_object --> ARB_vertex_array_object
|
27
|
+
|
28
|
+
-- New commands in OpenGL 3.0:
|
29
|
+
|
30
|
+
ClearBufferiv(buffer, drawbuffer, value)
|
31
|
+
return void
|
32
|
+
param buffer GLenum in value
|
33
|
+
param drawbuffer DrawBufferName in value
|
34
|
+
param value Int32 in array [COMPSIZE(buffer)]
|
35
|
+
|
36
|
+
ClearBufferuiv(buffer, drawbuffer, value)
|
37
|
+
return void
|
38
|
+
param buffer GLenum in value
|
39
|
+
param drawbuffer DrawBufferName in value
|
40
|
+
param value UInt32 in array [COMPSIZE(buffer)]
|
41
|
+
|
42
|
+
ClearBufferfv(buffer, drawbuffer, value)
|
43
|
+
return void
|
44
|
+
param buffer GLenum in value
|
45
|
+
param drawbuffer DrawBufferName in value
|
46
|
+
param value Float32 in array [COMPSIZE(buffer)]
|
47
|
+
|
48
|
+
ClearBufferfi(buffer, drawbuffer, depth, stencil)
|
49
|
+
return void
|
50
|
+
param buffer GLenum in value
|
51
|
+
param drawbuffer DrawBufferName in value
|
52
|
+
param depth Float32 in value
|
53
|
+
param stencil Int32 in value
|
54
|
+
|
55
|
+
GetStringi(name, index)
|
56
|
+
return String
|
57
|
+
param name GLenum in value
|
58
|
+
param index UInt32 in value
|
59
|
+
|
60
|
+
*/
|
61
|
+
|
62
|
+
/* GL_NV_conditional_render */
|
63
|
+
GL_FUNC_LOAD_2(BeginConditionalRender,GLvoid, GLuint, GLenum, "3.0")
|
64
|
+
GL_FUNC_LOAD_0(EndConditionalRender,GLvoid, "3.0")
|
65
|
+
|
66
|
+
/* #326 - GL_EXT_gpu_shader4 */
|
67
|
+
GL_FUNC_LOAD_2(VertexAttribI1i,GLvoid, GLuint,GLint, "3.0")
|
68
|
+
GL_FUNC_LOAD_3(VertexAttribI2i,GLvoid, GLuint,GLint,GLint, "3.0")
|
69
|
+
GL_FUNC_LOAD_4(VertexAttribI3i,GLvoid, GLuint,GLint,GLint,GLint, "3.0")
|
70
|
+
GL_FUNC_LOAD_5(VertexAttribI4i,GLvoid, GLuint,GLint,GLint,GLint,GLint, "3.0")
|
71
|
+
GL_FUNC_LOAD_2(VertexAttribI1ui,GLvoid, GLuint,GLuint, "3.0")
|
72
|
+
GL_FUNC_LOAD_3(VertexAttribI2ui,GLvoid, GLuint,GLuint,GLuint, "3.0")
|
73
|
+
GL_FUNC_LOAD_4(VertexAttribI3ui,GLvoid, GLuint,GLuint,GLuint,GLuint, "3.0")
|
74
|
+
GL_FUNC_LOAD_5(VertexAttribI4ui,GLvoid, GLuint,GLuint,GLuint,GLuint,GLuint, "3.0")
|
75
|
+
|
76
|
+
#define GLVERTEXATTRIB_VFUNC(_name_,_type_,_conv_,_size_) \
|
77
|
+
static void (APIENTRY * fptr_gl##_name_)(GLuint,const _type_ *); \
|
78
|
+
static VALUE \
|
79
|
+
gl_##_name_(obj,arg1,arg2) \
|
80
|
+
VALUE obj,arg1,arg2; \
|
81
|
+
{ \
|
82
|
+
_type_ value[_size_]; \
|
83
|
+
LOAD_GL_FUNC(gl##_name_, "3.0"); \
|
84
|
+
_conv_(arg2,value,_size_); \
|
85
|
+
fptr_gl##_name_(NUM2UINT(arg1),value); \
|
86
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
87
|
+
return Qnil; \
|
88
|
+
}
|
89
|
+
|
90
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI1iv,GLint,ary2cint,1)
|
91
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI2iv,GLint,ary2cint,2)
|
92
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI3iv,GLint,ary2cint,3)
|
93
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI4iv,GLint,ary2cint,4)
|
94
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI1uiv,GLuint,ary2cuint,1)
|
95
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI2uiv,GLuint,ary2cuint,2)
|
96
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI3uiv,GLuint,ary2cuint,3)
|
97
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI4uiv,GLuint,ary2cuint,4)
|
98
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI4bv,GLbyte,ary2cbyte,4)
|
99
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI4sv,GLshort,ary2cshort,4)
|
100
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI4ubv,GLubyte,ary2cubyte,4)
|
101
|
+
GLVERTEXATTRIB_VFUNC(VertexAttribI4usv,GLushort,ary2cushort,4)
|
102
|
+
#undef GLVERTEXATTRIB_VFUNC
|
103
|
+
|
104
|
+
#define GETVERTEXATTRIB_FUNC(_name_,_type_,_conv_,_extension_) \
|
105
|
+
static void (APIENTRY * fptr_gl##_name_)(GLuint,GLenum,_type_ *); \
|
106
|
+
static VALUE \
|
107
|
+
gl_##_name_(obj,arg1,arg2) \
|
108
|
+
VALUE obj,arg1,arg2; \
|
109
|
+
{ \
|
110
|
+
GLuint index; \
|
111
|
+
GLenum pname; \
|
112
|
+
_type_ params[4] = {0,0,0,0}; \
|
113
|
+
GLint size; \
|
114
|
+
LOAD_GL_FUNC(gl##_name_, _extension_); \
|
115
|
+
index = (GLuint)NUM2UINT(arg1); \
|
116
|
+
pname = (GLenum)NUM2INT(arg2); \
|
117
|
+
if (pname==GL_CURRENT_VERTEX_ATTRIB_ARB) \
|
118
|
+
size = 4; \
|
119
|
+
else \
|
120
|
+
size = 1; \
|
121
|
+
fptr_gl##_name_(index,pname,params); \
|
122
|
+
RET_ARRAY_OR_SINGLE_BOOL("gl" #_name_, size, _conv_, pname, params); \
|
123
|
+
}
|
124
|
+
|
125
|
+
GETVERTEXATTRIB_FUNC(GetVertexAttribIiv,GLint,cond_GLBOOL2RUBY,"3.0")
|
126
|
+
GETVERTEXATTRIB_FUNC(GetVertexAttribIuiv,GLuint,cond_GLBOOL2RUBY_U,"3.0")
|
127
|
+
#undef GETVERTEXATTRIB_FUNC
|
128
|
+
|
129
|
+
extern VALUE g_VertexAttrib_ptr[];
|
130
|
+
|
131
|
+
static void (APIENTRY * fptr_glVertexAttribIPointer)(GLuint,GLint,GLenum,GLsizei,const GLvoid *);
|
132
|
+
static VALUE gl_VertexAttribIPointer(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
|
133
|
+
{
|
134
|
+
GLuint index;
|
135
|
+
GLuint size;
|
136
|
+
GLenum type;
|
137
|
+
GLsizei stride;
|
138
|
+
|
139
|
+
LOAD_GL_FUNC(glVertexAttribIPointer, "3.0");
|
140
|
+
|
141
|
+
index = (GLuint)NUM2UINT(arg1);
|
142
|
+
size = (GLuint)NUM2UINT(arg2);
|
143
|
+
type = (GLenum)NUM2INT(arg3);
|
144
|
+
stride = (GLsizei)NUM2UINT(arg4);
|
145
|
+
if (index>_MAX_VERTEX_ATTRIBS)
|
146
|
+
rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
|
147
|
+
|
148
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
149
|
+
g_VertexAttrib_ptr[index] = arg5;
|
150
|
+
fptr_glVertexAttribIPointer(index,size,type,stride,(GLvoid *)NUM2SIZET(arg5));
|
151
|
+
} else {
|
152
|
+
VALUE data;
|
153
|
+
data = pack_array_or_pass_string(type,arg5);
|
154
|
+
rb_str_freeze(data);
|
155
|
+
g_VertexAttrib_ptr[index] = data;
|
156
|
+
fptr_glVertexAttribIPointer(index,size,type,stride,(GLvoid *)RSTRING_PTR(data));
|
157
|
+
}
|
158
|
+
|
159
|
+
CHECK_GLERROR_FROM("glVertexAttribIPointer");
|
160
|
+
return Qnil;
|
161
|
+
}
|
162
|
+
|
163
|
+
GL_FUNC_LOAD_2(Uniform1ui,GLvoid, GLint,GLuint, "3.0")
|
164
|
+
GL_FUNC_LOAD_3(Uniform2ui,GLvoid, GLint,GLuint,GLuint, "3.0")
|
165
|
+
GL_FUNC_LOAD_4(Uniform3ui,GLvoid, GLint,GLuint,GLuint,GLuint, "3.0")
|
166
|
+
GL_FUNC_LOAD_5(Uniform4ui,GLvoid, GLint,GLuint,GLuint,GLuint,GLuint, "3.0")
|
167
|
+
|
168
|
+
#define GLUNIFORM_VFUNC(_name_,_type_,_conv_,_size_) \
|
169
|
+
static void (APIENTRY * fptr_gl##_name_)(GLint,GLsizei,const _type_ *); \
|
170
|
+
static VALUE \
|
171
|
+
gl_##_name_(obj,arg1,arg2) \
|
172
|
+
VALUE obj,arg1,arg2; \
|
173
|
+
{ \
|
174
|
+
GLint location; \
|
175
|
+
GLsizei count; \
|
176
|
+
_type_ *value; \
|
177
|
+
LOAD_GL_FUNC(gl##_name_, "3.0"); \
|
178
|
+
Check_Type(arg2,T_ARRAY); \
|
179
|
+
count = (GLsizei)RARRAY_LENINT(arg2); \
|
180
|
+
if (count<=0 || (count % _size_) != 0) \
|
181
|
+
rb_raise(rb_eArgError, "Parameter array size must be multiplication of %i",_size_); \
|
182
|
+
location = (GLint)NUM2INT(arg1); \
|
183
|
+
value = ALLOC_N(_type_,count); \
|
184
|
+
_conv_(arg2,value,count); \
|
185
|
+
fptr_gl##_name_(location,count / _size_,value); \
|
186
|
+
xfree(value); \
|
187
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
188
|
+
return Qnil; \
|
189
|
+
}
|
190
|
+
|
191
|
+
GLUNIFORM_VFUNC(Uniform1uiv,GLuint,ary2cuint,1)
|
192
|
+
GLUNIFORM_VFUNC(Uniform2uiv,GLuint,ary2cuint,2)
|
193
|
+
GLUNIFORM_VFUNC(Uniform3uiv,GLuint,ary2cuint,3)
|
194
|
+
GLUNIFORM_VFUNC(Uniform4uiv,GLuint,ary2cuint,4)
|
195
|
+
#undef GLUNIFORM_VFUNC
|
196
|
+
|
197
|
+
static void (APIENTRY * fptr_glGetActiveUniformARB)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*);
|
198
|
+
#define GETUNIFORM_FUNC(_name_,_type_) \
|
199
|
+
static void (APIENTRY * fptr_gl##_name_)(GLuint,GLint,_type_ *); \
|
200
|
+
static VALUE \
|
201
|
+
gl_##_name_(obj,arg1,arg2) \
|
202
|
+
VALUE obj,arg1,arg2; \
|
203
|
+
{ \
|
204
|
+
GLuint program; \
|
205
|
+
GLint location; \
|
206
|
+
_type_ params[16]; \
|
207
|
+
GLint unused = 0; \
|
208
|
+
GLenum uniform_type = 0; \
|
209
|
+
GLint uniform_size = 0; \
|
210
|
+
\
|
211
|
+
LOAD_GL_FUNC(gl##_name_, "3.0"); \
|
212
|
+
LOAD_GL_FUNC(glGetActiveUniformARB, "3.0"); \
|
213
|
+
program = (GLuint)NUM2UINT(arg1); \
|
214
|
+
location = (GLint)NUM2INT(arg2); \
|
215
|
+
\
|
216
|
+
fptr_glGetActiveUniformARB(program,location,0,NULL,&unused,&uniform_type,NULL); \
|
217
|
+
CHECK_GLERROR_FROM("glGetActiveUniformARB"); \
|
218
|
+
if (uniform_type==0) \
|
219
|
+
rb_raise(rb_eTypeError, "Can't determine the uniform's type"); \
|
220
|
+
\
|
221
|
+
uniform_size = get_uniform_size(uniform_type); \
|
222
|
+
\
|
223
|
+
memset(params,0,16*sizeof(_type_)); \
|
224
|
+
fptr_gl##_name_(program,location,params); \
|
225
|
+
RET_ARRAY_OR_SINGLE("gl" #_name_, uniform_size, RETCONV_##_type_, params); \
|
226
|
+
}
|
227
|
+
|
228
|
+
GETUNIFORM_FUNC(GetUniformuiv,GLuint)
|
229
|
+
#undef GETUNIFORM_FUNC
|
230
|
+
|
231
|
+
static void (APIENTRY * fptr_glBindFragDataLocation)(GLuint,GLuint,const GLchar *);
|
232
|
+
static VALUE gl_BindFragDataLocation(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3)
|
233
|
+
{
|
234
|
+
LOAD_GL_FUNC(glBindFragDataLocation, "3.0");
|
235
|
+
Check_Type(arg3,T_STRING);
|
236
|
+
fptr_glBindFragDataLocation(NUM2UINT(arg1),NUM2UINT(arg2),RSTRING_PTR(arg3));
|
237
|
+
CHECK_GLERROR_FROM("glBindFragDataLocation");
|
238
|
+
return Qnil;
|
239
|
+
}
|
240
|
+
|
241
|
+
static GLint (APIENTRY * fptr_glGetFragDataLocation)(GLuint,const GLchar *);
|
242
|
+
static VALUE gl_GetFragDataLocation(VALUE obj,VALUE arg1,VALUE arg2)
|
243
|
+
{
|
244
|
+
GLint ret;
|
245
|
+
LOAD_GL_FUNC(glGetFragDataLocation, "3.0");
|
246
|
+
Check_Type(arg2,T_STRING);
|
247
|
+
ret = fptr_glGetFragDataLocation(NUM2UINT(arg1),RSTRING_PTR(arg2));
|
248
|
+
CHECK_GLERROR_FROM("glGetFragDataLocation");
|
249
|
+
return INT2NUM(ret);
|
250
|
+
}
|
251
|
+
|
252
|
+
/* ARB_map_buffer_range */
|
253
|
+
|
254
|
+
/* #39 GL_ARB_color_buffer_float */
|
255
|
+
|
256
|
+
GL_FUNC_LOAD_2(ClampColor,GLvoid, GLenum,GLenum, "3.0")
|
257
|
+
|
258
|
+
/* #334 GL_NV_depth_buffer_float */
|
259
|
+
|
260
|
+
GL_FUNC_LOAD_2(DepthRanged,GLvoid, GLdouble,GLdouble, "3.0")
|
261
|
+
GL_FUNC_LOAD_1(ClearDepthd,GLvoid, GLdouble, "3.0")
|
262
|
+
GL_FUNC_LOAD_2(DepthBoundsd,GLvoid, GLdouble,GLdouble, "3.0")
|
263
|
+
|
264
|
+
/* GL_ARB_framebuffer_object */
|
265
|
+
GL_FUNC_LOAD_1(IsRenderbuffer,GLboolean, GLuint, "3.0")
|
266
|
+
GL_FUNC_LOAD_2(BindRenderbuffer,GLvoid, GLenum,GLuint, "3.0")
|
267
|
+
GL_FUNC_LOAD_4(RenderbufferStorage,GLvoid, GLenum,GLenum,GLsizei,GLsizei, "3.0")
|
268
|
+
GL_FUNC_GENOBJECTS_LOAD(GenRenderbuffers,"3.0")
|
269
|
+
GL_FUNC_DELETEOBJECTS_LOAD(DeleteRenderbuffers,"3.0")
|
270
|
+
|
271
|
+
static void (APIENTRY * fptr_glGetRenderbufferParameteriv)(GLenum,GLenum,GLint *);
|
272
|
+
static VALUE gl_GetRenderbufferParameteriv(VALUE obj,VALUE arg1,VALUE arg2)
|
273
|
+
{
|
274
|
+
GLint param = 0;
|
275
|
+
LOAD_GL_FUNC(glGetRenderbufferParameteriv, "3.0");
|
276
|
+
fptr_glGetRenderbufferParameteriv(NUM2UINT(arg1),NUM2UINT(arg2),¶m);
|
277
|
+
CHECK_GLERROR_FROM("glGetRenderbufferParameteriv");
|
278
|
+
return INT2NUM(param);
|
279
|
+
}
|
280
|
+
|
281
|
+
GL_FUNC_GENOBJECTS_LOAD(GenFramebuffers,"3.0")
|
282
|
+
GL_FUNC_DELETEOBJECTS_LOAD(DeleteFramebuffers,"3.0")
|
283
|
+
GL_FUNC_LOAD_1(IsFramebuffer,GLboolean, GLuint, "3.0")
|
284
|
+
GL_FUNC_LOAD_2(BindFramebuffer,GLvoid, GLenum,GLuint, "3.0")
|
285
|
+
GL_FUNC_LOAD_1(CheckFramebufferStatus,GLenum, GLenum, "3.0")
|
286
|
+
GL_FUNC_LOAD_5(FramebufferTexture1D,GLvoid, GLenum,GLenum,GLenum,GLuint,GLint, "3.0")
|
287
|
+
GL_FUNC_LOAD_5(FramebufferTexture2D,GLvoid, GLenum,GLenum,GLenum,GLuint,GLint, "3.0")
|
288
|
+
GL_FUNC_LOAD_6(FramebufferTexture3D,GLvoid, GLenum,GLenum,GLenum,GLuint,GLint,GLint, "3.0")
|
289
|
+
GL_FUNC_LOAD_5(FramebufferTextureLayer,GLvoid, GLenum,GLenum,GLuint,GLint,GLint, "3.0")
|
290
|
+
GL_FUNC_LOAD_4(FramebufferRenderbuffer,GLvoid, GLuint,GLuint,GLuint,GLuint, "3.0")
|
291
|
+
|
292
|
+
static void (APIENTRY * fptr_glGetFramebufferAttachmentParameteriv)(GLenum,GLenum,GLenum,GLint *);
|
293
|
+
static VALUE gl_GetFramebufferAttachmentParameteriv(VALUE obj,VALUE arg1, VALUE arg2, VALUE arg3)
|
294
|
+
{
|
295
|
+
GLint ret = 0;
|
296
|
+
LOAD_GL_FUNC(glGetFramebufferAttachmentParameteriv, "3.0");
|
297
|
+
fptr_glGetFramebufferAttachmentParameteriv(NUM2UINT(arg1),NUM2UINT(arg2),NUM2UINT(arg3),&ret);
|
298
|
+
CHECK_GLERROR_FROM("glGetFramebufferAttachmentParameteriv");
|
299
|
+
return cond_GLBOOL2RUBY(NUM2UINT(arg3),ret);
|
300
|
+
}
|
301
|
+
|
302
|
+
GL_FUNC_LOAD_1(GenerateMipmap,GLvoid, GLenum, "3.0")
|
303
|
+
|
304
|
+
/* GL_NV_half_float */
|
305
|
+
|
306
|
+
/* #317 - GL_EXT_framebuffer_multisample */
|
307
|
+
GL_FUNC_LOAD_5(RenderbufferStorageMultisample,GLvoid, GLenum,GLsizei,GLenum,GLsizei,GLsizei, "3.0")
|
308
|
+
|
309
|
+
/* #316 - GL_EXT_framebuffer_blit */
|
310
|
+
GL_FUNC_LOAD_10(BlitFramebuffer,GLvoid, GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum, "3.0")
|
311
|
+
|
312
|
+
/* #343 - GL_EXT_texture_integer */
|
313
|
+
GL_FUNC_LOAD_4(ClearColorIi,GLvoid, GLint,GLint,GLint,GLint, "3.0")
|
314
|
+
GL_FUNC_LOAD_4(ClearColorIui,GLvoid, GLuint,GLuint,GLuint,GLuint, "3.0")
|
315
|
+
|
316
|
+
#define TEXPARAMETER_VFUNC(_name_,_type_,_conv_) \
|
317
|
+
static void (APIENTRY * fptr_gl##_name_)(GLenum,GLenum,_type_ *); \
|
318
|
+
static VALUE \
|
319
|
+
gl_##_name_(obj,arg1,arg2,arg3) \
|
320
|
+
VALUE obj,arg1,arg2,arg3; \
|
321
|
+
{ \
|
322
|
+
GLenum target; \
|
323
|
+
GLenum pname; \
|
324
|
+
_type_ params[4] = {0,0,0,0}; \
|
325
|
+
LOAD_GL_FUNC(gl##_name_, "3.0"); \
|
326
|
+
target = (GLenum)NUM2UINT(arg1); \
|
327
|
+
pname = (GLenum)NUM2UINT(arg2); \
|
328
|
+
Check_Type(arg3,T_ARRAY); \
|
329
|
+
_conv_(arg3,params,4); \
|
330
|
+
fptr_gl##_name_(target,pname,params); \
|
331
|
+
CHECK_GLERROR_FROM("gl" #_name_); \
|
332
|
+
return Qnil; \
|
333
|
+
}
|
334
|
+
|
335
|
+
TEXPARAMETER_VFUNC(TexParameterIiv,GLint,ary2cint)
|
336
|
+
TEXPARAMETER_VFUNC(TexParameterIuiv,GLuint,ary2cuint)
|
337
|
+
#undef TEXPARAMETER_VFUNC
|
338
|
+
|
339
|
+
#define GETTEXPARAMETER_VFUNC(_name_,_type_,_conv_) \
|
340
|
+
static void (APIENTRY * fptr_gl##_name_)(GLenum,GLenum,_type_ *); \
|
341
|
+
static VALUE \
|
342
|
+
gl_##_name_(obj,arg1,arg2) \
|
343
|
+
VALUE obj,arg1,arg2; \
|
344
|
+
{ \
|
345
|
+
GLenum target; \
|
346
|
+
GLenum pname; \
|
347
|
+
_type_ params[4] = {0,0,0,0}; \
|
348
|
+
int size; \
|
349
|
+
LOAD_GL_FUNC(gl##_name_, "3.0"); \
|
350
|
+
target = (GLenum)NUM2INT(arg1); \
|
351
|
+
pname = (GLenum)NUM2INT(arg2); \
|
352
|
+
switch(pname) { \
|
353
|
+
case GL_TEXTURE_BORDER_COLOR: \
|
354
|
+
case GL_TEXTURE_BORDER_VALUES_NV: \
|
355
|
+
case GL_POST_TEXTURE_FILTER_BIAS_SGIX: \
|
356
|
+
case GL_POST_TEXTURE_FILTER_SCALE_SGIX: \
|
357
|
+
size = 4; \
|
358
|
+
break; \
|
359
|
+
default: \
|
360
|
+
size = 1; \
|
361
|
+
break; \
|
362
|
+
} \
|
363
|
+
fptr_gl##_name_(target,pname,params); \
|
364
|
+
RET_ARRAY_OR_SINGLE_BOOL("gl" #_name_, size, _conv_, pname, params); \
|
365
|
+
}
|
366
|
+
|
367
|
+
GETTEXPARAMETER_VFUNC(GetTexParameterIiv,GLint,cond_GLBOOL2RUBY)
|
368
|
+
GETTEXPARAMETER_VFUNC(GetTexParameterIuiv,GLuint,cond_GLBOOL2RUBY_U)
|
369
|
+
#undef GETTEXPARAMETER_VFUNC
|
370
|
+
|
371
|
+
/* #340 - GL_EXT_draw_buffers2 */
|
372
|
+
GL_FUNC_LOAD_5(ColorMaski,GLvoid, GLuint,GLboolean,GLboolean,GLboolean,GLboolean, "3.0")
|
373
|
+
|
374
|
+
#define GETINDEXED_FUNC(_name_,_type_,_conv_,_extension_) \
|
375
|
+
static void (APIENTRY * fptr_gl##_name_)(GLenum,GLenum,_type_ *); \
|
376
|
+
static VALUE \
|
377
|
+
gl_##_name_(obj,arg1,arg2) \
|
378
|
+
VALUE obj,arg1,arg2; \
|
379
|
+
{ \
|
380
|
+
GLenum target; \
|
381
|
+
GLenum pname; \
|
382
|
+
_type_ result; \
|
383
|
+
LOAD_GL_FUNC(gl##_name_, _extension_); \
|
384
|
+
target = (GLenum)NUM2INT(arg1); \
|
385
|
+
pname = (GLuint)NUM2INT(arg2); \
|
386
|
+
fptr_gl##_name_(target,pname,&result); \
|
387
|
+
return _conv_(result); \
|
388
|
+
}
|
389
|
+
|
390
|
+
GETINDEXED_FUNC(GetBooleani_v, GLboolean, GLBOOL2RUBY, "3.0")
|
391
|
+
GETINDEXED_FUNC(GetIntegeri_v, GLint, INT2NUM, "3.0")
|
392
|
+
#undef GETINDEXED_FUNC
|
393
|
+
|
394
|
+
GL_FUNC_LOAD_2(Enablei,GLvoid, GLenum,GLuint, "3.0")
|
395
|
+
GL_FUNC_LOAD_2(Disablei,GLvoid, GLenum,GLuint, "3.0")
|
396
|
+
GL_FUNC_LOAD_2(IsEnabledi,GLvoid, GLenum,GLuint, "3.0")
|
397
|
+
|
398
|
+
void gl_init_functions_3_0(VALUE module)
|
399
|
+
{
|
400
|
+
/* GL_NV_conditional_render */
|
401
|
+
rb_define_module_function(module, "glBeginConditionalRender", gl_BeginConditionalRender, 2);
|
402
|
+
rb_define_module_function(module, "glEndConditionalRender", gl_EndConditionalRender, 0);
|
403
|
+
|
404
|
+
/* #326 - GL_EXT_gpu_shader4 */
|
405
|
+
rb_define_module_function(module, "glVertexAttribI1i", gl_VertexAttribI1i, 2);
|
406
|
+
rb_define_module_function(module, "glVertexAttribI2i", gl_VertexAttribI2i, 3);
|
407
|
+
rb_define_module_function(module, "glVertexAttribI3i", gl_VertexAttribI3i, 4);
|
408
|
+
rb_define_module_function(module, "glVertexAttribI4i", gl_VertexAttribI4i, 5);
|
409
|
+
rb_define_module_function(module, "glVertexAttribI1ui", gl_VertexAttribI1ui, 2);
|
410
|
+
rb_define_module_function(module, "glVertexAttribI2ui", gl_VertexAttribI2ui, 3);
|
411
|
+
rb_define_module_function(module, "glVertexAttribI3ui", gl_VertexAttribI3ui, 4);
|
412
|
+
rb_define_module_function(module, "glVertexAttribI4ui", gl_VertexAttribI4ui, 5);
|
413
|
+
rb_define_module_function(module, "glVertexAttribI1iv", gl_VertexAttribI1iv, 2);
|
414
|
+
rb_define_module_function(module, "glVertexAttribI2iv", gl_VertexAttribI2iv, 2);
|
415
|
+
rb_define_module_function(module, "glVertexAttribI3iv", gl_VertexAttribI3iv, 2);
|
416
|
+
rb_define_module_function(module, "glVertexAttribI4iv", gl_VertexAttribI4iv, 2);
|
417
|
+
rb_define_module_function(module, "glVertexAttribI1uiv", gl_VertexAttribI1uiv, 2);
|
418
|
+
rb_define_module_function(module, "glVertexAttribI2uiv", gl_VertexAttribI2uiv, 2);
|
419
|
+
rb_define_module_function(module, "glVertexAttribI3uiv", gl_VertexAttribI3uiv, 2);
|
420
|
+
rb_define_module_function(module, "glVertexAttribI4uiv", gl_VertexAttribI4uiv, 2);
|
421
|
+
rb_define_module_function(module, "glVertexAttribI4bv", gl_VertexAttribI4bv, 2);
|
422
|
+
rb_define_module_function(module, "glVertexAttribI4sv", gl_VertexAttribI4sv, 2);
|
423
|
+
rb_define_module_function(module, "glVertexAttribI4ubv", gl_VertexAttribI4ubv, 2);
|
424
|
+
rb_define_module_function(module, "glVertexAttribI4usv", gl_VertexAttribI4usv, 2);
|
425
|
+
rb_define_module_function(module, "glVertexAttribIPointer", gl_VertexAttribIPointer, 5);
|
426
|
+
rb_define_module_function(module, "glGetVertexAttribIiv", gl_GetVertexAttribIiv, 2);
|
427
|
+
rb_define_module_function(module, "glGetVertexAttribIuiv", gl_GetVertexAttribIuiv, 2);
|
428
|
+
rb_define_module_function(module, "glUniform1ui", gl_Uniform1ui, 2);
|
429
|
+
rb_define_module_function(module, "glUniform2ui", gl_Uniform2ui, 3);
|
430
|
+
rb_define_module_function(module, "glUniform3ui", gl_Uniform3ui, 4);
|
431
|
+
rb_define_module_function(module, "glUniform4ui", gl_Uniform4ui, 5);
|
432
|
+
rb_define_module_function(module, "glUniform1uiv", gl_Uniform1uiv, 2);
|
433
|
+
rb_define_module_function(module, "glUniform2uiv", gl_Uniform2uiv, 2);
|
434
|
+
rb_define_module_function(module, "glUniform3uiv", gl_Uniform3uiv, 2);
|
435
|
+
rb_define_module_function(module, "glUniform4uiv", gl_Uniform4uiv, 2);
|
436
|
+
rb_define_module_function(module, "glGetUniformuiv", gl_GetUniformuiv, 2);
|
437
|
+
rb_define_module_function(module, "glBindFragDataLocation", gl_BindFragDataLocation, 3);
|
438
|
+
rb_define_module_function(module, "glGetFragDataLocation", gl_GetFragDataLocation, 2);
|
439
|
+
|
440
|
+
/* GL_NV_conditional_render */
|
441
|
+
|
442
|
+
/* GL_APPLE_flush_buffer_range */
|
443
|
+
|
444
|
+
/* #39 GL_ARB_color_buffer_float */
|
445
|
+
rb_define_module_function(module, "glClampColor", gl_ClampColor, 2);
|
446
|
+
|
447
|
+
/* #334 GL_NV_depth_buffer_float */
|
448
|
+
rb_define_module_function(module, "glDepthRanged", gl_DepthRanged, 2);
|
449
|
+
rb_define_module_function(module, "glClearDepthd", gl_ClearDepthd, 1);
|
450
|
+
rb_define_module_function(module, "glDepthBoundsd", gl_DepthBoundsd, 2);
|
451
|
+
|
452
|
+
/* #310 - GL_EXT_framebuffer_object */
|
453
|
+
rb_define_module_function(module, "glIsRenderbuffer", gl_IsRenderbuffer, 1);
|
454
|
+
rb_define_module_function(module, "glBindRenderbuffer", gl_BindRenderbuffer, 2);
|
455
|
+
rb_define_module_function(module, "glDeleteRenderbuffers", gl_DeleteRenderbuffers, 1);
|
456
|
+
rb_define_module_function(module, "glGenRenderbuffers", gl_GenRenderbuffers, 1);
|
457
|
+
rb_define_module_function(module, "glRenderbufferStorage", gl_RenderbufferStorage, 4);
|
458
|
+
rb_define_module_function(module, "glGetRenderbufferParameteriv", gl_GetRenderbufferParameteriv, 2);
|
459
|
+
rb_define_module_function(module, "glIsFramebuffer", gl_IsFramebuffer, 1);
|
460
|
+
rb_define_module_function(module, "glBindFramebuffer", gl_BindFramebuffer, 2);
|
461
|
+
rb_define_module_function(module, "glDeleteFramebuffers", gl_DeleteFramebuffers, 1);
|
462
|
+
rb_define_module_function(module, "glGenFramebuffers", gl_GenFramebuffers, 1);
|
463
|
+
rb_define_module_function(module, "glCheckFramebufferStatus", gl_CheckFramebufferStatus, 1);
|
464
|
+
rb_define_module_function(module, "glFramebufferTexture1D", gl_FramebufferTexture1D, 5);
|
465
|
+
rb_define_module_function(module, "glFramebufferTexture2D", gl_FramebufferTexture2D, 5);
|
466
|
+
rb_define_module_function(module, "glFramebufferTexture3D", gl_FramebufferTexture3D, 6);
|
467
|
+
rb_define_module_function(module, "glFramebufferRenderbuffer", gl_FramebufferRenderbuffer, 4);
|
468
|
+
rb_define_module_function(module, "glFramebufferTextureLayer", gl_FramebufferTextureLayer, 5);
|
469
|
+
rb_define_module_function(module, "glGetFramebufferAttachmentParameteriv", gl_GetFramebufferAttachmentParameteriv, 3);
|
470
|
+
rb_define_module_function(module, "glGenerateMipmap", gl_GenerateMipmap, 1);
|
471
|
+
|
472
|
+
/* #317 - GL_EXT_framebuffer_multisample */
|
473
|
+
rb_define_module_function(module, "glRenderbufferStorageMultisample", gl_RenderbufferStorageMultisample, 5);
|
474
|
+
|
475
|
+
/* #316 - GL_EXT_framebuffer_blit */
|
476
|
+
rb_define_module_function(module, "glBlitFramebuffer", gl_BlitFramebuffer, 10);
|
477
|
+
|
478
|
+
/* #343 - GL_EXT_texture_integer */
|
479
|
+
rb_define_module_function(module, "glClearColorIi", gl_ClearColorIi, 4);
|
480
|
+
rb_define_module_function(module, "glClearColorIui", gl_ClearColorIui, 4);
|
481
|
+
rb_define_module_function(module, "glTexParameterIiv", gl_TexParameterIiv, 3);
|
482
|
+
rb_define_module_function(module, "glTexParameterIuiv", gl_TexParameterIuiv, 3);
|
483
|
+
rb_define_module_function(module, "glGetTexParameterIiv", gl_GetTexParameterIiv, 2);
|
484
|
+
rb_define_module_function(module, "glGetTexParameterIuiv", gl_GetTexParameterIuiv, 2);
|
485
|
+
|
486
|
+
/* #340 - GL_EXT_draw_buffers2 */
|
487
|
+
rb_define_module_function(module, "glColorMaski", gl_ColorMaski, 5);
|
488
|
+
rb_define_module_function(module, "glGetBooleani_v", gl_GetBooleani_v, 2);
|
489
|
+
rb_define_module_function(module, "glGetIntegeri_v", gl_GetIntegeri_v, 2);
|
490
|
+
rb_define_module_function(module, "glEnablei", gl_Enablei, 2);
|
491
|
+
rb_define_module_function(module, "glDisablei", gl_Disablei, 2);
|
492
|
+
rb_define_module_function(module, "glIsEnabledi", gl_IsEnabledi, 2);
|
493
|
+
}
|