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
data/ext/gl/gl-1.3.c ADDED
@@ -0,0 +1,443 @@
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 1.3 functions */
19
+
20
+ GL_FUNC_LOAD_1(ActiveTexture,GLvoid, GLenum, "1.3")
21
+ GL_FUNC_LOAD_1(ClientActiveTexture,GLvoid, GLenum, "1.3")
22
+ GL_FUNC_LOAD_2(MultiTexCoord1d,GLvoid, GLenum,GLdouble, "1.3")
23
+ GL_FUNC_LOAD_2(MultiTexCoord1f,GLvoid, GLenum,GLfloat, "1.3")
24
+ GL_FUNC_LOAD_2(MultiTexCoord1i,GLvoid, GLenum,GLint, "1.3")
25
+ GL_FUNC_LOAD_2(MultiTexCoord1s,GLvoid, GLenum,GLshort, "1.3")
26
+ GL_FUNC_LOAD_3(MultiTexCoord2d,GLvoid, GLenum,GLdouble,GLdouble, "1.3")
27
+ GL_FUNC_LOAD_3(MultiTexCoord2f,GLvoid, GLenum,GLfloat,GLfloat, "1.3")
28
+ GL_FUNC_LOAD_3(MultiTexCoord2i,GLvoid, GLenum,GLint,GLint, "1.3")
29
+ GL_FUNC_LOAD_3(MultiTexCoord2s,GLvoid, GLenum,GLshort,GLshort, "1.3")
30
+ GL_FUNC_LOAD_4(MultiTexCoord3d,GLvoid, GLenum,GLdouble,GLdouble,GLdouble, "1.3")
31
+ GL_FUNC_LOAD_4(MultiTexCoord3f,GLvoid, GLenum,GLfloat,GLfloat,GLfloat, "1.3")
32
+ GL_FUNC_LOAD_4(MultiTexCoord3i,GLvoid, GLenum,GLint,GLint,GLint, "1.3")
33
+ GL_FUNC_LOAD_4(MultiTexCoord3s,GLvoid, GLenum,GLshort,GLshort,GLshort, "1.3")
34
+ GL_FUNC_LOAD_5(MultiTexCoord4d,GLvoid, GLenum,GLdouble,GLdouble,GLdouble,GLdouble, "1.3")
35
+ GL_FUNC_LOAD_5(MultiTexCoord4f,GLvoid, GLenum,GLfloat,GLfloat,GLfloat,GLfloat, "1.3")
36
+ GL_FUNC_LOAD_5(MultiTexCoord4i,GLvoid, GLenum,GLint,GLint,GLint,GLint, "1.3")
37
+ GL_FUNC_LOAD_5(MultiTexCoord4s,GLvoid, GLenum,GLshort,GLshort,GLshort,GLshort, "1.3")
38
+ GL_FUNC_LOAD_2(SampleCoverage,GLvoid, GLclampf,GLboolean, "1.3")
39
+
40
+ #define GLMULTITEXCOORD_VFUNC(_type_) \
41
+ static VALUE \
42
+ gl_MultiTexCoord##_type_##v(argc,argv,obj) \
43
+ int argc; \
44
+ VALUE *argv; \
45
+ VALUE obj; \
46
+ { \
47
+ int num; \
48
+ VALUE ary, args[5]; \
49
+ switch (num = rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3],&args[4])) { \
50
+ case 2: \
51
+ if (TYPE(args[1]) == T_ARRAY) { \
52
+ ary = args[1]; \
53
+ switch (RARRAY_LEN(ary)) { \
54
+ case 1: \
55
+ gl_MultiTexCoord1##_type_(obj,args[0],RARRAY_PTR(ary)[0]); \
56
+ break; \
57
+ case 2: \
58
+ gl_MultiTexCoord2##_type_(obj,args[0],RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
59
+ break; \
60
+ case 3: \
61
+ gl_MultiTexCoord3##_type_(obj,args[0],RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
62
+ break; \
63
+ case 4: \
64
+ gl_MultiTexCoord4##_type_(obj,args[0],RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
65
+ break; \
66
+ default: \
67
+ rb_raise(rb_eArgError, "array length:%d", num); \
68
+ } \
69
+ } \
70
+ else { \
71
+ gl_MultiTexCoord1##_type_(obj,args[0], args[1]); \
72
+ break; \
73
+ } \
74
+ break; \
75
+ case 3: \
76
+ gl_MultiTexCoord2##_type_(obj,args[0], args[1], args[2]); \
77
+ break; \
78
+ case 4: \
79
+ gl_MultiTexCoord3##_type_(obj,args[0], args[1], args[2], args[3]); \
80
+ break; \
81
+ case 5: \
82
+ gl_MultiTexCoord4##_type_(obj,args[0], args[1], args[2], args[3], args[4]); \
83
+ break; \
84
+ default: \
85
+ rb_raise(rb_eArgError, "too many arguments"); \
86
+ break; \
87
+ } \
88
+ return Qnil; \
89
+ }
90
+
91
+ GLMULTITEXCOORD_VFUNC(d)
92
+ GLMULTITEXCOORD_VFUNC(f)
93
+ GLMULTITEXCOORD_VFUNC(i)
94
+ GLMULTITEXCOORD_VFUNC(s)
95
+ #undef GLTEXCOORD_VFUNC
96
+
97
+ #define TRANSPOSEMATRIX_FUNC(_name_,_type_) \
98
+ static void (APIENTRY * fptr_gl##_name_)(const _type_[]); \
99
+ static VALUE \
100
+ gl_##_name_(obj,arg1) \
101
+ VALUE obj,arg1; \
102
+ { \
103
+ _type_ m[4*4]; \
104
+ LOAD_GL_FUNC(gl##_name_,"1.3") \
105
+ ary2cmat##_type_(arg1, m, 4, 4); \
106
+ fptr_gl##_name_(m); \
107
+ CHECK_GLERROR \
108
+ return Qnil; \
109
+ }
110
+
111
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixf,float)
112
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixd,double)
113
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixf,float)
114
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixd,double)
115
+
116
+ #undef TRANSPOSEMATRIX_FUNC
117
+
118
+ static void (APIENTRY * fptr_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,GLvoid*);
119
+ static VALUE
120
+ gl_CompressedTexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
121
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
122
+ {
123
+ GLenum target;
124
+ GLint level;
125
+ GLenum internalformat;
126
+ GLsizei width;
127
+ GLsizei height;
128
+ GLsizei depth;
129
+ GLint border;
130
+ GLsizei imagesize;
131
+ GLvoid *pixels;
132
+ LOAD_GL_FUNC(glCompressedTexImage3D,"1.3")
133
+ target = (GLenum)NUM2INT(arg1);
134
+ level = (GLint)NUM2INT(arg2);
135
+ internalformat = (GLenum)NUM2INT(arg3);
136
+ width = (GLsizei)NUM2UINT(arg4);
137
+ height = (GLsizei)NUM2UINT(arg5);
138
+ depth = (GLsizei)NUM2UINT(arg6);
139
+ border = (GLint)NUM2INT(arg7);
140
+ imagesize = (GLsizei)NUM2UINT(arg8);
141
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
142
+ fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,(GLvoid *)NUM2LONG(arg9));
143
+ } else {
144
+ if (TYPE(arg9) == T_STRING || TYPE(arg9) == T_ARRAY) {
145
+ VALUE data;
146
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg9);
147
+ if (RSTRING_LEN(data) < imagesize)
148
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
149
+ pixels = RSTRING_PTR(data);
150
+ } else if (NIL_P(arg9)) {
151
+ pixels = NULL;
152
+ } else {
153
+ Check_Type(arg9,T_STRING); /* force exception */
154
+ return Qnil;
155
+ }
156
+ fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels);
157
+ }
158
+ CHECK_GLERROR
159
+ return Qnil;
160
+ }
161
+
162
+ static void (APIENTRY * fptr_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,GLvoid*);
163
+ static VALUE
164
+ gl_CompressedTexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
165
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
166
+ {
167
+ GLenum target;
168
+ GLint level;
169
+ GLenum internalformat;
170
+ GLsizei width;
171
+ GLsizei height;
172
+ GLint border;
173
+ GLsizei imagesize;
174
+ GLvoid *pixels;
175
+ LOAD_GL_FUNC(glCompressedTexImage2D,"1.3")
176
+ target = (GLenum)NUM2INT(arg1);
177
+ level = (GLint)NUM2INT(arg2);
178
+ internalformat = (GLenum)NUM2INT(arg3);
179
+ width = (GLsizei)NUM2UINT(arg4);
180
+ height = (GLsizei)NUM2UINT(arg5);
181
+ border = (GLint)NUM2INT(arg6);
182
+ imagesize = (GLsizei)NUM2UINT(arg7);
183
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
184
+ fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,(GLvoid *)NUM2LONG(arg8));
185
+ } else {
186
+ if (TYPE(arg8) == T_STRING || TYPE(arg8) == T_ARRAY) {
187
+ VALUE data;
188
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg8);
189
+ if (RSTRING_LEN(data) < imagesize)
190
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
191
+ pixels = RSTRING_PTR(data);
192
+ } else if (NIL_P(arg8)) {
193
+ pixels = NULL;
194
+ } else {
195
+ Check_Type(arg8,T_STRING); /* force exception */
196
+ return Qnil;
197
+ }
198
+ fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels);
199
+ }
200
+ CHECK_GLERROR
201
+ return Qnil;
202
+ }
203
+
204
+ static void (APIENTRY * fptr_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,GLvoid*);
205
+ static VALUE
206
+ gl_CompressedTexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
207
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
208
+ {
209
+ GLenum target;
210
+ GLint level;
211
+ GLenum internalformat;
212
+ GLsizei width;
213
+ GLint border;
214
+ GLsizei imagesize;
215
+ GLvoid *pixels;
216
+ LOAD_GL_FUNC(glCompressedTexImage1D,"1.3")
217
+ target = (GLenum)NUM2INT(arg1);
218
+ level = (GLint)NUM2INT(arg2);
219
+ internalformat = (GLenum)NUM2INT(arg3);
220
+ width = (GLsizei)NUM2UINT(arg4);
221
+ border = (GLint)NUM2INT(arg5);
222
+ imagesize = (GLsizei)NUM2UINT(arg6);
223
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
224
+ fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,(GLvoid *)NUM2LONG(arg7));
225
+ } else {
226
+ if (TYPE(arg7) == T_STRING || TYPE(arg7) == T_ARRAY) {
227
+ VALUE data;
228
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
229
+ if (RSTRING_LEN(data) < imagesize)
230
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
231
+ pixels = RSTRING_PTR(data);
232
+ } else if (NIL_P(arg7)) {
233
+ pixels = NULL;
234
+ } else {
235
+ Check_Type(arg7,T_STRING); /* force exception */
236
+ return Qnil;
237
+ }
238
+ fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels);
239
+ }
240
+ CHECK_GLERROR
241
+ return Qnil;
242
+ }
243
+
244
+ static void (APIENTRY * fptr_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*);
245
+ static VALUE
246
+ gl_CompressedTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
247
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
248
+ {
249
+ GLenum target;
250
+ GLint level;
251
+ GLint xoffset;
252
+ GLint yoffset;
253
+ GLint zoffset;
254
+ GLsizei width;
255
+ GLsizei height;
256
+ GLsizei depth;
257
+ GLenum format;
258
+ GLsizei imagesize;
259
+ GLvoid *pixels;
260
+ LOAD_GL_FUNC(glCompressedTexSubImage3D,"1.3")
261
+ target = (GLenum)NUM2INT(arg1);
262
+ level = (GLint)NUM2INT(arg2);
263
+ xoffset = (GLint)NUM2INT(arg3);
264
+ yoffset = (GLint)NUM2INT(arg4);
265
+ zoffset = (GLint)NUM2INT(arg5);
266
+ width = (GLsizei)NUM2UINT(arg6);
267
+ height = (GLsizei)NUM2UINT(arg7);
268
+ depth = (GLsizei)NUM2UINT(arg8);
269
+ format = (GLenum)NUM2INT(arg9);
270
+ imagesize = (GLsizei)NUM2UINT(arg10);
271
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
272
+ fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,(GLvoid *)NUM2LONG(arg11));
273
+ } else {
274
+ VALUE data;
275
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg11);
276
+ if (RSTRING_LEN(data) < imagesize)
277
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
278
+ pixels = RSTRING_PTR(data);
279
+
280
+ fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels);
281
+ }
282
+ CHECK_GLERROR
283
+ return Qnil;
284
+ }
285
+
286
+ static void (APIENTRY * fptr_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*);
287
+ static VALUE
288
+ gl_CompressedTexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
289
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
290
+ {
291
+ GLenum target;
292
+ GLint level;
293
+ GLint xoffset;
294
+ GLint yoffset;
295
+ GLsizei width;
296
+ GLsizei height;
297
+ GLenum format;
298
+ GLsizei imagesize;
299
+ GLvoid *pixels;
300
+ LOAD_GL_FUNC(glCompressedTexSubImage2D,"1.3")
301
+ target = (GLenum)NUM2INT(arg1);
302
+ level = (GLint)NUM2INT(arg2);
303
+ xoffset = (GLint)NUM2INT(arg3);
304
+ yoffset = (GLint)NUM2INT(arg4);
305
+ width = (GLsizei)NUM2UINT(arg5);
306
+ height = (GLsizei)NUM2UINT(arg6);
307
+ format = (GLenum)NUM2INT(arg7);
308
+ imagesize = (GLsizei)NUM2UINT(arg8);
309
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
310
+ fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,(GLvoid *)NUM2LONG(arg9));
311
+ } else {
312
+ VALUE data;
313
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg9);
314
+ if (RSTRING_LEN(data) < imagesize)
315
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
316
+ pixels = RSTRING_PTR(data);
317
+ fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels);
318
+ }
319
+ CHECK_GLERROR
320
+ return Qnil;
321
+ }
322
+
323
+ static void (APIENTRY * fptr_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,GLvoid*);
324
+ static VALUE
325
+ gl_CompressedTexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
326
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
327
+ {
328
+ GLenum target;
329
+ GLint level;
330
+ GLint xoffset;
331
+ GLsizei width;
332
+ GLenum format;
333
+ GLsizei imagesize;
334
+ GLvoid *pixels;
335
+ LOAD_GL_FUNC(glCompressedTexSubImage1D,"1.3")
336
+ target = (GLenum)NUM2INT(arg1);
337
+ level = (GLint)NUM2INT(arg2);
338
+ xoffset = (GLint)NUM2INT(arg3);
339
+ width = (GLsizei)NUM2UINT(arg4);
340
+ format = (GLenum)NUM2INT(arg5);
341
+ imagesize = (GLsizei)NUM2UINT(arg6);
342
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
343
+ fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,(GLvoid *)NUM2LONG(arg7));
344
+ } else {
345
+ VALUE data;
346
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
347
+ if (RSTRING_LEN(data) < imagesize)
348
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
349
+ pixels = RSTRING_PTR(data);
350
+ fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels);
351
+ }
352
+ CHECK_GLERROR
353
+ return Qnil;
354
+ }
355
+
356
+ static void (APIENTRY * fptr_glGetCompressedTexImage)(GLenum,GLint,GLvoid*);
357
+ static VALUE
358
+ gl_GetCompressedTexImage(argc,argv,obj)
359
+ int argc;
360
+ VALUE *argv;
361
+ VALUE obj;
362
+ {
363
+ GLenum target;
364
+ GLint lod;
365
+ GLsizei size = 0;
366
+ VALUE data;
367
+ VALUE args[3];
368
+ int numargs;
369
+ LOAD_GL_FUNC(glGetCompressedTexImage,"1.3")
370
+ numargs = rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2]);
371
+ target = (GLenum)NUM2INT(args[0]);
372
+ lod = (GLenum)NUM2INT(args[1]);
373
+ switch(numargs) {
374
+ default:
375
+ case 2:
376
+ if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
377
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
378
+ glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */
379
+ CHECK_GLERROR
380
+ data = allocate_buffer_with_string(size);
381
+ fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING_PTR(data));
382
+ CHECK_GLERROR
383
+ return data;
384
+ case 3:
385
+ fptr_glGetCompressedTexImage(target,lod,(GLvoid*)NUM2LONG(args[2]));
386
+ CHECK_GLERROR
387
+ return Qnil;
388
+ }
389
+ }
390
+
391
+ void gl_init_functions_1_3(VALUE module)
392
+ {
393
+ rb_define_module_function(module, "glActiveTexture", gl_ActiveTexture, 1);
394
+ rb_define_module_function(module, "glClientActiveTexture", gl_ClientActiveTexture, 1);
395
+ rb_define_module_function(module, "glMultiTexCoord1d", gl_MultiTexCoord1d, 2);
396
+ rb_define_module_function(module, "glMultiTexCoord1f", gl_MultiTexCoord1f, 2);
397
+ rb_define_module_function(module, "glMultiTexCoord1i", gl_MultiTexCoord1i, 2);
398
+ rb_define_module_function(module, "glMultiTexCoord1s", gl_MultiTexCoord1s, 2);
399
+ rb_define_module_function(module, "glMultiTexCoord2d", gl_MultiTexCoord2d, 3);
400
+ rb_define_module_function(module, "glMultiTexCoord2f", gl_MultiTexCoord2f, 3);
401
+ rb_define_module_function(module, "glMultiTexCoord2i", gl_MultiTexCoord2i, 3);
402
+ rb_define_module_function(module, "glMultiTexCoord2s", gl_MultiTexCoord2s, 3);
403
+ rb_define_module_function(module, "glMultiTexCoord3d", gl_MultiTexCoord3d, 4);
404
+ rb_define_module_function(module, "glMultiTexCoord3f", gl_MultiTexCoord3f, 4);
405
+ rb_define_module_function(module, "glMultiTexCoord3i", gl_MultiTexCoord3i, 4);
406
+ rb_define_module_function(module, "glMultiTexCoord3s", gl_MultiTexCoord3s, 4);
407
+ rb_define_module_function(module, "glMultiTexCoord4d", gl_MultiTexCoord4d, 5);
408
+ rb_define_module_function(module, "glMultiTexCoord4f", gl_MultiTexCoord4f, 5);
409
+ rb_define_module_function(module, "glMultiTexCoord4i", gl_MultiTexCoord4i, 5);
410
+ rb_define_module_function(module, "glMultiTexCoord4s", gl_MultiTexCoord4s, 5);
411
+ rb_define_module_function(module, "glLoadTransposeMatrixf", gl_LoadTransposeMatrixf, 1);
412
+ rb_define_module_function(module, "glLoadTransposeMatrixd", gl_LoadTransposeMatrixd, 1);
413
+ rb_define_module_function(module, "glMultTransposeMatrixf", gl_MultTransposeMatrixf, 1);
414
+ rb_define_module_function(module, "glMultTransposeMatrixd", gl_MultTransposeMatrixd, 1);
415
+ rb_define_module_function(module, "glSampleCoverage", gl_SampleCoverage, 2);
416
+ rb_define_module_function(module, "glCompressedTexImage3D", gl_CompressedTexImage3D, 9);
417
+ rb_define_module_function(module, "glCompressedTexImage2D", gl_CompressedTexImage2D, 8);
418
+ rb_define_module_function(module, "glCompressedTexImage1D", gl_CompressedTexImage1D, 7);
419
+ rb_define_module_function(module, "glCompressedTexSubImage3D", gl_CompressedTexSubImage3D, 11);
420
+ rb_define_module_function(module, "glCompressedTexSubImage2D", gl_CompressedTexSubImage2D, 9);
421
+ rb_define_module_function(module, "glCompressedTexSubImage1D", gl_CompressedTexSubImage1D, 7);
422
+ rb_define_module_function(module, "glGetCompressedTexImage", gl_GetCompressedTexImage, -1);
423
+
424
+ /* Additional functions */
425
+
426
+ rb_define_module_function(module, "glMultiTexCoord", gl_MultiTexCoorddv, -1);
427
+ rb_define_module_function(module, "glMultiTexCoord1dv", gl_MultiTexCoorddv, -1);
428
+ rb_define_module_function(module, "glMultiTexCoord1fv", gl_MultiTexCoordfv, -1);
429
+ rb_define_module_function(module, "glMultiTexCoord1iv", gl_MultiTexCoordiv, -1);
430
+ rb_define_module_function(module, "glMultiTexCoord1sv", gl_MultiTexCoordsv, -1);
431
+ rb_define_module_function(module, "glMultiTexCoord2dv", gl_MultiTexCoorddv, -1);
432
+ rb_define_module_function(module, "glMultiTexCoord2fv", gl_MultiTexCoordfv, -1);
433
+ rb_define_module_function(module, "glMultiTexCoord2iv", gl_MultiTexCoordiv, -1);
434
+ rb_define_module_function(module, "glMultiTexCoord2sv", gl_MultiTexCoordsv, -1);
435
+ rb_define_module_function(module, "glMultiTexCoord3dv", gl_MultiTexCoorddv, -1);
436
+ rb_define_module_function(module, "glMultiTexCoord3fv", gl_MultiTexCoordfv, -1);
437
+ rb_define_module_function(module, "glMultiTexCoord3iv", gl_MultiTexCoordiv, -1);
438
+ rb_define_module_function(module, "glMultiTexCoord3sv", gl_MultiTexCoordsv, -1);
439
+ rb_define_module_function(module, "glMultiTexCoord4dv", gl_MultiTexCoorddv, -1);
440
+ rb_define_module_function(module, "glMultiTexCoord4fv", gl_MultiTexCoordfv, -1);
441
+ rb_define_module_function(module, "glMultiTexCoord4iv", gl_MultiTexCoordiv, -1);
442
+ rb_define_module_function(module, "glMultiTexCoord4sv", gl_MultiTexCoordsv, -1);
443
+ }
data/ext/gl/gl-1.4.c ADDED
@@ -0,0 +1,348 @@
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 1.4 functions */
19
+
20
+ GL_FUNC_LOAD_4(BlendFuncSeparate,GLvoid, GLenum,GLenum,GLenum,GLenum, "1.4")
21
+ GL_FUNC_LOAD_1(FogCoordf,GLvoid, GLfloat, "1.4")
22
+ GL_FUNC_LOAD_1(FogCoordd,GLvoid, GLdouble, "1.4")
23
+ GL_FUNC_LOAD_2(PointParameteri,GLvoid, GLenum,GLint, "1.4")
24
+ GL_FUNC_LOAD_2(PointParameterf,GLvoid, GLenum,GLfloat, "1.4")
25
+ GL_FUNC_LOAD_3(SecondaryColor3b,GLvoid, GLbyte,GLbyte,GLbyte, "1.4")
26
+ GL_FUNC_LOAD_3(SecondaryColor3d,GLvoid, GLdouble,GLdouble,GLdouble, "1.4")
27
+ GL_FUNC_LOAD_3(SecondaryColor3f,GLvoid, GLfloat,GLfloat,GLfloat, "1.4")
28
+ GL_FUNC_LOAD_3(SecondaryColor3i,GLvoid, GLint,GLint,GLint, "1.4")
29
+ GL_FUNC_LOAD_3(SecondaryColor3s,GLvoid, GLshort,GLshort,GLshort, "1.4")
30
+ GL_FUNC_LOAD_3(SecondaryColor3ub,GLvoid, GLubyte,GLubyte,GLubyte, "1.4")
31
+ GL_FUNC_LOAD_3(SecondaryColor3ui,GLvoid, GLuint,GLuint,GLuint, "1.4")
32
+ GL_FUNC_LOAD_3(SecondaryColor3us,GLvoid, GLushort,GLushort,GLushort, "1.4")
33
+ GL_FUNC_LOAD_2(WindowPos2d,GLvoid, GLdouble,GLdouble, "1.4")
34
+ GL_FUNC_LOAD_2(WindowPos2f,GLvoid, GLfloat,GLfloat, "1.4")
35
+ GL_FUNC_LOAD_2(WindowPos2i,GLvoid, GLint,GLint, "1.4")
36
+ GL_FUNC_LOAD_2(WindowPos2s,GLvoid, GLshort,GLshort, "1.4")
37
+ GL_FUNC_LOAD_3(WindowPos3d,GLvoid, GLdouble,GLdouble,GLdouble, "1.4")
38
+ GL_FUNC_LOAD_3(WindowPos3f,GLvoid, GLfloat,GLfloat,GLfloat, "1.4")
39
+ GL_FUNC_LOAD_3(WindowPos3i,GLvoid, GLint,GLint,GLint, "1.4")
40
+ GL_FUNC_LOAD_3(WindowPos3s,GLvoid, GLshort,GLshort,GLshort, "1.4")
41
+
42
+ static void (APIENTRY * fptr_glFogCoordfv)(GLfloat *);
43
+ static VALUE
44
+ gl_FogCoordfv(obj,arg1)
45
+ VALUE obj,arg1;
46
+ {
47
+ GLfloat coord;
48
+ LOAD_GL_FUNC(glFogCoordfv,"1.4")
49
+ Check_Type(arg1,T_ARRAY);
50
+ ary2cflt(arg1,&coord,1);
51
+ fptr_glFogCoordfv(&coord);
52
+ CHECK_GLERROR
53
+ return Qnil;
54
+ }
55
+
56
+ static void (APIENTRY * fptr_glFogCoorddv)(GLdouble *);
57
+ static VALUE
58
+ gl_FogCoorddv(obj,arg1)
59
+ VALUE obj,arg1;
60
+ {
61
+ GLdouble coord;
62
+ LOAD_GL_FUNC(glFogCoorddv,"1.4")
63
+ Check_Type(arg1,T_ARRAY);
64
+ ary2cdbl(arg1,&coord,1);
65
+ fptr_glFogCoorddv(&coord);
66
+ CHECK_GLERROR
67
+ return Qnil;
68
+ }
69
+
70
+ extern VALUE g_FogCoord_ptr;
71
+ static void (APIENTRY * fptr_glFogCoordPointer)(GLenum,GLsizei,const GLvoid *);
72
+ static VALUE
73
+ gl_FogCoordPointer(obj,arg1,arg2,arg3)
74
+ VALUE obj,arg1,arg2,arg3;
75
+ {
76
+ GLenum type;
77
+ GLsizei stride;
78
+ LOAD_GL_FUNC(glFogCoordPointer,"1.4")
79
+ type = (GLenum)NUM2INT(arg1);
80
+ stride = (GLsizei)NUM2UINT(arg2);
81
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
82
+ g_FogCoord_ptr = arg3;
83
+ fptr_glFogCoordPointer(type, stride, (const GLvoid*)NUM2LONG(arg3));
84
+ } else {
85
+ VALUE data;
86
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg3);
87
+ rb_str_freeze(data);
88
+ g_FogCoord_ptr = data;
89
+ fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
90
+ }
91
+ CHECK_GLERROR
92
+ return Qnil;
93
+ }
94
+
95
+ static void (APIENTRY * fptr_glMultiDrawArrays)(GLenum,GLint*,GLsizei*,GLsizei);
96
+ static VALUE
97
+ gl_MultiDrawArrays(obj,arg1,arg2,arg3)
98
+ VALUE obj,arg1,arg2,arg3;
99
+ {
100
+ GLenum mode;
101
+ GLint *ary1;
102
+ GLsizei *ary2;
103
+ int len1,len2;
104
+ LOAD_GL_FUNC(glMultiDrawArrays,"1.4")
105
+ len1 = (int)RARRAY_LENINT(arg2);
106
+ len2 = (int)RARRAY_LENINT(arg3);
107
+ if (len1!=len2)
108
+ rb_raise(rb_eArgError, "Passed arrays must have same length");
109
+ mode = (GLenum)NUM2INT(arg1);
110
+ ary1 = ALLOC_N(GLint,len1);
111
+ ary2 = ALLOC_N(GLsizei,len2);
112
+ ary2cint(arg2,ary1,len1);
113
+ ary2cint(arg3,ary2,len2);
114
+ fptr_glMultiDrawArrays(mode,ary1,ary2,len1);
115
+ xfree(ary1);
116
+ xfree(ary2);
117
+ CHECK_GLERROR
118
+ return Qnil;
119
+ }
120
+
121
+ static void (APIENTRY * fptr_glMultiDrawElements)(GLenum,const GLsizei *,GLenum,GLvoid **,GLsizei);
122
+ static VALUE
123
+ gl_MultiDrawElements(argc,argv,obj)
124
+ int argc;
125
+ VALUE *argv;
126
+ VALUE obj;
127
+ {
128
+ GLenum mode;
129
+ GLenum type;
130
+ GLsizei *counts;
131
+ GLvoid **indices;
132
+ GLint size;
133
+ int i;
134
+ VALUE ary, args[4];
135
+ LOAD_GL_FUNC(glMultiDrawElements,"1.4")
136
+ switch (rb_scan_args(argc, argv, "31", &args[0], &args[1], &args[2],&args[3])) {
137
+ default:
138
+ case 3:
139
+ if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING))
140
+ rb_raise(rb_eArgError, "Element array buffer bound, but offsets array missing");
141
+ mode = (GLenum)NUM2INT(args[0]);
142
+ type = (GLenum)NUM2INT(args[1]);
143
+ Check_Type(args[2],T_ARRAY);
144
+ ary = args[2];
145
+ size = (GLint)RARRAY_LENINT(ary);
146
+ counts = ALLOC_N(GLsizei,size);
147
+ indices = ALLOC_N(GLvoid*,size);
148
+ for (i=0;i<size;i++) {
149
+ VALUE data;
150
+ data = pack_array_or_pass_string(type,RARRAY_PTR(ary)[i]);
151
+ indices[i] = RSTRING_PTR(data);
152
+ counts[i] = (GLsizei)RSTRING_LENINT(data);
153
+ }
154
+ fptr_glMultiDrawElements(mode,counts,type,indices,size);
155
+ xfree(counts);
156
+ xfree(indices);
157
+ break;
158
+ case 4:
159
+ if (!CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING))
160
+ rb_raise(rb_eArgError, "Element array buffer not bound");
161
+ mode = (GLenum)NUM2INT(args[0]);
162
+ type = (GLenum)NUM2INT(args[1]);
163
+ Check_Type(args[2],T_ARRAY);
164
+ Check_Type(args[3],T_ARRAY);
165
+ if (RARRAY_LEN(args[2]) != RARRAY_LEN(args[3]))
166
+ rb_raise(rb_eArgError, "Count and indices offset array must have same length");
167
+
168
+ size = (GLint)RARRAY_LENINT(args[2]);
169
+
170
+ counts = ALLOC_N(GLsizei,size);
171
+ indices = ALLOC_N(GLvoid*,size);
172
+ for (i=0;i<size;i++) {
173
+ counts[i] = (GLsizei)NUM2INT(rb_ary_entry(args[2],i));
174
+ indices[i] = (GLvoid *)NUM2LONG(rb_ary_entry(args[3],i));
175
+ }
176
+ fptr_glMultiDrawElements(mode,counts,type,indices,size);
177
+ xfree(counts);
178
+ xfree(indices);
179
+ break;
180
+ }
181
+ CHECK_GLERROR
182
+ return Qnil;
183
+ }
184
+
185
+ static void (APIENTRY * fptr_glPointParameterfv)(GLenum,GLfloat *);
186
+ static VALUE
187
+ gl_PointParameterfv(obj,arg1,arg2)
188
+ VALUE obj,arg1,arg2;
189
+ {
190
+ GLenum pname;
191
+ GLfloat params[3] = {(GLfloat)0.0,(GLfloat)0.0,(GLfloat)0.0};
192
+ GLint size;
193
+ LOAD_GL_FUNC(glPointParameterfv,"1.4")
194
+ pname = (GLenum)NUM2INT(arg1);
195
+ Check_Type(arg2,T_ARRAY);
196
+ if (pname==GL_POINT_DISTANCE_ATTENUATION)
197
+ size = 3;
198
+ else
199
+ size = 1;
200
+ ary2cflt(arg2,params,size);
201
+ fptr_glPointParameterfv(pname,params);
202
+ CHECK_GLERROR
203
+ return Qnil;
204
+ }
205
+
206
+ static void (APIENTRY * fptr_glPointParameteriv)(GLenum,GLint *);
207
+ static VALUE
208
+ gl_PointParameteriv(obj,arg1,arg2)
209
+ VALUE obj,arg1,arg2;
210
+ {
211
+ GLenum pname;
212
+ GLint params[3] = {0,0,0};
213
+ GLint size;
214
+ LOAD_GL_FUNC(glPointParameteriv,"1.4")
215
+ pname = (GLenum)NUM2INT(arg1);
216
+ Check_Type(arg2,T_ARRAY);
217
+ if (pname==GL_POINT_DISTANCE_ATTENUATION)
218
+ size = 3;
219
+ else
220
+ size = 1;
221
+ ary2cint(arg2,params,size);
222
+ fptr_glPointParameteriv(pname,params);
223
+ CHECK_GLERROR
224
+ return Qnil;
225
+ }
226
+
227
+ #define GLSECONDARYCOLOR_VFUNC(_name_,_type_,_conv_) \
228
+ static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
229
+ VALUE gl_##_name_(VALUE obj,VALUE arg1) \
230
+ { \
231
+ _type_ cary[3] = {0,0,0}; \
232
+ LOAD_GL_FUNC(gl##_name_,"1.4") \
233
+ Check_Type(arg1,T_ARRAY); \
234
+ _conv_(arg1,cary,3); \
235
+ fptr_gl##_name_(cary); \
236
+ CHECK_GLERROR \
237
+ return Qnil; \
238
+ }
239
+
240
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3bv,GLbyte,ary2cbyte)
241
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3dv,GLdouble,ary2cdbl)
242
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3fv,GLfloat,ary2cflt)
243
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3iv,GLint,ary2cint)
244
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3sv,GLshort,ary2cshort)
245
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3uiv,GLuint,ary2cuint)
246
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3ubv,GLubyte,ary2cubyte)
247
+ GLSECONDARYCOLOR_VFUNC(SecondaryColor3usv,GLushort,ary2cushort)
248
+ #undef GLSECONDARYCOLOR_VFUNC
249
+
250
+ extern VALUE g_SecondaryColor_ptr;
251
+ static void (APIENTRY * fptr_glSecondaryColorPointer)(GLint,GLenum,GLsizei,const GLvoid *);
252
+ static VALUE
253
+ gl_SecondaryColorPointer(obj,arg1,arg2,arg3,arg4)
254
+ VALUE obj,arg1,arg2,arg3,arg4;
255
+ {
256
+ GLint size;
257
+ GLenum type;
258
+ GLsizei stride;
259
+ LOAD_GL_FUNC(glSecondaryColorPointer,"1.4")
260
+ size = (GLint)NUM2INT(arg1);
261
+ type = (GLenum)NUM2INT(arg2);
262
+ stride = (GLsizei)NUM2UINT(arg3);
263
+ if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
264
+ g_SecondaryColor_ptr = arg4;
265
+ fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)NUM2LONG(arg4));
266
+ } else {
267
+ VALUE data;
268
+ data = pack_array_or_pass_string(type,arg4);
269
+ rb_str_freeze(data);
270
+ g_SecondaryColor_ptr = data;
271
+ fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING_PTR(data));
272
+ }
273
+ CHECK_GLERROR
274
+ return Qnil;
275
+ }
276
+
277
+ #define GLWINDOWPOS_VFUNC(_name_,_type_,_size_,_conv_) \
278
+ static void (APIENTRY * fptr_gl##_name_)(_type_ *); \
279
+ VALUE gl_##_name_(VALUE obj,VALUE arg1) \
280
+ { \
281
+ _type_ cary[3] = {0,0,0}; \
282
+ LOAD_GL_FUNC(gl##_name_,"1.4") \
283
+ Check_Type(arg1,T_ARRAY); \
284
+ _conv_(arg1,cary,_size_); \
285
+ fptr_gl##_name_(cary); \
286
+ CHECK_GLERROR \
287
+ return Qnil; \
288
+ }
289
+
290
+ GLWINDOWPOS_VFUNC(WindowPos2dv,GLdouble,2,ary2cdbl)
291
+ GLWINDOWPOS_VFUNC(WindowPos2fv,GLfloat,2,ary2cflt)
292
+ GLWINDOWPOS_VFUNC(WindowPos2iv,GLint,2,ary2cint)
293
+ GLWINDOWPOS_VFUNC(WindowPos2sv,GLshort,2,ary2cshort)
294
+ GLWINDOWPOS_VFUNC(WindowPos3dv,GLdouble,3,ary2cdbl)
295
+ GLWINDOWPOS_VFUNC(WindowPos3fv,GLfloat,3,ary2cflt)
296
+ GLWINDOWPOS_VFUNC(WindowPos3iv,GLint,3,ary2cint)
297
+ GLWINDOWPOS_VFUNC(WindowPos3sv,GLshort,3,ary2cshort)
298
+ #undef GLWINDOWPOS_VFUNC
299
+
300
+
301
+ void gl_init_functions_1_4(VALUE module)
302
+ {
303
+ rb_define_module_function(module, "glBlendFuncSeparate", gl_BlendFuncSeparate, 4);
304
+ rb_define_module_function(module, "glFogCoordf", gl_FogCoordf, 1);
305
+ rb_define_module_function(module, "glFogCoordfv", gl_FogCoordfv, 1);
306
+ rb_define_module_function(module, "glFogCoordd", gl_FogCoordd, 1);
307
+ rb_define_module_function(module, "glFogCoorddv", gl_FogCoorddv, 1);
308
+ rb_define_module_function(module, "glFogCoordPointer", gl_FogCoordPointer, 3);
309
+ rb_define_module_function(module, "glMultiDrawArrays", gl_MultiDrawArrays, 3);
310
+ rb_define_module_function(module, "glMultiDrawElements", gl_MultiDrawElements, -1);
311
+ rb_define_module_function(module, "glPointParameterf", gl_PointParameterf, 2);
312
+ rb_define_module_function(module, "glPointParameterfv", gl_PointParameterfv, 2);
313
+ rb_define_module_function(module, "glPointParameteri", gl_PointParameteri, 2);
314
+ rb_define_module_function(module, "glPointParameteriv", gl_PointParameteriv, 2);
315
+ rb_define_module_function(module, "glSecondaryColor3b", gl_SecondaryColor3b, 3);
316
+ rb_define_module_function(module, "glSecondaryColor3d", gl_SecondaryColor3d, 3);
317
+ rb_define_module_function(module, "glSecondaryColor3f", gl_SecondaryColor3f, 3);
318
+ rb_define_module_function(module, "glSecondaryColor3i", gl_SecondaryColor3i, 3);
319
+ rb_define_module_function(module, "glSecondaryColor3s", gl_SecondaryColor3s, 3);
320
+ rb_define_module_function(module, "glSecondaryColor3ub", gl_SecondaryColor3ub, 3);
321
+ rb_define_module_function(module, "glSecondaryColor3ui", gl_SecondaryColor3ui, 3);
322
+ rb_define_module_function(module, "glSecondaryColor3us", gl_SecondaryColor3us, 3);
323
+ rb_define_module_function(module, "glSecondaryColor3bv", gl_SecondaryColor3bv, 1);
324
+ rb_define_module_function(module, "glSecondaryColor3dv", gl_SecondaryColor3dv, 1);
325
+ rb_define_module_function(module, "glSecondaryColor3fv", gl_SecondaryColor3fv, 1);
326
+ rb_define_module_function(module, "glSecondaryColor3iv", gl_SecondaryColor3iv, 1);
327
+ rb_define_module_function(module, "glSecondaryColor3sv", gl_SecondaryColor3sv, 1);
328
+ rb_define_module_function(module, "glSecondaryColor3ubv", gl_SecondaryColor3ubv, 1);
329
+ rb_define_module_function(module, "glSecondaryColor3uiv", gl_SecondaryColor3uiv, 1);
330
+ rb_define_module_function(module, "glSecondaryColor3usv", gl_SecondaryColor3usv, 1);
331
+ rb_define_module_function(module, "glSecondaryColorPointer", gl_SecondaryColorPointer, 4);
332
+ rb_define_module_function(module, "glWindowPos2d", gl_WindowPos2d, 2);
333
+ rb_define_module_function(module, "glWindowPos2f", gl_WindowPos2f, 2);
334
+ rb_define_module_function(module, "glWindowPos2i", gl_WindowPos2i, 2);
335
+ rb_define_module_function(module, "glWindowPos2s", gl_WindowPos2s, 2);
336
+ rb_define_module_function(module, "glWindowPos3d", gl_WindowPos3d, 3);
337
+ rb_define_module_function(module, "glWindowPos3f", gl_WindowPos3f, 3);
338
+ rb_define_module_function(module, "glWindowPos3i", gl_WindowPos3i, 3);
339
+ rb_define_module_function(module, "glWindowPos3s", gl_WindowPos3s, 3);
340
+ rb_define_module_function(module, "glWindowPos2dv", gl_WindowPos2dv, 1);
341
+ rb_define_module_function(module, "glWindowPos2fv", gl_WindowPos2fv, 1);
342
+ rb_define_module_function(module, "glWindowPos2iv", gl_WindowPos2iv, 1);
343
+ rb_define_module_function(module, "glWindowPos2sv", gl_WindowPos2sv, 1);
344
+ rb_define_module_function(module, "glWindowPos3dv", gl_WindowPos3dv, 1);
345
+ rb_define_module_function(module, "glWindowPos3fv", gl_WindowPos3fv, 1);
346
+ rb_define_module_function(module, "glWindowPos3iv", gl_WindowPos3iv, 1);
347
+ rb_define_module_function(module, "glWindowPos3sv", gl_WindowPos3sv, 1);
348
+ }