opengl 0.7.0.pre1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +8 -0
  3. data/History.txt +36 -0
  4. data/MIT-LICENSE +18 -0
  5. data/Manifest.txt +140 -0
  6. data/README.rdoc +51 -0
  7. data/Rakefile +129 -0
  8. data/Rakefile.cross +104 -0
  9. data/doc/build_install.txt +119 -0
  10. data/doc/extensions.txt.in +348 -0
  11. data/doc/history.txt +66 -0
  12. data/doc/requirements_and_design.txt +117 -0
  13. data/doc/roadmap.txt +28 -0
  14. data/doc/scientific_use.txt +35 -0
  15. data/doc/supplies/page_template.html +71 -0
  16. data/doc/thanks.txt +29 -0
  17. data/doc/tutorial.txt +469 -0
  18. data/examples/NeHe/nehe_lesson02.rb +117 -0
  19. data/examples/NeHe/nehe_lesson03.rb +122 -0
  20. data/examples/NeHe/nehe_lesson04.rb +133 -0
  21. data/examples/NeHe/nehe_lesson05.rb +186 -0
  22. data/examples/NeHe/nehe_lesson36.rb +303 -0
  23. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  24. data/examples/OrangeBook/brick.frag +36 -0
  25. data/examples/OrangeBook/brick.rb +376 -0
  26. data/examples/OrangeBook/brick.vert +41 -0
  27. data/examples/OrangeBook/particle.frag +17 -0
  28. data/examples/OrangeBook/particle.rb +406 -0
  29. data/examples/OrangeBook/particle.vert +38 -0
  30. data/examples/README +16 -0
  31. data/examples/RedBook/aapoly.rb +142 -0
  32. data/examples/RedBook/aargb.rb +119 -0
  33. data/examples/RedBook/accanti.rb +162 -0
  34. data/examples/RedBook/accpersp.rb +215 -0
  35. data/examples/RedBook/alpha.rb +123 -0
  36. data/examples/RedBook/alpha3D.rb +158 -0
  37. data/examples/RedBook/bezcurve.rb +105 -0
  38. data/examples/RedBook/bezmesh.rb +137 -0
  39. data/examples/RedBook/checker.rb +124 -0
  40. data/examples/RedBook/clip.rb +95 -0
  41. data/examples/RedBook/colormat.rb +135 -0
  42. data/examples/RedBook/cube.rb +69 -0
  43. data/examples/RedBook/depthcue.rb +99 -0
  44. data/examples/RedBook/dof.rb +205 -0
  45. data/examples/RedBook/double.rb +105 -0
  46. data/examples/RedBook/drawf.rb +91 -0
  47. data/examples/RedBook/feedback.rb +145 -0
  48. data/examples/RedBook/fog.rb +167 -0
  49. data/examples/RedBook/font.rb +151 -0
  50. data/examples/RedBook/hello.rb +79 -0
  51. data/examples/RedBook/image.rb +137 -0
  52. data/examples/RedBook/jitter.rb +207 -0
  53. data/examples/RedBook/lines.rb +128 -0
  54. data/examples/RedBook/list.rb +111 -0
  55. data/examples/RedBook/material.rb +275 -0
  56. data/examples/RedBook/mipmap.rb +156 -0
  57. data/examples/RedBook/model.rb +113 -0
  58. data/examples/RedBook/movelight.rb +132 -0
  59. data/examples/RedBook/pickdepth.rb +179 -0
  60. data/examples/RedBook/planet.rb +108 -0
  61. data/examples/RedBook/quadric.rb +158 -0
  62. data/examples/RedBook/robot.rb +115 -0
  63. data/examples/RedBook/select.rb +196 -0
  64. data/examples/RedBook/smooth.rb +95 -0
  65. data/examples/RedBook/stencil.rb +163 -0
  66. data/examples/RedBook/stroke.rb +167 -0
  67. data/examples/RedBook/surface.rb +166 -0
  68. data/examples/RedBook/teaambient.rb +132 -0
  69. data/examples/RedBook/teapots.rb +182 -0
  70. data/examples/RedBook/tess.rb +183 -0
  71. data/examples/RedBook/texbind.rb +147 -0
  72. data/examples/RedBook/texgen.rb +169 -0
  73. data/examples/RedBook/texturesurf.rb +128 -0
  74. data/examples/RedBook/varray.rb +159 -0
  75. data/examples/RedBook/wrap.rb +148 -0
  76. data/examples/misc/OGLBench.rb +337 -0
  77. data/examples/misc/anisotropic.rb +194 -0
  78. data/examples/misc/fbo_test.rb +356 -0
  79. data/examples/misc/font-glut.rb +46 -0
  80. data/examples/misc/glfwtest.rb +30 -0
  81. data/examples/misc/plane.rb +161 -0
  82. data/examples/misc/readpixel.rb +65 -0
  83. data/examples/misc/sdltest.rb +34 -0
  84. data/examples/misc/trislam.rb +828 -0
  85. data/ext/common/common.h +448 -0
  86. data/ext/common/conv.h +234 -0
  87. data/ext/common/funcdef.h +280 -0
  88. data/ext/common/gl-enums.h +10031 -0
  89. data/ext/common/gl-error.h +23 -0
  90. data/ext/common/gl-types.h +67 -0
  91. data/ext/common/glu-enums.h +463 -0
  92. data/ext/gl/extconf.rb +43 -0
  93. data/ext/gl/gl-1.0-1.1.c +2811 -0
  94. data/ext/gl/gl-1.2.c +814 -0
  95. data/ext/gl/gl-1.3.c +443 -0
  96. data/ext/gl/gl-1.4.c +348 -0
  97. data/ext/gl/gl-1.5.c +225 -0
  98. data/ext/gl/gl-2.0.c +657 -0
  99. data/ext/gl/gl-2.1.c +57 -0
  100. data/ext/gl/gl-enums.c +3354 -0
  101. data/ext/gl/gl-error.c +104 -0
  102. data/ext/gl/gl-ext-3dfx.c +27 -0
  103. data/ext/gl/gl-ext-arb.c +866 -0
  104. data/ext/gl/gl-ext-ati.c +41 -0
  105. data/ext/gl/gl-ext-ext.c +889 -0
  106. data/ext/gl/gl-ext-gremedy.c +41 -0
  107. data/ext/gl/gl-ext-nv.c +679 -0
  108. data/ext/gl/gl.c +216 -0
  109. data/ext/glu/extconf.rb +51 -0
  110. data/ext/glu/glu-enums.c +164 -0
  111. data/ext/glu/glu.c +1530 -0
  112. data/ext/glut/extconf.rb +67 -0
  113. data/ext/glut/glut.c +1624 -0
  114. data/lib/opengl.rb +89 -0
  115. data/test/README +10 -0
  116. data/test/tc_common.rb +98 -0
  117. data/test/tc_ext_arb.rb +467 -0
  118. data/test/tc_ext_ati.rb +33 -0
  119. data/test/tc_ext_ext.rb +551 -0
  120. data/test/tc_ext_gremedy.rb +36 -0
  121. data/test/tc_ext_nv.rb +357 -0
  122. data/test/tc_func_10_11.rb +1281 -0
  123. data/test/tc_func_12.rb +186 -0
  124. data/test/tc_func_13.rb +229 -0
  125. data/test/tc_func_14.rb +197 -0
  126. data/test/tc_func_15.rb +270 -0
  127. data/test/tc_func_20.rb +346 -0
  128. data/test/tc_func_21.rb +541 -0
  129. data/test/tc_glu.rb +310 -0
  130. data/test/tc_include_gl.rb +35 -0
  131. data/test/tc_misc.rb +54 -0
  132. data/test/tc_require_gl.rb +34 -0
  133. data/utils/README +11 -0
  134. data/utils/enumgen.rb +112 -0
  135. data/utils/extlistgen.rb +90 -0
  136. data/utils/mkdn2html.rb +59 -0
  137. data/utils/post-mkdn2html.rb +91 -0
  138. data/website/images/ogl.jpg +0 -0
  139. data/website/images/tab_bottom.gif +0 -0
  140. data/website/style.css +198 -0
  141. metadata +274 -0
