opengl 0.9.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +3 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +29 -0
  5. data/.gemtest +0 -0
  6. data/.gitignore +6 -0
  7. data/.travis.yml +19 -0
  8. data/History.rdoc +77 -0
  9. data/MIT-LICENSE +18 -0
  10. data/Manifest.txt +138 -0
  11. data/README.rdoc +102 -0
  12. data/Rakefile +60 -0
  13. data/examples/NeHe/NeHe.png +0 -0
  14. data/examples/NeHe/crate.png +0 -0
  15. data/examples/NeHe/glass.png +0 -0
  16. data/examples/NeHe/nehe_lesson02.rb +117 -0
  17. data/examples/NeHe/nehe_lesson03.rb +123 -0
  18. data/examples/NeHe/nehe_lesson04.rb +132 -0
  19. data/examples/NeHe/nehe_lesson05.rb +182 -0
  20. data/examples/NeHe/nehe_lesson06.rb +186 -0
  21. data/examples/NeHe/nehe_lesson07.rb +240 -0
  22. data/examples/NeHe/nehe_lesson08.rb +255 -0
  23. data/examples/NeHe/nehe_lesson09.rb +203 -0
  24. data/examples/NeHe/nehe_lesson11.rb +176 -0
  25. data/examples/NeHe/nehe_lesson12.rb +203 -0
  26. data/examples/NeHe/nehe_lesson16.rb +211 -0
  27. data/examples/NeHe/nehe_lesson19.rb +209 -0
  28. data/examples/NeHe/nehe_lesson36.rb +308 -0
  29. data/examples/NeHe/particle.png +0 -0
  30. data/examples/NeHe/star.png +0 -0
  31. data/examples/NeHe/tim.png +0 -0
  32. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  33. data/examples/OrangeBook/brick.frag +36 -0
  34. data/examples/OrangeBook/brick.rb +378 -0
  35. data/examples/OrangeBook/brick.vert +41 -0
  36. data/examples/OrangeBook/particle.frag +17 -0
  37. data/examples/OrangeBook/particle.rb +408 -0
  38. data/examples/OrangeBook/particle.vert +38 -0
  39. data/examples/README +16 -0
  40. data/examples/RedBook/aapoly.rb +143 -0
  41. data/examples/RedBook/aargb.rb +121 -0
  42. data/examples/RedBook/accanti.rb +164 -0
  43. data/examples/RedBook/accpersp.rb +217 -0
  44. data/examples/RedBook/alpha.rb +125 -0
  45. data/examples/RedBook/alpha3D.rb +160 -0
  46. data/examples/RedBook/bezcurve.rb +107 -0
  47. data/examples/RedBook/bezmesh.rb +139 -0
  48. data/examples/RedBook/checker.rb +126 -0
  49. data/examples/RedBook/clip.rb +97 -0
  50. data/examples/RedBook/colormat.rb +137 -0
  51. data/examples/RedBook/cube.rb +71 -0
  52. data/examples/RedBook/depthcue.rb +101 -0
  53. data/examples/RedBook/dof.rb +206 -0
  54. data/examples/RedBook/double.rb +107 -0
  55. data/examples/RedBook/drawf.rb +93 -0
  56. data/examples/RedBook/feedback.rb +147 -0
  57. data/examples/RedBook/fog.rb +168 -0
  58. data/examples/RedBook/font.rb +153 -0
  59. data/examples/RedBook/hello.rb +81 -0
  60. data/examples/RedBook/image.rb +139 -0
  61. data/examples/RedBook/jitter.rb +207 -0
  62. data/examples/RedBook/light.rb +155 -0
  63. data/examples/RedBook/lines.rb +130 -0
  64. data/examples/RedBook/list.rb +113 -0
  65. data/examples/RedBook/material.rb +276 -0
  66. data/examples/RedBook/mipmap.rb +158 -0
  67. data/examples/RedBook/model.rb +115 -0
  68. data/examples/RedBook/movelight.rb +134 -0
  69. data/examples/RedBook/pickdepth.rb +181 -0
  70. data/examples/RedBook/planet.rb +110 -0
  71. data/examples/RedBook/quadric.rb +160 -0
  72. data/examples/RedBook/robot.rb +117 -0
  73. data/examples/RedBook/select.rb +198 -0
  74. data/examples/RedBook/smooth.rb +97 -0
  75. data/examples/RedBook/stencil.rb +165 -0
  76. data/examples/RedBook/stroke.rb +169 -0
  77. data/examples/RedBook/surface.rb +168 -0
  78. data/examples/RedBook/teaambient.rb +134 -0
  79. data/examples/RedBook/teapots.rb +184 -0
  80. data/examples/RedBook/tess.rb +185 -0
  81. data/examples/RedBook/texbind.rb +149 -0
  82. data/examples/RedBook/texgen.rb +171 -0
  83. data/examples/RedBook/texturesurf.rb +130 -0
  84. data/examples/RedBook/varray.rb +161 -0
  85. data/examples/RedBook/wrap.rb +150 -0
  86. data/examples/misc/OGLBench.rb +338 -0
  87. data/examples/misc/anisotropic.rb +196 -0
  88. data/examples/misc/fbo_test.rb +357 -0
  89. data/examples/misc/font-glut.rb +47 -0
  90. data/examples/misc/glfwtest.rb +30 -0
  91. data/examples/misc/plane.rb +161 -0
  92. data/examples/misc/readpixel.rb +66 -0
  93. data/examples/misc/sdltest.rb +36 -0
  94. data/examples/misc/trislam.rb +829 -0
  95. data/ext/opengl/common.h +428 -0
  96. data/ext/opengl/conv.h +244 -0
  97. data/ext/opengl/extconf.rb +47 -0
  98. data/ext/opengl/funcdef.h +313 -0
  99. data/ext/opengl/gl-1.0-1.1.c +3075 -0
  100. data/ext/opengl/gl-1.2.c +155 -0
  101. data/ext/opengl/gl-1.3.c +443 -0
  102. data/ext/opengl/gl-1.4.c +348 -0
  103. data/ext/opengl/gl-1.5.c +224 -0
  104. data/ext/opengl/gl-2.0.c +667 -0
  105. data/ext/opengl/gl-2.1.c +57 -0
  106. data/ext/opengl/gl-3.0.c +493 -0
  107. data/ext/opengl/gl-enums.c +4873 -0
  108. data/ext/opengl/gl-enums.h +14588 -0
  109. data/ext/opengl/gl-error.c +112 -0
  110. data/ext/opengl/gl-error.h +28 -0
  111. data/ext/opengl/gl-ext-3dfx.c +27 -0
  112. data/ext/opengl/gl-ext-arb.c +875 -0
  113. data/ext/opengl/gl-ext-ati.c +41 -0
  114. data/ext/opengl/gl-ext-ext.c +889 -0
  115. data/ext/opengl/gl-ext-gremedy.c +41 -0
  116. data/ext/opengl/gl-ext-nv.c +680 -0
  117. data/ext/opengl/gl-types.h +67 -0
  118. data/ext/opengl/gl.c +220 -0
  119. data/ext/opengl/gl_buffer.c +177 -0
  120. data/ext/opengl/opengl.c +7 -0
  121. data/lib/gl.rb +1 -0
  122. data/lib/opengl.rb +53 -0
  123. data/lib/opengl/2.0/opengl.so +0 -0
  124. data/lib/opengl/2.1/opengl.so +0 -0
  125. data/lib/opengl/test_case.rb +86 -0
  126. data/test/dummy.xorg.conf +140 -0
  127. data/test/test_gl.rb +38 -0
  128. data/test/test_gl_10_11.rb +1363 -0
  129. data/test/test_gl_12.rb +71 -0
  130. data/test/test_gl_13.rb +221 -0
  131. data/test/test_gl_14.rb +218 -0
  132. data/test/test_gl_15.rb +258 -0
  133. data/test/test_gl_20.rb +417 -0
  134. data/test/test_gl_21.rb +436 -0
  135. data/test/test_gl_ext_arb.rb +508 -0
  136. data/test/test_gl_ext_ati.rb +28 -0
  137. data/test/test_gl_ext_ext.rb +608 -0
  138. data/test/test_gl_ext_gremedy.rb +29 -0
  139. data/test/test_gl_ext_nv.rb +349 -0
  140. data/test/test_opengl_buffer.rb +120 -0
  141. data/utils/README +6 -0
  142. data/utils/enumgen.rb +108 -0
  143. data/utils/extlistgen.rb +90 -0
  144. metadata +319 -0
  145. metadata.gz.sig +1 -0
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
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
+ #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) \
22
+ VALUE obj,arg1,arg2,arg3; \
23
+ { \
24
+ GLint location; \
25
+ GLsizei count; \
26
+ GLboolean transpose; \
27
+ GLfloat *value; \
28
+ LOAD_GL_FUNC(glUniformMatrix##_x_##x##_y_##fv,"2.1"); \
29
+ location = (GLint)NUM2INT(arg1); \
30
+ count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3),rb_intern("flatten"),0)); \
31
+ transpose = (GLboolean)RUBYBOOL2GL(arg2); \
32
+ value = ALLOC_N(GLfloat, count); \
33
+ ary2cmatfloatcount(arg3,value, _x_, _y_); \
34
+ fptr_glUniformMatrix##_x_##x##_y_##fv(location,count /(_x_ * _y_),transpose,value); \
35
+ xfree(value); \
36
+ CHECK_GLERROR_FROM("glUniformMatrix" #_x_ "x" #_y_ "fv"); \
37
+ return Qnil; \
38
+ }
39
+
40
+ UNIFORMMATRIX_FUNC(2,3)
41
+ UNIFORMMATRIX_FUNC(3,2)
42
+ UNIFORMMATRIX_FUNC(2,4)
43
+ UNIFORMMATRIX_FUNC(4,2)
44
+ UNIFORMMATRIX_FUNC(3,4)
45
+ UNIFORMMATRIX_FUNC(4,3)
46
+
47
+ #undef UNIFORMMATRIX_FUNC
48
+
49
+ void gl_init_functions_2_1(VALUE module)
50
+ {
51
+ rb_define_module_function(module, "glUniformMatrix2x3fv", gl_UniformMatrix2x3fv, 3);
52
+ rb_define_module_function(module, "glUniformMatrix3x2fv", gl_UniformMatrix3x2fv, 3);
53
+ rb_define_module_function(module, "glUniformMatrix2x4fv", gl_UniformMatrix2x4fv, 3);
54
+ rb_define_module_function(module, "glUniformMatrix4x2fv", gl_UniformMatrix4x2fv, 3);
55
+ rb_define_module_function(module, "glUniformMatrix3x4fv", gl_UniformMatrix3x4fv, 3);
56
+ rb_define_module_function(module, "glUniformMatrix4x3fv", gl_UniformMatrix4x3fv, 3);
57
+ }
@@ -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),&param);
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
+ }