@@ -0,0 +1,41 @@
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/common.h"
17
+
18
+ /* OpenGL ATI extensions */
19
+
20
+ /* #277 GL_ATI_draw_buffers */
21
+ static void (APIENTRY * fptr_glDrawBuffersATI)(GLsizei,const GLenum *);
22
+ static VALUE gl_DrawBuffersATI(VALUE obj,VALUE arg1)
23
+ {
24
+ GLsizei size;
25
+ GLenum *buffers;
26
+ LOAD_GL_FUNC(glDrawBuffersATI,"GL_ATI_draw_buffers")
27
+ Check_Type(arg1,T_ARRAY);
28
+ size = (GLsizei)RARRAY_LENINT(arg1);
29
+ buffers = ALLOC_N(GLenum,size);
30
+ ary2cuint(arg1,buffers,size);
31
+ fptr_glDrawBuffersATI(size,buffers);
32
+ xfree(buffers);
33
+ CHECK_GLERROR
34
+ return Qnil;
35
+ }
36
+
37
+ void gl_init_functions_ext_ati(VALUE module)
38
+ {
39
+ /* #277 GL_ATI_draw_buffers */
40
+ rb_define_module_function(module, "glDrawBuffersATI", gl_DrawBuffersATI, 1);
41
+ }
@@ -0,0 +1,889 @@
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/common.h"
17
+
18
+ /* OpenGL EXT extensions */
19
+ /* Those are extensions that are not blessed by ARB committee but were
20
+ created or agreed upon by multiple vendors */
21
+
22
+ /* #2 - GL_EXT_blend_color */
23
+ GL_FUNC_LOAD_4(BlendColorEXT,GLvoid, GLclampf,GLclampf,GLclampf,GLclampf, "GL_EXT_blend_color")
24
+
25
+ /* #3 - GL_EXT_polygon_offset */
26
+ GL_FUNC_LOAD_2(PolygonOffsetEXT,GLvoid, GLfloat,GLfloat, "GL_EXT_polygon_offset")
27
+
28
+ /* #20 - GL_EXT_texture_object */
29
+ GL_FUNC_GENOBJECTS_LOAD(GenTexturesEXT,"GL_EXT_texture_object")
30
+ GL_FUNC_DELETEOBJECTS_LOAD(DeleteTexturesEXT,"GL_EXT_texture_object")
31
+ GL_FUNC_LOAD_2(BindTextureEXT,GLvoid, GLenum,GLint, "GL_EXT_texture_object")
32
+
33
+ static void (APIENTRY * fptr_glPrioritizeTexturesEXT)(GLsizei,const GLuint *,const GLclampf *);
34
+ static VALUE
35
+ gl_PrioritizeTexturesEXT(obj,arg1,arg2)
36
+ VALUE obj,arg1,arg2;
37
+ {
38
+ GLuint *textures;
39
+ GLclampf *priorities;
40
+ GLsizei size;
41
+ LOAD_GL_FUNC(glPrioritizeTexturesEXT,"GL_EXT_texture_object")
42
+ Check_Type(arg1,T_ARRAY);
43
+ Check_Type(arg2,T_ARRAY);
44
+ if ((size = (GLsizei)RARRAY_LENINT(arg1)) != (GLsizei)RARRAY_LENINT(arg2))
45
+ rb_raise(rb_eArgError, "passed arrays must have the same length");
46
+ textures = ALLOC_N(GLuint,size);
47
+ priorities = ALLOC_N(GLclampf,size);
48
+ ary2cuint(arg1,textures,size);
49
+ ary2cflt(arg2,priorities,size);
50
+ fptr_glPrioritizeTexturesEXT(size,textures,priorities);
51
+ xfree(textures);
52
+ xfree(priorities);
53
+ CHECK_GLERROR
54
+ return Qnil;
55
+ }
56
+
57
+ static GLboolean (APIENTRY * fptr_glAreTexturesResidentEXT)(GLsizei,const GLuint *,GLboolean *);
58
+ static VALUE
59
+ gl_AreTexturesResidentEXT(obj,arg1)
60
+ VALUE obj,arg1;
61
+ {
62
+ GLuint *textures;
63
+ GLboolean *residences;
64
+ GLsizei size;
65
+ GLboolean r;
66
+ VALUE retary;
67
+ VALUE ary;
68
+ int i;
69
+ LOAD_GL_FUNC(glAreTexturesResidentEXT,"GL_EXT_texture_object")
70
+ ary = rb_Array(arg1);
71
+ size = (GLsizei)RARRAY_LENINT(ary);
72
+ textures = ALLOC_N(GLuint,size);
73
+ residences = ALLOC_N(GLboolean,size);
74
+ ary2cuint(ary,textures,size);
75
+ r = fptr_glAreTexturesResidentEXT(size,textures,residences);
76
+ retary = rb_ary_new2(size);
77
+ if (r==GL_TRUE) { /* all are resident */
78
+ for(i=0;i<size;i++)
79
+ rb_ary_push(retary, GLBOOL2RUBY(GL_TRUE));
80
+ } else {
81
+ for(i=0;i<size;i++)
82
+ rb_ary_push(retary, GLBOOL2RUBY(residences[i]));
83
+ }
84
+ xfree(textures);
85
+ xfree(residences);
86
+ CHECK_GLERROR
87
+ return retary;
88
+ }
89
+
90
+ GL_FUNC_LOAD_1(IsTextureEXT,GLboolean, GLuint, "GL_EXT_texture_object")
91
+
92
+ /* #37 - GL_EXT_blend_minmax */
93
+ GL_FUNC_LOAD_1(BlendEquationEXT,GLvoid, GLenum, "GL_EXT_blend_minmax")
94
+
95
+ /* #54 - GL_EXT_point_parameters */
96
+ GL_FUNC_LOAD_2(PointParameterfEXT,GLvoid, GLenum,GLfloat, "GL_EXT_point_parameters")
97
+
98
+ static void (APIENTRY * fptr_glPointParameterfvEXT)(GLenum,GLfloat *);
99
+ static VALUE gl_PointParameterfvEXT(VALUE obj,VALUE arg1,VALUE arg2)
100
+ {
101
+ GLfloat params[3] = {(GLfloat)0.0,(GLfloat)0.0,(GLfloat)0.0};
102
+ GLenum pname;
103
+ GLint size;
104
+ LOAD_GL_FUNC(glPointParameterfvEXT,"GL_EXT_point_parameters")
105
+ pname = NUM2UINT(arg1);
106
+ Check_Type(arg2,T_ARRAY);
107
+ if (pname==GL_POINT_DISTANCE_ATTENUATION)
108
+ size = 3;
109
+ else
110
+ size = 1;
111
+ ary2cflt(arg2,params,size);
112
+ fptr_glPointParameterfvEXT(pname,params);
113
+ CHECK_GLERROR
114
+ return Qnil;
115
+ }
116
+
117
+ /* #145 - GL_EXT_secondary_color */
118
+ GL_FUNC_LOAD_3(SecondaryColor3bEXT,GLvoid, GLbyte,GLbyte,GLbyte, "GL_EXT_secondary_color")
119
+ GL_FUNC_LOAD_3(SecondaryColor3sEXT,GLvoid, GLshort,GLshort,GLshort, "GL_EXT_secondary_color")
120
+ GL_FUNC_LOAD_3(SecondaryColor3iEXT,GLvoid, GLint,GLint,GLint, "GL_EXT_secondary_color")
121
+ GL_FUNC_LOAD_3(SecondaryColor3fEXT,GLvoid, GLfloat,GLfloat,GLfloat, "GL_EXT_secondary_color")
122
+ GL_FUNC_LOAD_3(SecondaryColor3dEXT,GLvoid, GLdouble,GLdouble,GLdouble, "GL_EXT_secondary_color")
123
+ GL_FUNC_LOAD_3(SecondaryColor3ubEXT,GLvoid, GLubyte,GLubyte,GLubyte, "GL_EXT_secondary_color")
124
+ GL_FUNC_LOAD_3(SecondaryColor3usEXT,GLvoid, GLushort,GLushort,GLushort, "GL_EXT_secondary_color")
125
+ GL_FUNC_LOAD_3(SecondaryColor3uiEXT,GLvoid, GLuint,GLuint,GLuint, "GL_EXT_secondary_color")
126
+
127
+ #define GLSECONDARYCOLOREXT_VFUNC(_name_,_type_,_conv_) \
128
+ static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
129
+ VALUE gl_##_name_(VALUE obj,VALUE arg1) \
130
+ { \
131
+ _type_ cary[3] = {0,0,0}; \
132
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_secondary_color") \
133
+ Check_Type(arg1,T_ARRAY); \
134
+ _conv_(arg1,cary,3); \
135
+ fptr_gl##_name_(cary); \
136
+ CHECK_GLERROR \
137
+ return Qnil; \
138
+ }
139
+
140
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3bvEXT,GLbyte,ary2cbyte)
141
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3dvEXT,GLdouble,ary2cdbl)
142
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3fvEXT,GLfloat,ary2cflt)
143
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3ivEXT,GLint,ary2cint)
144
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3svEXT,GLshort,ary2cshort)
145
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3uivEXT,GLuint,ary2cuint)
146
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3ubvEXT,GLubyte,ary2cubyte)
147
+ GLSECONDARYCOLOREXT_VFUNC(SecondaryColor3usvEXT,GLushort,ary2cushort)
148
+ #undef GLSECONDARYCOLOREXT_VFUNC
149
+
150
+ extern VALUE g_SecondaryColor_ptr;
151
+ static void (APIENTRY * fptr_glSecondaryColorPointerEXT)(GLint,GLenum,GLsizei,const GLvoid *);
152
+ static VALUE
153
+ gl_SecondaryColorPointerEXT(obj,arg1,arg2,arg3,arg4)
154
+ VALUE obj,arg1,arg2,arg3,arg4;
155
+ {
156
+ GLint size;
157
+ GLenum type;
158
+ GLsizei stride;
159
+ LOAD_GL_FUNC(glSecondaryColorPointerEXT,"GL_EXT_secondary_color")
160
+ size = (GLint)NUM2INT(arg1);
161
+ type = (GLenum)NUM2INT(arg2);
162
+ stride = (GLsizei)NUM2UINT(arg3);
163
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
164
+ g_SecondaryColor_ptr = arg4;
165
+ fptr_glSecondaryColorPointerEXT(size,type, stride, (const GLvoid*)NUM2LONG(arg4));
166
+ } else {
167
+ VALUE data;
168
+ data = pack_array_or_pass_string(type,arg4);
169
+ rb_str_freeze(data);
170
+ g_SecondaryColor_ptr = data;
171
+ fptr_glSecondaryColorPointerEXT(size,type, stride, (const GLvoid*)RSTRING_PTR(data));
172
+ }
173
+ CHECK_GLERROR
174
+ return Qnil;
175
+ }
176
+
177
+ /* #97 - GL_EXT_compiled_vertex_array */
178
+ GL_FUNC_LOAD_2(LockArraysEXT,GLvoid, GLint,GLint, "GL_EXT_compiled_vertex_array")
179
+ GL_FUNC_LOAD_0(UnlockArraysEXT,GLvoid, "GL_EXT_compiled_vertex_array")
180
+
181
+ /* #112 - GL_EXT_draw_range_elements */
182
+ static void (APIENTRY * fptr_glDrawRangeElementsEXT)(GLenum,GLuint,GLuint,GLsizei,GLenum,GLvoid*);
183
+ static VALUE
184
+ gl_DrawRangeElementsEXT(obj,arg1,arg2,arg3,arg4,arg5,arg6)
185
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
186
+ {
187
+ GLenum mode;
188
+ GLuint start;
189
+ GLuint end;
190
+ GLsizei count;
191
+ GLenum type;
192
+ LOAD_GL_FUNC(glDrawRangeElementsEXT,"GL_EXT_draw_range_elements")
193
+ mode = (GLenum)NUM2INT(arg1);
194
+ start = (GLuint)NUM2UINT(arg2);
195
+ end = (GLuint)NUM2UINT(arg3);
196
+ count = (GLsizei)NUM2UINT(arg4);
197
+ type = (GLenum)NUM2INT(arg5);
198
+ if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
199
+ fptr_glDrawRangeElementsEXT(mode, start, end, count, type, (GLvoid *)NUM2LONG(arg6));
200
+ } else {
201
+ VALUE data;
202
+ data = pack_array_or_pass_string(type,arg6);
203
+ fptr_glDrawRangeElementsEXT(mode, start, end, count, type, RSTRING_PTR(data));
204
+ }
205
+ CHECK_GLERROR
206
+ return Qnil;
207
+ }
208
+
209
+ /* #148 - GL_EXT_multi_draw_arrays */
210
+ static void (APIENTRY * fptr_glMultiDrawArraysEXT)(GLenum,GLint*,GLsizei*,GLsizei);
211
+ static VALUE
212
+ gl_MultiDrawArraysEXT(obj,arg1,arg2,arg3)
213
+ VALUE obj,arg1,arg2,arg3;
214
+ {
215
+ GLenum mode;
216
+ GLint *ary1;
217
+ GLsizei *ary2;
218
+ int len1,len2;
219
+ LOAD_GL_FUNC(glMultiDrawArraysEXT,"GL_EXT_multi_draw_arrays")
220
+ len1 = (int)RARRAY_LENINT(arg2);
221
+ len2 = (int)RARRAY_LENINT(arg3);
222
+ if (len1!=len2)
223
+ rb_raise(rb_eArgError, "Passed arrays must have same length");
224
+ mode = (GLenum)NUM2INT(arg1);
225
+ ary1 = ALLOC_N(GLint,len1);
226
+ ary2 = ALLOC_N(GLsizei,len2);
227
+ ary2cint(arg2,ary1,len1);
228
+ ary2cint(arg3,ary2,len2);
229
+ fptr_glMultiDrawArraysEXT(mode,ary1,ary2,len1);
230
+ xfree(ary1);
231
+ xfree(ary2);
232
+ CHECK_GLERROR
233
+ return Qnil;
234
+ }
235
+
236
+ static void (APIENTRY * fptr_glMultiDrawElementsEXT)(GLenum,const GLsizei *,GLenum,GLvoid **,GLsizei);
237
+ static VALUE
238
+ gl_MultiDrawElementsEXT(argc,argv,obj)
239
+ int argc;
240
+ VALUE *argv;
241
+ VALUE obj;
242
+ {
243
+ GLenum mode;
244
+ GLenum type;
245
+ GLsizei *counts;
246
+ GLvoid **indices;
247
+ GLint size;
248
+ int i;
249
+ VALUE ary, args[4];
250
+ LOAD_GL_FUNC(glMultiDrawElementsEXT,"GL_EXT_multi_draw_arrays")
251
+ switch (rb_scan_args(argc, argv, "31", &args[0], &args[1], &args[2],&args[3])) {
252
+ default:
253
+ case 3:
254
+ if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING))
255
+ rb_raise(rb_eArgError, "Element array buffer bound, but offsets array missing");
256
+ mode = (GLenum)NUM2INT(args[0]);
257
+ type = (GLenum)NUM2INT(args[1]);
258
+ Check_Type(args[2],T_ARRAY);
259
+ ary = args[2];
260
+ size = (GLsizei)RARRAY_LENINT(ary);
261
+ counts = ALLOC_N(GLsizei,size);
262
+ indices = ALLOC_N(GLvoid*,size);
263
+ for (i=0;i<size;i++) {
264
+ VALUE data;
265
+ data = pack_array_or_pass_string(type,RARRAY_PTR(ary)[i]);
266
+
267
+ indices[i] = RSTRING_PTR(data);
268
+ counts[i] = (GLsizei)RSTRING_LENINT(data);
269
+ }
270
+ fptr_glMultiDrawElementsEXT(mode,counts,type,indices,size);
271
+ xfree(counts);
272
+ xfree(indices);
273
+ break;
274
+ case 4:
275
+ if (!CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING))
276
+ rb_raise(rb_eArgError, "Element array buffer not bound");
277
+ mode = (GLenum)NUM2INT(args[0]);
278
+ type = (GLenum)NUM2INT(args[1]);
279
+ Check_Type(args[2],T_ARRAY);
280
+ Check_Type(args[3],T_ARRAY);
281
+ if (RARRAY_LEN(args[2]) != RARRAY_LEN(args[3]))
282
+ rb_raise(rb_eArgError, "Count and indices offset array must have same length");
283
+
284
+ size = (GLsizei)RARRAY_LENINT(args[2]);
285
+
286
+ counts = ALLOC_N(GLsizei,size);
287
+ indices = ALLOC_N(GLvoid*,size);
288
+ for (i=0;i<size;i++) {
289
+ counts[i] = NUM2INT(rb_ary_entry(args[2],i));
290
+ indices[i] = (GLvoid *)NUM2LONG(rb_ary_entry(args[3],i));
291
+ }
292
+ fptr_glMultiDrawElementsEXT(mode,counts,type,indices,size);
293
+ xfree(counts);
294
+ xfree(indices);
295
+ break;
296
+ }
297
+ CHECK_GLERROR
298
+ return Qnil;
299
+ }
300
+
301
+ /* #149 - GL_EXT_fog_coord */
302
+ GL_FUNC_LOAD_1(FogCoordfEXT,GLvoid, GLfloat, "GL_EXT_fog_coord")
303
+ GL_FUNC_LOAD_1(FogCoorddEXT,GLvoid, GLdouble, "GL_EXT_fog_coord")
304
+
305
+ #define GLFOGCOORD_VFUNC(_name_,_type_,_conv_) \
306
+ static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
307
+ VALUE gl_##_name_(VALUE obj,VALUE arg1) \
308
+ { \
309
+ _type_ cary = 0; \
310
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_secondary_color") \
311
+ Check_Type(arg1,T_ARRAY); \
312
+ _conv_(arg1,&cary,1); \
313
+ fptr_gl##_name_(&cary); \
314
+ CHECK_GLERROR \
315
+ return Qnil; \
316
+ }
317
+ GLFOGCOORD_VFUNC(FogCoordfvEXT,GLfloat,ary2cflt)
318
+ GLFOGCOORD_VFUNC(FogCoorddvEXT,GLdouble,ary2cdbl)
319
+ #undef GLFOGCOORD_VFUNC
320
+
321
+ extern VALUE g_FogCoord_ptr;
322
+ static void (APIENTRY * fptr_glFogCoordPointerEXT)(GLenum,GLsizei,const GLvoid *);
323
+ static VALUE
324
+ gl_FogCoordPointerEXT(obj,arg1,arg2,arg3)
325
+ VALUE obj,arg1,arg2,arg3;
326
+ {
327
+ GLenum type;
328
+ GLsizei stride;
329
+ LOAD_GL_FUNC(glFogCoordPointerEXT,"GL_EXT_secondary_color")
330
+ type = (GLenum)NUM2INT(arg1);
331
+ stride = (GLsizei)NUM2UINT(arg2);
332
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
333
+ g_FogCoord_ptr = arg3;
334
+ fptr_glFogCoordPointerEXT(type, stride, (const GLvoid*)NUM2LONG(arg3));
335
+ } else {
336
+ VALUE data;
337
+ data = pack_array_or_pass_string(type,arg3);
338
+ rb_str_freeze(data);
339
+ g_FogCoord_ptr = data;
340
+ fptr_glFogCoordPointerEXT(type, stride, (const GLvoid*)RSTRING_PTR(data));
341
+ }
342
+ CHECK_GLERROR
343
+ return Qnil;
344
+ }
345
+
346
+ /* #173 - GL_EXT_blend_func_separate */
347
+ GL_FUNC_LOAD_4(BlendFuncSeparateEXT,GLvoid, GLenum,GLenum,GLenum,GLenum, "GL_EXT_blend_func_separate")
348
+
349
+ /* #268 - GL_EXT_stencil_two_side */
350
+ GL_FUNC_LOAD_1(ActiveStencilFaceEXT,GLvoid, GLenum, "GL_EXT_stencil_two_side")
351
+
352
+ /* #297 - GL_EXT_depth_bounds_test */
353
+ GL_FUNC_LOAD_2(DepthBoundsEXT,GLvoid, GLclampd,GLclampd, "GL_EXT_depth_bounds_test")
354
+
355
+ /* #299 - GL_EXT_blend_equation_separate */
356
+ GL_FUNC_LOAD_2(BlendEquationSeparateEXT,GLvoid, GLenum,GLenum, "GL_EXT_blend_equation_separate")
357
+
358
+ /* #310 - GL_EXT_framebuffer_object */
359
+ GL_FUNC_LOAD_1(IsRenderbufferEXT,GLboolean, GLuint, "GL_EXT_framebuffer_object")
360
+ GL_FUNC_LOAD_2(BindRenderbufferEXT,GLvoid, GLenum,GLuint, "GL_EXT_framebuffer_object")
361
+ GL_FUNC_LOAD_4(RenderbufferStorageEXT,GLvoid, GLenum,GLenum,GLsizei,GLsizei, "GL_EXT_framebuffer_object")
362
+ GL_FUNC_GENOBJECTS_LOAD(GenRenderbuffersEXT,"GL_EXT_framebuffer_object")
363
+ GL_FUNC_DELETEOBJECTS_LOAD(DeleteRenderbuffersEXT,"GL_EXT_framebuffer_object")
364
+
365
+ static void (APIENTRY * fptr_glGetRenderbufferParameterivEXT)(GLenum,GLenum,GLint *);
366
+ static VALUE gl_GetRenderbufferParameterivEXT(VALUE obj,VALUE arg1,VALUE arg2)
367
+ {
368
+ GLint param = 0;
369
+ LOAD_GL_FUNC(glGetRenderbufferParameterivEXT,"GL_EXT_framebuffer_object")
370
+ fptr_glGetRenderbufferParameterivEXT(NUM2UINT(arg1),NUM2UINT(arg2),&param);
371
+ CHECK_GLERROR
372
+ return INT2NUM(param);
373
+ }
374
+
375
+ GL_FUNC_GENOBJECTS_LOAD(GenFramebuffersEXT,"GL_EXT_framebuffer_object")
376
+ GL_FUNC_DELETEOBJECTS_LOAD(DeleteFramebuffersEXT,"GL_EXT_framebuffer_object")
377
+ GL_FUNC_LOAD_1(IsFramebufferEXT,GLboolean, GLuint, "GL_EXT_framebuffer_object")
378
+ GL_FUNC_LOAD_2(BindFramebufferEXT,GLvoid, GLenum,GLuint, "GL_EXT_framebuffer_object")
379
+ GL_FUNC_LOAD_1(CheckFramebufferStatusEXT,GLenum, GLenum, "GL_EXT_framebuffer_object")
380
+ GL_FUNC_LOAD_5(FramebufferTexture1DEXT,GLvoid, GLenum,GLenum,GLenum,GLuint,GLint, "GL_EXT_framebuffer_object")
381
+ GL_FUNC_LOAD_5(FramebufferTexture2DEXT,GLvoid, GLenum,GLenum,GLenum,GLuint,GLint, "GL_EXT_framebuffer_object")
382
+ GL_FUNC_LOAD_6(FramebufferTexture3DEXT,GLvoid, GLenum,GLenum,GLenum,GLuint,GLint,GLint, "GL_EXT_framebuffer_object")
383
+
384
+ GL_FUNC_LOAD_4(FramebufferRenderbufferEXT,GLvoid, GLuint,GLuint,GLuint,GLuint, "GL_EXT_framebuffer_object")
385
+
386
+ static void (APIENTRY * fptr_glGetFramebufferAttachmentParameterivEXT)(GLenum,GLenum,GLenum,GLint *);
387
+ static VALUE gl_GetFramebufferAttachmentParameterivEXT(VALUE obj,VALUE arg1, VALUE arg2, VALUE arg3)
388
+ {
389
+ GLint ret = 0;
390
+ LOAD_GL_FUNC(glGetFramebufferAttachmentParameterivEXT,"GL_EXT_framebuffer_object")
391
+ fptr_glGetFramebufferAttachmentParameterivEXT(NUM2UINT(arg1),NUM2UINT(arg2),NUM2UINT(arg3),&ret);
392
+ CHECK_GLERROR
393
+ return cond_GLBOOL2RUBY(NUM2UINT(arg3),ret);
394
+ }
395
+
396
+ GL_FUNC_LOAD_1(GenerateMipmapEXT,GLvoid, GLenum, "GL_EXT_framebuffer_object")
397
+
398
+ /* #314 - GL_EXT_stencil_clear_tag */
399
+ GL_FUNC_LOAD_2(StencilClearTagEXT,GLvoid, GLsizei,GLuint, "GL_EXT_stencil_clear_tag")
400
+
401
+ /* #316 - GL_EXT_framebuffer_blit */
402
+ GL_FUNC_LOAD_10(BlitFramebufferEXT,GLvoid, GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum, "GL_EXT_framebuffer_blit")
403
+
404
+ /* #317 - GL_EXT_framebuffer_multisample */
405
+ GL_FUNC_LOAD_5(RenderbufferStorageMultisampleEXT,GLvoid, GLenum,GLsizei,GLenum,GLsizei,GLsizei, "GL_EXT_framebuffer_multisample")
406
+
407
+ /* #319 - GL_EXT_timer_query */
408
+
409
+ #define GETQUERY_FUNC(_name_,_type_,_conv_) \
410
+ static void (APIENTRY * fptr_gl##_name_)(GLuint,GLenum,_type_ *); \
411
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1,VALUE arg2) \
412
+ { \
413
+ _type_ ret = 0; \
414
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_timer_query") \
415
+ fptr_gl##_name_(NUM2INT(arg1),NUM2INT(arg2),&ret); \
416
+ CHECK_GLERROR \
417
+ return _conv_(NUM2INT(arg2),ret); \
418
+ }
419
+
420
+ GETQUERY_FUNC(GetQueryObjecti64vEXT,GLint64EXT,cond_GLBOOL2RUBY_LL)
421
+ GETQUERY_FUNC(GetQueryObjectui64vEXT,GLuint64EXT,cond_GLBOOL2RUBY_ULL)
422
+ #undef GETQUERY_FUNC
423
+
424
+
425
+ /* #320 - GL_EXT_gpu_program_parameters */
426
+ #define PROGRAMPARAM_MULTI_FUNC_V(_name_,_type_,_conv_,_extension_) \
427
+ static void (APIENTRY * fptr_gl##_name_)(GLenum,GLuint,GLsizei,const _type_ *); \
428
+ static VALUE \
429
+ gl_##_name_(obj,arg1,arg2,arg3) \
430
+ VALUE obj,arg1,arg2,arg3; \
431
+ { \
432
+ _type_ *cary; \
433
+ GLsizei len; \
434
+ LOAD_GL_FUNC(gl##_name_,_extension_) \
435
+ len = (GLsizei)RARRAY_LENINT(rb_Array(arg3)); \
436
+ if (len<=0 || (len % 4) != 0) \
437
+ rb_raise(rb_eArgError, "Parameter array size must be multiplication of 4"); \
438
+ cary = ALLOC_N(_type_,len); \
439
+ _conv_(arg3,cary,len); \
440
+ fptr_gl##_name_((GLenum)NUM2UINT(arg1),(GLuint)NUM2UINT(arg2),len / 4, cary); \
441
+ xfree(cary); \
442
+ CHECK_GLERROR \
443
+ return Qnil; \
444
+ }
445
+
446
+ PROGRAMPARAM_MULTI_FUNC_V(ProgramEnvParameters4fvEXT,GLfloat,ary2cflt,"GL_EXT_gpu_program_parameters")
447
+ PROGRAMPARAM_MULTI_FUNC_V(ProgramLocalParameters4fvEXT,GLfloat,ary2cflt,"GL_EXT_gpu_program_parameters")
448
+ #undef PROGRAMPARAM_MULTI_FUNC_V
449
+
450
+ /* #324 - GL_EXT_geometry_shader4 */
451
+ GL_FUNC_LOAD_3(ProgramParameteriEXT,GLvoid, GLuint,GLenum,GLint, "GL_EXT_geometry_shader4")
452
+
453
+ /* #326 - GL_EXT_gpu_shader4 */
454
+ GL_FUNC_LOAD_2(VertexAttribI1iEXT,GLvoid, GLuint,GLint, "GL_ARB_shader_objects")
455
+ GL_FUNC_LOAD_3(VertexAttribI2iEXT,GLvoid, GLuint,GLint,GLint, "GL_ARB_shader_objects")
456
+ GL_FUNC_LOAD_4(VertexAttribI3iEXT,GLvoid, GLuint,GLint,GLint,GLint, "GL_ARB_shader_objects")
457
+ GL_FUNC_LOAD_5(VertexAttribI4iEXT,GLvoid, GLuint,GLint,GLint,GLint,GLint, "GL_ARB_shader_objects")
458
+ GL_FUNC_LOAD_2(VertexAttribI1uiEXT,GLvoid, GLuint,GLuint, "GL_ARB_shader_objects")
459
+ GL_FUNC_LOAD_3(VertexAttribI2uiEXT,GLvoid, GLuint,GLuint,GLuint, "GL_ARB_shader_objects")
460
+ GL_FUNC_LOAD_4(VertexAttribI3uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint, "GL_ARB_shader_objects")
461
+ GL_FUNC_LOAD_5(VertexAttribI4uiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint,GLuint, "GL_ARB_shader_objects")
462
+
463
+ #define GLVERTEXATTRIB_VFUNC(_name_,_type_,_conv_,_size_) \
464
+ static void (APIENTRY * fptr_gl##_name_)(GLuint,const _type_ *); \
465
+ static VALUE \
466
+ gl_##_name_(obj,arg1,arg2) \
467
+ VALUE obj,arg1,arg2; \
468
+ { \
469
+ _type_ value[_size_]; \
470
+ LOAD_GL_FUNC(gl##_name_,"GL_ARB_shader_objects") \
471
+ _conv_(arg2,value,_size_); \
472
+ fptr_gl##_name_(NUM2UINT(arg1),value); \
473
+ CHECK_GLERROR \
474
+ return Qnil; \
475
+ }
476
+
477
+ GLVERTEXATTRIB_VFUNC(VertexAttribI1ivEXT,GLint,ary2cint,1)
478
+ GLVERTEXATTRIB_VFUNC(VertexAttribI2ivEXT,GLint,ary2cint,2)
479
+ GLVERTEXATTRIB_VFUNC(VertexAttribI3ivEXT,GLint,ary2cint,3)
480
+ GLVERTEXATTRIB_VFUNC(VertexAttribI4ivEXT,GLint,ary2cint,4)
481
+ GLVERTEXATTRIB_VFUNC(VertexAttribI1uivEXT,GLuint,ary2cuint,1)
482
+ GLVERTEXATTRIB_VFUNC(VertexAttribI2uivEXT,GLuint,ary2cuint,2)
483
+ GLVERTEXATTRIB_VFUNC(VertexAttribI3uivEXT,GLuint,ary2cuint,3)
484
+ GLVERTEXATTRIB_VFUNC(VertexAttribI4uivEXT,GLuint,ary2cuint,4)
485
+ GLVERTEXATTRIB_VFUNC(VertexAttribI4bvEXT,GLbyte,ary2cbyte,4)
486
+ GLVERTEXATTRIB_VFUNC(VertexAttribI4svEXT,GLshort,ary2cshort,4)
487
+ GLVERTEXATTRIB_VFUNC(VertexAttribI4ubvEXT,GLubyte,ary2cubyte,4)
488
+ GLVERTEXATTRIB_VFUNC(VertexAttribI4usvEXT,GLushort,ary2cushort,4)
489
+ #undef GLVERTEXATTRIB_VFUNC
490
+
491
+ #define GETVERTEXATTRIB_FUNC(_name_,_type_,_conv_,_extension_) \
492
+ static void (APIENTRY * fptr_gl##_name_)(GLuint,GLenum,_type_ *); \
493
+ static VALUE \
494
+ gl_##_name_(obj,arg1,arg2) \
495
+ VALUE obj,arg1,arg2; \
496
+ { \
497
+ GLuint index; \
498
+ GLenum pname; \
499
+ _type_ params[4] = {0,0,0,0}; \
500
+ GLint size; \
501
+ LOAD_GL_FUNC(gl##_name_,_extension_) \
502
+ index = (GLuint)NUM2UINT(arg1); \
503
+ pname = (GLenum)NUM2INT(arg2); \
504
+ if (pname==GL_CURRENT_VERTEX_ATTRIB_ARB) \
505
+ size = 4; \
506
+ else \
507
+ size = 1; \
508
+ fptr_gl##_name_(index,pname,params); \
509
+ RET_ARRAY_OR_SINGLE_BOOL(size,_conv_,pname,params) \
510
+ }
511
+
512
+ GETVERTEXATTRIB_FUNC(GetVertexAttribIivEXT,GLint,cond_GLBOOL2RUBY,"GL_EXT_gpu_shader4")
513
+ GETVERTEXATTRIB_FUNC(GetVertexAttribIuivEXT,GLuint,cond_GLBOOL2RUBY_U,"GL_EXT_gpu_shader4")
514
+ #undef GETVERTEXATTRIB_FUNC
515
+
516
+ extern VALUE g_VertexAttrib_ptr[];
517
+
518
+ static void (APIENTRY * fptr_glVertexAttribIPointerEXT)(GLuint,GLint,GLenum,GLsizei,const GLvoid *);
519
+ static VALUE gl_VertexAttribIPointerEXT(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
520
+ {
521
+ GLuint index;
522
+ GLuint size;
523
+ GLenum type;
524
+ GLsizei stride;
525
+
526
+ LOAD_GL_FUNC(glVertexAttribIPointerEXT,"GL_EXT_gpu_shader4")
527
+
528
+ index = (GLuint)NUM2UINT(arg1);
529
+ size = (GLuint)NUM2UINT(arg2);
530
+ type = (GLenum)NUM2INT(arg3);
531
+ stride = (GLsizei)NUM2UINT(arg4);
532
+ if (index>_MAX_VERTEX_ATTRIBS)
533
+ rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
534
+
535
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
536
+ g_VertexAttrib_ptr[index] = arg5;
537
+ fptr_glVertexAttribIPointerEXT(index,size,type,stride,(GLvoid *)NUM2LONG(arg5));
538
+ } else {
539
+ VALUE data;
540
+ data = pack_array_or_pass_string(type,arg5);
541
+ rb_str_freeze(data);
542
+ g_VertexAttrib_ptr[index] = data;
543
+ fptr_glVertexAttribIPointerEXT(index,size,type,stride,(GLvoid *)RSTRING_PTR(data));
544
+ }
545
+
546
+ CHECK_GLERROR
547
+ return Qnil;
548
+ }
549
+
550
+ GL_FUNC_LOAD_2(Uniform1uiEXT,GLvoid, GLint,GLuint, "GL_EXT_gpu_shader4")
551
+ GL_FUNC_LOAD_3(Uniform2uiEXT,GLvoid, GLint,GLuint,GLuint, "GL_EXT_gpu_shader4")
552
+ GL_FUNC_LOAD_4(Uniform3uiEXT,GLvoid, GLint,GLuint,GLuint,GLuint, "GL_EXT_gpu_shader4")
553
+ GL_FUNC_LOAD_5(Uniform4uiEXT,GLvoid, GLint,GLuint,GLuint,GLuint,GLuint, "GL_EXT_gpu_shader4")
554
+
555
+ #define GLUNIFORM_VFUNC(_name_,_type_,_conv_,_size_) \
556
+ static void (APIENTRY * fptr_gl##_name_)(GLint,GLsizei,const _type_ *); \
557
+ static VALUE \
558
+ gl_##_name_(obj,arg1,arg2) \
559
+ VALUE obj,arg1,arg2; \
560
+ { \
561
+ GLint location; \
562
+ GLsizei count; \
563
+ _type_ *value; \
564
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_gpu_shader4") \
565
+ Check_Type(arg2,T_ARRAY); \
566
+ count = (GLsizei)RARRAY_LENINT(arg2); \
567
+ if (count<=0 || (count % _size_) != 0) \
568
+ rb_raise(rb_eArgError, "Parameter array size must be multiplication of %i",_size_); \
569
+ location = (GLint)NUM2INT(arg1); \
570
+ value = ALLOC_N(_type_,count); \
571
+ _conv_(arg2,value,count); \
572
+ fptr_gl##_name_(location,count / _size_,value); \
573
+ xfree(value); \
574
+ CHECK_GLERROR \
575
+ return Qnil; \
576
+ }
577
+
578
+ GLUNIFORM_VFUNC(Uniform1uivEXT,GLuint,ary2cuint,1)
579
+ GLUNIFORM_VFUNC(Uniform2uivEXT,GLuint,ary2cuint,2)
580
+ GLUNIFORM_VFUNC(Uniform3uivEXT,GLuint,ary2cuint,3)
581
+ GLUNIFORM_VFUNC(Uniform4uivEXT,GLuint,ary2cuint,4)
582
+ #undef GLUNIFORM_VFUNC
583
+
584
+ static void (APIENTRY * fptr_glGetActiveUniformARB)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*);
585
+ #define GETUNIFORM_FUNC(_name_,_type_) \
586
+ static void (APIENTRY * fptr_gl##_name_)(GLuint,GLint,_type_ *); \
587
+ static VALUE \
588
+ gl_##_name_(obj,arg1,arg2) \
589
+ VALUE obj,arg1,arg2; \
590
+ { \
591
+ GLuint program; \
592
+ GLint location; \
593
+ _type_ params[16]; \
594
+ GLint unused = 0; \
595
+ GLenum uniform_type = 0; \
596
+ GLint uniform_size = 0; \
597
+ \
598
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_gpu_shader4") \
599
+ LOAD_GL_FUNC(glGetActiveUniformARB,"GL_ARB_shader_objects") \
600
+ program = (GLuint)NUM2UINT(arg1); \
601
+ location = (GLint)NUM2INT(arg2); \
602
+ \
603
+ fptr_glGetActiveUniformARB(program,location,0,NULL,&unused,&uniform_type,NULL); \
604
+ CHECK_GLERROR \
605
+ if (uniform_type==0) \
606
+ rb_raise(rb_eTypeError, "Can't determine the uniform's type"); \
607
+ \
608
+ uniform_size = get_uniform_size(uniform_type); \
609
+ \
610
+ memset(params,0,16*sizeof(_type_)); \
611
+ fptr_gl##_name_(program,location,params); \
612
+ RET_ARRAY_OR_SINGLE(uniform_size,RETCONV_##_type_,params) \
613
+ }
614
+
615
+ GETUNIFORM_FUNC(GetUniformuivEXT,GLuint)
616
+ #undef GETUNIFORM_FUNC
617
+
618
+ static void (APIENTRY * fptr_glBindFragDataLocationEXT)(GLuint,GLuint,const GLchar *);
619
+ static VALUE gl_BindFragDataLocationEXT(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3)
620
+ {
621
+ LOAD_GL_FUNC(glBindFragDataLocationEXT,"GL_EXT_gpu_shader4")
622
+ Check_Type(arg3,T_STRING);
623
+ fptr_glBindFragDataLocationEXT(NUM2UINT(arg1),NUM2UINT(arg2),RSTRING_PTR(arg3));
624
+ CHECK_GLERROR
625
+ return Qnil;
626
+ }
627
+
628
+ static GLint (APIENTRY * fptr_glGetFragDataLocationEXT)(GLuint,const GLchar *);
629
+ static VALUE gl_GetFragDataLocationEXT(VALUE obj,VALUE arg1,VALUE arg2)
630
+ {
631
+ GLint ret;
632
+ LOAD_GL_FUNC(glGetFragDataLocationEXT,"GL_EXT_gpu_shader4")
633
+ Check_Type(arg2,T_STRING);
634
+ ret = fptr_glGetFragDataLocationEXT(NUM2UINT(arg1),RSTRING_PTR(arg2));
635
+ CHECK_GLERROR
636
+ return INT2NUM(ret);
637
+ }
638
+
639
+ /* #327 - GL_EXT_draw_instanced */
640
+ GL_FUNC_LOAD_4(DrawArraysInstancedEXT,GLvoid, GLenum,GLint,GLsizei,GLsizei, "GL_EXT_draw_instanced")
641
+
642
+ static void (APIENTRY * fptr_glDrawElementsInstancedEXT)(GLenum,GLsizei,GLenum,const GLvoid *,GLsizei);
643
+ static VALUE gl_DrawElementsInstancedEXT(obj,arg1,arg2,arg3,arg4,arg5)
644
+ VALUE obj,arg1,arg2,arg3,arg4,arg5;
645
+ {
646
+ GLenum mode;
647
+ GLsizei count;
648
+ GLenum type;
649
+ GLsizei primcount;
650
+ LOAD_GL_FUNC(glDrawElementsInstancedEXT,"GL_EXT_draw_instanced")
651
+ mode = (GLenum)NUM2INT(arg1);
652
+ count = (GLsizei)NUM2UINT(arg2);
653
+ type = (GLenum)NUM2INT(arg3);
654
+ primcount = (GLsizei)NUM2INT(arg5);
655
+ if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
656
+ fptr_glDrawElementsInstancedEXT(mode, count, type, (const GLvoid*)NUM2LONG(arg4), primcount);
657
+ } else {
658
+ VALUE data;
659
+ data = pack_array_or_pass_string(type,arg4);
660
+ fptr_glDrawElementsInstancedEXT(mode, count, type, (const GLvoid*)RSTRING_PTR(data), primcount);
661
+ }
662
+ CHECK_GLERROR
663
+ return Qnil;
664
+ }
665
+
666
+ /* #330 - GL_EXT_texture_buffer_object */
667
+ GL_FUNC_LOAD_3(TexBufferEXT,GLvoid, GLenum,GLenum,GLenum, "GL_EXT_texture_buffer_object")
668
+
669
+ /* #343 - GL_EXT_texture_integer */
670
+ GL_FUNC_LOAD_4(ClearColorIiEXT,GLvoid, GLint,GLint,GLint,GLint, "GL_EXT_texture_integer")
671
+ GL_FUNC_LOAD_4(ClearColorIuiEXT,GLvoid, GLuint,GLuint,GLuint,GLuint, "GL_EXT_texture_integer")
672
+
673
+ #define TEXPARAMETER_VFUNC(_name_,_type_,_conv_) \
674
+ static void (APIENTRY * fptr_gl##_name_)(GLenum,GLenum,_type_ *); \
675
+ static VALUE \
676
+ gl_##_name_(obj,arg1,arg2,arg3) \
677
+ VALUE obj,arg1,arg2,arg3; \
678
+ { \
679
+ GLenum target; \
680
+ GLenum pname; \
681
+ _type_ params[4] = {0,0,0,0}; \
682
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_texture_integer") \
683
+ target = (GLenum)NUM2UINT(arg1); \
684
+ pname = (GLenum)NUM2UINT(arg2); \
685
+ Check_Type(arg3,T_ARRAY); \
686
+ _conv_(arg3,params,4); \
687
+ fptr_gl##_name_(target,pname,params); \
688
+ CHECK_GLERROR \
689
+ return Qnil; \
690
+ }
691
+
692
+ TEXPARAMETER_VFUNC(TexParameterIivEXT,GLint,ary2cint)
693
+ TEXPARAMETER_VFUNC(TexParameterIuivEXT,GLuint,ary2cuint)
694
+ #undef TEXPARAMETER_VFUNC
695
+
696
+ #define GETTEXPARAMETER_VFUNC(_name_,_type_,_conv_) \
697
+ static void (APIENTRY * fptr_gl##_name_)(GLenum,GLenum,_type_ *); \
698
+ static VALUE \
699
+ gl_##_name_(obj,arg1,arg2) \
700
+ VALUE obj,arg1,arg2; \
701
+ { \
702
+ GLenum target; \
703
+ GLenum pname; \
704
+ _type_ params[4] = {0,0,0,0}; \
705
+ int size; \
706
+ LOAD_GL_FUNC(gl##_name_,"GL_EXT_texture_integer") \
707
+ target = (GLenum)NUM2INT(arg1); \
708
+ pname = (GLenum)NUM2INT(arg2); \
709
+ switch(pname) { \
710
+ case GL_TEXTURE_BORDER_COLOR: \
711
+ case GL_TEXTURE_BORDER_VALUES_NV: \
712
+ case GL_POST_TEXTURE_FILTER_BIAS_SGIX: \
713
+ case GL_POST_TEXTURE_FILTER_SCALE_SGIX: \
714
+ size = 4; \
715
+ break; \
716
+ default: \
717
+ size = 1; \
718
+ break; \
719
+ } \
720
+ fptr_gl##_name_(target,pname,params); \
721
+ RET_ARRAY_OR_SINGLE_BOOL(size,_conv_,pname,params) \
722
+ }
723
+
724
+ GETTEXPARAMETER_VFUNC(GetTexParameterIivEXT,GLint,cond_GLBOOL2RUBY)
725
+ GETTEXPARAMETER_VFUNC(GetTexParameterIuivEXT,GLuint,cond_GLBOOL2RUBY_U)
726
+ #undef GETTEXPARAMETER_VFUNC
727
+
728
+ void gl_init_functions_ext_ext(VALUE module)
729
+ {
730
+ /* #2 - GL_EXT_blend_color */
731
+ rb_define_module_function(module, "glBlendColorEXT", gl_BlendColorEXT, 4);
732
+
733
+ /* #3 - GL_EXT_polygon_offset */
734
+ rb_define_module_function(module, "glPolygonOffsetEXT", gl_PolygonOffsetEXT, 2);
735
+
736
+ /* #20 - GL_EXT_texture_object */
737
+ rb_define_module_function(module, "glGenTexturesEXT", gl_GenTexturesEXT, 1);
738
+ rb_define_module_function(module, "glDeleteTexturesEXT", gl_DeleteTexturesEXT, 1);
739
+ rb_define_module_function(module, "glBindTextureEXT", gl_BindTextureEXT, 2);
740
+ rb_define_module_function(module, "glPrioritizeTexturesEXT", gl_PrioritizeTexturesEXT, 2);
741
+ rb_define_module_function(module, "glAreTexturesResidentEXT", gl_AreTexturesResidentEXT, 1);
742
+ rb_define_module_function(module, "glIsTextureEXT", gl_IsTextureEXT, 1);
743
+
744
+ /* #37 - GL_EXT_blend_minmax */
745
+ rb_define_module_function(module, "glBlendEquationEXT", gl_BlendEquationEXT, 1);
746
+
747
+ /* #54 - GL_EXT_point_parameters */
748
+ rb_define_module_function(module, "glPointParameterfEXT", gl_PointParameterfEXT, 2);
749
+ rb_define_module_function(module, "glPointParameterfvEXT", gl_PointParameterfvEXT, 2);
750
+
751
+ /* #97 - GL_EXT_compiled_vertex_array */
752
+ rb_define_module_function(module, "glLockArraysEXT", gl_LockArraysEXT, 2);
753
+ rb_define_module_function(module, "glUnlockArraysEXT", gl_UnlockArraysEXT, 0);
754
+
755
+ /* #112 - GL_EXT_draw_range_elements */
756
+ rb_define_module_function(module, "glDrawRangeElementsEXT", gl_DrawRangeElementsEXT, 6);
757
+
758
+ /* #145 - GL_EXT_secondary_color */
759
+ rb_define_module_function(module, "glSecondaryColor3bEXT", gl_SecondaryColor3bEXT, 3);
760
+ rb_define_module_function(module, "glSecondaryColor3dEXT", gl_SecondaryColor3dEXT, 3);
761
+ rb_define_module_function(module, "glSecondaryColor3fEXT", gl_SecondaryColor3fEXT, 3);
762
+ rb_define_module_function(module, "glSecondaryColor3iEXT", gl_SecondaryColor3iEXT, 3);
763
+ rb_define_module_function(module, "glSecondaryColor3sEXT", gl_SecondaryColor3sEXT, 3);
764
+ rb_define_module_function(module, "glSecondaryColor3ubEXT", gl_SecondaryColor3ubEXT, 3);
765
+ rb_define_module_function(module, "glSecondaryColor3uiEXT", gl_SecondaryColor3uiEXT, 3);
766
+ rb_define_module_function(module, "glSecondaryColor3usEXT", gl_SecondaryColor3usEXT, 3);
767
+ rb_define_module_function(module, "glSecondaryColor3bvEXT", gl_SecondaryColor3bvEXT, 1);
768
+ rb_define_module_function(module, "glSecondaryColor3dvEXT", gl_SecondaryColor3dvEXT, 1);
769
+ rb_define_module_function(module, "glSecondaryColor3fvEXT", gl_SecondaryColor3fvEXT, 1);
770
+ rb_define_module_function(module, "glSecondaryColor3ivEXT", gl_SecondaryColor3ivEXT, 1);
771
+ rb_define_module_function(module, "glSecondaryColor3svEXT", gl_SecondaryColor3svEXT, 1);
772
+ rb_define_module_function(module, "glSecondaryColor3ubvEXT", gl_SecondaryColor3ubvEXT, 1);
773
+ rb_define_module_function(module, "glSecondaryColor3uivEXT", gl_SecondaryColor3uivEXT, 1);
774
+ rb_define_module_function(module, "glSecondaryColor3usvEXT", gl_SecondaryColor3usvEXT, 1);
775
+ rb_define_module_function(module, "glSecondaryColorPointerEXT", gl_SecondaryColorPointerEXT, 4);
776
+
777
+ /* #148 - GL_EXT_multi_draw_arrays */
778
+ rb_define_module_function(module, "glMultiDrawArraysEXT", gl_MultiDrawArraysEXT, 3);
779
+ rb_define_module_function(module, "glMultiDrawElementsEXT", gl_MultiDrawElementsEXT, -1);
780
+
781
+ /* #149 - GL_EXT_fog_coord */
782
+ rb_define_module_function(module, "glFogCoordfEXT", gl_FogCoordfEXT, 1);
783
+ rb_define_module_function(module, "glFogCoorddEXT", gl_FogCoorddEXT, 1);
784
+ rb_define_module_function(module, "glFogCoordfvEXT", gl_FogCoordfvEXT, 1);
785
+ rb_define_module_function(module, "glFogCoorddvEXT", gl_FogCoorddvEXT, 1);
786
+ rb_define_module_function(module, "glFogCoordPointerEXT", gl_FogCoordPointerEXT, 3);
787
+
788
+ /* #173 - GL_EXT_blend_func_separate */
789
+ rb_define_module_function(module, "glBlendFuncSeparateEXT", gl_BlendFuncSeparateEXT, 4);
790
+
791
+ /* #268 - GL_EXT_stencil_two_side */
792
+ rb_define_module_function(module, "glActiveStencilFaceEXT", gl_ActiveStencilFaceEXT, 1);
793
+
794
+ /* #297 - GL_EXT_depth_bounds_test */
795
+ rb_define_module_function(module, "glDepthBoundsEXT", gl_DepthBoundsEXT, 2);
796
+
797
+ /* #299 - GL_EXT_blend_equation_separate */
798
+ rb_define_module_function(module, "glBlendEquationSeparateEXT", gl_BlendEquationSeparateEXT, 2);
799
+
800
+ /* #310 - GL_EXT_framebuffer_object */
801
+ rb_define_module_function(module, "glIsRenderbufferEXT", gl_IsRenderbufferEXT, 1);
802
+ rb_define_module_function(module, "glBindRenderbufferEXT", gl_BindRenderbufferEXT, 2);
803
+ rb_define_module_function(module, "glDeleteRenderbuffersEXT", gl_DeleteRenderbuffersEXT, 1);
804
+ rb_define_module_function(module, "glGenRenderbuffersEXT", gl_GenRenderbuffersEXT, 1);
805
+ rb_define_module_function(module, "glRenderbufferStorageEXT", gl_RenderbufferStorageEXT, 4);
806
+ rb_define_module_function(module, "glGetRenderbufferParameterivEXT", gl_GetRenderbufferParameterivEXT, 2);
807
+ rb_define_module_function(module, "glIsFramebufferEXT", gl_IsFramebufferEXT, 1);
808
+ rb_define_module_function(module, "glBindFramebufferEXT", gl_BindFramebufferEXT, 2);
809
+ rb_define_module_function(module, "glDeleteFramebuffersEXT", gl_DeleteFramebuffersEXT, 1);
810
+ rb_define_module_function(module, "glGenFramebuffersEXT", gl_GenFramebuffersEXT, 1);
811
+ rb_define_module_function(module, "glCheckFramebufferStatusEXT", gl_CheckFramebufferStatusEXT, 1);
812
+ rb_define_module_function(module, "glFramebufferTexture1DEXT", gl_FramebufferTexture1DEXT, 5);
813
+ rb_define_module_function(module, "glFramebufferTexture2DEXT", gl_FramebufferTexture2DEXT, 5);
814
+ rb_define_module_function(module, "glFramebufferTexture3DEXT", gl_FramebufferTexture3DEXT, 6);
815
+ rb_define_module_function(module, "glFramebufferRenderbufferEXT", gl_FramebufferRenderbufferEXT, 4);
816
+ rb_define_module_function(module, "glGetFramebufferAttachmentParameterivEXT", gl_GetFramebufferAttachmentParameterivEXT, 3);
817
+ rb_define_module_function(module, "glGenerateMipmapEXT", gl_GenerateMipmapEXT, 1);
818
+
819
+ /* #314 - GL_EXT_stencil_clear_tag */
820
+ rb_define_module_function(module, "glStencilClearTagEXT", gl_StencilClearTagEXT, 2);
821
+
822
+ /* #316 - GL_EXT_framebuffer_blit */
823
+ rb_define_module_function(module, "glBlitFramebufferEXT", gl_BlitFramebufferEXT, 10);
824
+
825
+ /* #317 - GL_EXT_framebuffer_multisample */
826
+ rb_define_module_function(module, "glRenderbufferStorageMultisampleEXT", gl_RenderbufferStorageMultisampleEXT, 5);
827
+
828
+ /* #319 - GL_EXT_timer_query */
829
+ rb_define_module_function(module, "glGetQueryObjecti64vEXT", gl_GetQueryObjecti64vEXT, 2);
830
+ rb_define_module_function(module, "glGetQueryObjectui64vEXT", gl_GetQueryObjectui64vEXT, 2);
831
+
832
+ /* #320 - GL_EXT_gpu_program_parameters */
833
+ rb_define_module_function(module, "glProgramEnvParameters4fvEXT", gl_ProgramEnvParameters4fvEXT, 3);
834
+ rb_define_module_function(module, "glProgramLocalParameters4fvEXT", gl_ProgramLocalParameters4fvEXT, 3);
835
+
836
+ /* #324 - GL_EXT_geometry_shader4 */
837
+ rb_define_module_function(module, "glProgramParameteriEXT", gl_ProgramParameteriEXT, 3);
838
+
839
+ /* #326 - GL_EXT_gpu_shader4 */
840
+ rb_define_module_function(module, "glVertexAttribI1iEXT", gl_VertexAttribI1iEXT, 2);
841
+ rb_define_module_function(module, "glVertexAttribI2iEXT", gl_VertexAttribI2iEXT, 3);
842
+ rb_define_module_function(module, "glVertexAttribI3iEXT", gl_VertexAttribI3iEXT, 4);
843
+ rb_define_module_function(module, "glVertexAttribI4iEXT", gl_VertexAttribI4iEXT, 5);
844
+ rb_define_module_function(module, "glVertexAttribI1uiEXT", gl_VertexAttribI1uiEXT, 2);
845
+ rb_define_module_function(module, "glVertexAttribI2uiEXT", gl_VertexAttribI2uiEXT, 3);
846
+ rb_define_module_function(module, "glVertexAttribI3uiEXT", gl_VertexAttribI3uiEXT, 4);
847
+ rb_define_module_function(module, "glVertexAttribI4uiEXT", gl_VertexAttribI4uiEXT, 5);
848
+ rb_define_module_function(module, "glVertexAttribI1ivEXT", gl_VertexAttribI1ivEXT, 2);
849
+ rb_define_module_function(module, "glVertexAttribI2ivEXT", gl_VertexAttribI2ivEXT, 2);
850
+ rb_define_module_function(module, "glVertexAttribI3ivEXT", gl_VertexAttribI3ivEXT, 2);
851
+ rb_define_module_function(module, "glVertexAttribI4ivEXT", gl_VertexAttribI4ivEXT, 2);
852
+ rb_define_module_function(module, "glVertexAttribI1uivEXT", gl_VertexAttribI1uivEXT, 2);
853
+ rb_define_module_function(module, "glVertexAttribI2uivEXT", gl_VertexAttribI2uivEXT, 2);
854
+ rb_define_module_function(module, "glVertexAttribI3uivEXT", gl_VertexAttribI3uivEXT, 2);
855
+ rb_define_module_function(module, "glVertexAttribI4uivEXT", gl_VertexAttribI4uivEXT, 2);
856
+ rb_define_module_function(module, "glVertexAttribI4bvEXT", gl_VertexAttribI4bvEXT, 2);
857
+ rb_define_module_function(module, "glVertexAttribI4svEXT", gl_VertexAttribI4svEXT, 2);
858
+ rb_define_module_function(module, "glVertexAttribI4ubvEXT", gl_VertexAttribI4ubvEXT, 2);
859
+ rb_define_module_function(module, "glVertexAttribI4usvEXT", gl_VertexAttribI4usvEXT, 2);
860
+ rb_define_module_function(module, "glVertexAttribIPointerEXT", gl_VertexAttribIPointerEXT, 5);
861
+ rb_define_module_function(module, "glGetVertexAttribIivEXT", gl_GetVertexAttribIivEXT, 2);
862
+ rb_define_module_function(module, "glGetVertexAttribIuivEXT", gl_GetVertexAttribIuivEXT, 2);
863
+ rb_define_module_function(module, "glUniform1uiEXT", gl_Uniform1uiEXT, 2);
864
+ rb_define_module_function(module, "glUniform2uiEXT", gl_Uniform2uiEXT, 3);
865
+ rb_define_module_function(module, "glUniform3uiEXT", gl_Uniform3uiEXT, 4);
866
+ rb_define_module_function(module, "glUniform4uiEXT", gl_Uniform4uiEXT, 5);
867
+ rb_define_module_function(module, "glUniform1uivEXT", gl_Uniform1uivEXT, 2);
868
+ rb_define_module_function(module, "glUniform2uivEXT", gl_Uniform2uivEXT, 2);
869
+ rb_define_module_function(module, "glUniform3uivEXT", gl_Uniform3uivEXT, 2);
870
+ rb_define_module_function(module, "glUniform4uivEXT", gl_Uniform4uivEXT, 2);
871
+ rb_define_module_function(module, "glGetUniformuivEXT", gl_GetUniformuivEXT, 2);
872
+ rb_define_module_function(module, "glBindFragDataLocationEXT", gl_BindFragDataLocationEXT, 3);
873
+ rb_define_module_function(module, "glGetFragDataLocationEXT", gl_GetFragDataLocationEXT, 2);
874
+
875
+ /* #327 - GL_EXT_draw_instanced */
876
+ rb_define_module_function(module, "glDrawArraysInstancedEXT", gl_DrawArraysInstancedEXT, 4);
877
+ rb_define_module_function(module, "glDrawElementsInstancedEXT", gl_DrawElementsInstancedEXT, 5);
878
+
879
+ /* #330 - GL_EXT_texture_buffer_object */
880
+ rb_define_module_function(module, "glTexBufferEXT", gl_TexBufferEXT, 3);
881
+
882
+ /* #343 - GL_EXT_texture_integer */
883
+ rb_define_module_function(module, "glClearColorIiEXT", gl_ClearColorIiEXT, 4);
884
+ rb_define_module_function(module, "glClearColorIuiEXT", gl_ClearColorIuiEXT, 4);
885
+ rb_define_module_function(module, "glTexParameterIivEXT", gl_TexParameterIivEXT, 3);
886
+ rb_define_module_function(module, "glTexParameterIuivEXT", gl_TexParameterIuivEXT, 3);
887
+ rb_define_module_function(module, "glGetTexParameterIivEXT", gl_GetTexParameterIivEXT, 2);
888
+ rb_define_module_function(module, "glGetTexParameterIuivEXT", gl_GetTexParameterIuivEXT, 2);
889
+ }