danabr75-opengl 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +29 -0
  3. data/.gemtest +0 -0
  4. data/.gitignore +6 -0
  5. data/.travis.yml +19 -0
  6. data/Gemfile +8 -0
  7. data/History.md +101 -0
  8. data/MIT-LICENSE +18 -0
  9. data/Manifest.txt +142 -0
  10. data/README.rdoc +105 -0
  11. data/Rakefile +170 -0
  12. data/danabr75-opengl.gemspec +32 -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 +157 -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/GL/gl.h +2115 -0
  96. data/ext/opengl/GL/glext.h +11770 -0
  97. data/ext/opengl/common.h +372 -0
  98. data/ext/opengl/conv.h +247 -0
  99. data/ext/opengl/extconf.rb +19 -0
  100. data/ext/opengl/fptr_struct.h +912 -0
  101. data/ext/opengl/funcdef.h +279 -0
  102. data/ext/opengl/gl-1.0-1.1.c +3345 -0
  103. data/ext/opengl/gl-1.2.c +155 -0
  104. data/ext/opengl/gl-1.3.c +447 -0
  105. data/ext/opengl/gl-1.4.c +346 -0
  106. data/ext/opengl/gl-1.5.c +225 -0
  107. data/ext/opengl/gl-2.0.c +665 -0
  108. data/ext/opengl/gl-2.1.c +57 -0
  109. data/ext/opengl/gl-3.0.c +502 -0
  110. data/ext/opengl/gl-enums.c +4853 -0
  111. data/ext/opengl/gl-enums.h +14528 -0
  112. data/ext/opengl/gl-error.c +110 -0
  113. data/ext/opengl/gl-error.h +25 -0
  114. data/ext/opengl/gl-ext-3dfx.c +27 -0
  115. data/ext/opengl/gl-ext-arb.c +880 -0
  116. data/ext/opengl/gl-ext-ati.c +41 -0
  117. data/ext/opengl/gl-ext-ext.c +885 -0
  118. data/ext/opengl/gl-ext-gremedy.c +41 -0
  119. data/ext/opengl/gl-ext-nv.c +679 -0
  120. data/ext/opengl/gl.c +265 -0
  121. data/ext/opengl/gl_buffer.c +202 -0
  122. data/ext/opengl/glimpl.c +187 -0
  123. data/ext/opengl/glimpl.h +47 -0
  124. data/ext/opengl/opengl.c +9 -0
  125. data/lib/gl.rb +1 -0
  126. data/lib/opengl.rb +79 -0
  127. data/lib/opengl/bindings_version.rb +4 -0
  128. data/lib/opengl/implementation.rb +38 -0
  129. data/lib/opengl/test_case.rb +86 -0
  130. data/test/dummy.xorg.conf +140 -0
  131. data/test/test_gl.rb +45 -0
  132. data/test/test_gl_10_11.rb +1363 -0
  133. data/test/test_gl_12.rb +71 -0
  134. data/test/test_gl_13.rb +221 -0
  135. data/test/test_gl_14.rb +218 -0
  136. data/test/test_gl_15.rb +258 -0
  137. data/test/test_gl_20.rb +417 -0
  138. data/test/test_gl_21.rb +436 -0
  139. data/test/test_gl_ext_arb.rb +508 -0
  140. data/test/test_gl_ext_ati.rb +28 -0
  141. data/test/test_gl_ext_ext.rb +608 -0
  142. data/test/test_gl_ext_gremedy.rb +29 -0
  143. data/test/test_gl_ext_nv.rb +349 -0
  144. data/test/test_glimpl.rb +23 -0
  145. data/test/test_opengl_buffer.rb +122 -0
  146. data/utils/README +6 -0
  147. data/utils/enumgen.rb +108 -0
  148. data/utils/extlistgen.rb +90 -0
  149. metadata +326 -0
@@ -0,0 +1,279 @@
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
+ #ifndef _FUNCDEF_H_
17
+ #define _FUNCDEF_H_
18
+
19
+ /*
20
+ These macros are for simplification of function definition, as passing
21
+ arguments from/to OpenGL usually follows the same few patterns. It would
22
+ be probably wise to adapt the whole bindings to C++ (templates, overloaded
23
+ functions, etc.), but for now supporting ruby extension for Windows means
24
+ MSVC6, and that in turn means unspeakable horrors and pains for everyone
25
+ attempting to merely write, much less debug or maintain any template-based
26
+ code.
27
+ */
28
+
29
+ /*
30
+ * Loads the function pointer for function _NAME_ on first call to the
31
+ * function, or raises a NotImplementedError if the OpenGL version is less
32
+ * then required or the required extension is not supported.
33
+ */
34
+ #define LOAD_GL_FUNC(_NAME_, _VEREXT_) \
35
+ do { \
36
+ fptr_##_NAME_ = GET_GLIMPL_VARIABLE(glfuncs._NAME_); \
37
+ if (fptr_##_NAME_==NULL){ \
38
+ if (_VEREXT_) EnsureVersionExtension(obj, (_VEREXT_)); \
39
+ fptr_##_NAME_ = GET_GLIMPL_VARIABLE(load_gl_function)(obj,#_NAME_, 1); \
40
+ SET_GLIMPL_VARIABLE(glfuncs._NAME_,fptr_##_NAME_); \
41
+ } \
42
+ } while (0)
43
+
44
+ #if defined(GLFUNC_MAGIC_START)
45
+ #define DECL_GL_FUNC_PTR(_returntype_,_name_,_args_) \
46
+ GLFUNC_MAGIC_START _returntype_ (GLFUNC_MAGIC_APIENTRY * _name_)_args_ GLFUNC_MAGIC_END
47
+ #else
48
+ #define DECL_GL_FUNC_PTR(_returntype_,_name_,_args_) \
49
+ _returntype_ (APIENTRY * fptr_##_name_)_args_ = NULL
50
+ #endif
51
+
52
+ /*
53
+ Macroset for defining simple functions, i.e. functions that take n arguments and
54
+ pass them to GL API function without any additional processing.
55
+
56
+ Some checking is implicit in _conversion_ argument - e.g. NUM2INT makes sure that
57
+ user is really passing type that can be converted to INT, otherwire raises.
58
+
59
+ *_LOAD version of macros are for defining functions where we load function pointer
60
+ instead of direct call - that means all functions above OpenGL 1.1 (including all extensions)
61
+ */
62
+
63
+ #define ARGLIST0
64
+ #define ARGLIST1 ,arg1
65
+ #define ARGLIST2 ,arg1,arg2
66
+ #define ARGLIST3 ,arg1,arg2,arg3
67
+ #define ARGLIST4 ,arg1,arg2,arg3,arg4
68
+ #define ARGLIST5 ,arg1,arg2,arg3,arg4,arg5
69
+ #define ARGLIST6 ,arg1,arg2,arg3,arg4,arg5,arg6
70
+ #define ARGLIST7 ,arg1,arg2,arg3,arg4,arg5,arg6,arg7
71
+ #define ARGLIST8 ,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8
72
+ #define ARGLIST9 ,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9
73
+ #define ARGLIST10 ,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10
74
+
75
+ #define CONV_GLenum (GLenum)RUBY2GLENUM
76
+ #define CONV_GLboolean (GLboolean)RUBYBOOL2GL
77
+ #define CONV_GLbitfield (GLbitfield)NUM2UINT
78
+ #define CONV_GLbyte (GLbyte)NUM2INT
79
+ #define CONV_GLshort (GLshort)NUM2INT
80
+ #define CONV_GLint (GLint)NUM2INT
81
+ #define CONV_GLubyte (GLubyte)NUM2UINT
82
+ #define CONV_GLushort (GLushort)NUM2UINT
83
+ #define CONV_GLuint (GLuint)NUM2UINT
84
+ #define CONV_GLsizei (GLsizei)NUM2INT
85
+ #define CONV_GLfloat (GLfloat)NUM2DBL
86
+ #define CONV_GLclampf (GLclampf)NUM2DBL
87
+ #define CONV_GLdouble (GLdouble)NUM2DBL
88
+ #define CONV_GLclampd (GLclampd)NUM2DBL
89
+
90
+ #define RETDECL_BASE(_t_) _t_ ret = (_t_) 0;
91
+ #define RETDECL_GLvoid
92
+ #define RETDECL_void
93
+ #define RETDECL_GLenum RETDECL_BASE(GLenum)
94
+ #define RETDECL_GLboolean RETDECL_BASE(GLboolean)
95
+ #define RETDECL_GLbitfield RETDECL_BASE(GLbitfield)
96
+ #define RETDECL_GLbyte RETDECL_BASE(GLbyte)
97
+ #define RETDECL_GLshort RETDECL_BASE(GLshort)
98
+ #define RETDECL_GLint RETDECL_BASE(GLint)
99
+ #define RETDECL_GLubyte RETDECL_BASE(GLubyte)
100
+ #define RETDECL_GLushort RETDECL_BASE(GLushort)
101
+ #define RETDECL_GLuint RETDECL_BASE(GLuint)
102
+ #define RETDECL_GLsizei RETDECL_BASE(GLsizei)
103
+ #define RETDECL_GLfloat RETDECL_BASE(GLfloat)
104
+ #define RETDECL_GLclampf RETDECL_BASE(GLclampf)
105
+ #define RETDECL_GLdouble RETDECL_BASE(GLdouble)
106
+ #define RETDECL_GLclampd RETDECL_BASE(GLclampd)
107
+
108
+ #define RETSTAT_GLvoid
109
+ #define RETSTAT_void
110
+ #define RETSTAT_GLenum ret=
111
+ #define RETSTAT_GLboolean ret=
112
+ #define RETSTAT_GLbitfield ret=
113
+ #define RETSTAT_GLbyte ret=
114
+ #define RETSTAT_GLshort ret=
115
+ #define RETSTAT_GLint ret=
116
+ #define RETSTAT_GLubyte ret=
117
+ #define RETSTAT_GLushort ret=
118
+ #define RETSTAT_GLuint ret=
119
+ #define RETSTAT_GLsizei ret=
120
+ #define RETSTAT_GLfloat ret=
121
+ #define RETSTAT_GLclampf ret=
122
+ #define RETSTAT_GLdouble ret=
123
+ #define RETSTAT_GLclampd ret=
124
+
125
+ #define RETCONV_GLvoid(x) Qnil
126
+ #define RETCONV_void(x) Qnil
127
+ #define RETCONV_GLenum(x) UINT2NUM(x)
128
+ #define RETCONV_GLboolean(x) GLBOOL2RUBY(x)
129
+ #define RETCONV_GLbitfield(x) UINT2NUM(x)
130
+ #define RETCONV_GLbyte(x) INT2NUM(x)
131
+ #define RETCONV_GLshort(x) INT2NUM(x)
132
+ #define RETCONV_GLsizeiptr(x) ULONG2NUM(x)
133
+ #define RETCONV_GLint(x) INT2NUM(x)
134
+ #define RETCONV_GLubyte(x) UINT2NUM(x)
135
+ #define RETCONV_GLushort(x) UINT2NUM(x)
136
+ #define RETCONV_GLuint(x) UINT2NUM(x)
137
+ #define RETCONV_GLsizei(x) INT2NUM(x)
138
+ #define RETCONV_GLfloat(x) rb_float_new(x)
139
+ #define RETCONV_GLclampf(x) rb_float_new(x)
140
+ #define RETCONV_GLdouble(x) rb_float_new(x)
141
+ #define RETCONV_GLclampd(x) rb_float_new(x)
142
+
143
+ #define PROTOPARAM0(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) void
144
+ #define PROTOPARAM1(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1
145
+ #define PROTOPARAM2(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2
146
+ #define PROTOPARAM3(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3
147
+ #define PROTOPARAM4(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4
148
+ #define PROTOPARAM5(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5
149
+ #define PROTOPARAM6(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6
150
+ #define PROTOPARAM7(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6,p7
151
+ #define PROTOPARAM8(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6,p7,p8
152
+ #define PROTOPARAM9(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6,p7,p8,p9
153
+ #define PROTOPARAM10(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6,p7,p8,p9,p10
154
+
155
+ #define CALLCONV0(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10)
156
+ #define CALLCONV1(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1)
157
+ #define CALLCONV2(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2)
158
+ #define CALLCONV3(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3)
159
+ #define CALLCONV4(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4)
160
+ #define CALLCONV5(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5)
161
+ #define CALLCONV6(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5),CONV_##cv6(arg6)
162
+ #define CALLCONV7(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5),CONV_##cv6(arg6),CONV_##cv7(arg7)
163
+ #define CALLCONV8(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5),CONV_##cv6(arg6),CONV_##cv7(arg7),CONV_##cv8(arg8)
164
+ #define CALLCONV9(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5),CONV_##cv6(arg6),CONV_##cv7(arg7),CONV_##cv8(arg8),CONV_##cv9(arg9)
165
+ #define CALLCONV10(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5),CONV_##cv6(arg6),CONV_##cv7(arg7),CONV_##cv8(arg8),CONV_##cv9(arg9),CONV_##cv10(arg10)
166
+
167
+ #define GL_FUNC_LOAD(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_) \
168
+ static VALUE \
169
+ gl_##_name_(obj ARGLIST##_num_) \
170
+ VALUE obj ARGLIST##_num_; \
171
+ { \
172
+ RETDECL_##_returntype_ \
173
+ DECL_GL_FUNC_PTR(_returntype_,gl##_name_,(PROTOPARAM##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10))); \
174
+ LOAD_GL_FUNC(gl##_name_,_ver_); \
175
+ RETSTAT_##_returntype_ fptr_gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
176
+ CHECK_GLERROR_FROM("gl" #_name_); \
177
+ return RETCONV_##_returntype_(ret) ; \
178
+ }
179
+
180
+ #define GL_FUNC_STATIC(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10) \
181
+ GL_FUNC_LOAD(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,NULL)
182
+
183
+ #define GL_FUNC_LOAD_0(_name_,_returntype_,_ver_) \
184
+ GL_FUNC_LOAD(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0,_ver_)
185
+ #define GL_FUNC_LOAD_1(_name_,_returntype_,targ1,_ver_) \
186
+ GL_FUNC_LOAD(1, _name_,_returntype_,targ1,0,0,0,0,0,0,0,0,0,_ver_)
187
+ #define GL_FUNC_LOAD_2(_name_,_returntype_,targ1,targ2,_ver_) \
188
+ GL_FUNC_LOAD(2, _name_,_returntype_,targ1,targ2,0,0,0,0,0,0,0,0,_ver_)
189
+ #define GL_FUNC_LOAD_3(_name_,_returntype_,targ1,targ2,targ3,_ver_) \
190
+ GL_FUNC_LOAD(3, _name_,_returntype_,targ1,targ2,targ3,0,0,0,0,0,0,0,_ver_)
191
+ #define GL_FUNC_LOAD_4(_name_,_returntype_,targ1,targ2,targ3,targ4,_ver_) \
192
+ GL_FUNC_LOAD(4, _name_,_returntype_,targ1,targ2,targ3,targ4,0,0,0,0,0,0,_ver_)
193
+ #define GL_FUNC_LOAD_5(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,_ver_) \
194
+ GL_FUNC_LOAD(5, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,0,0,0,0,0,_ver_)
195
+ #define GL_FUNC_LOAD_6(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,_ver_) \
196
+ GL_FUNC_LOAD(6, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,0,0,0,0,_ver_)
197
+ #define GL_FUNC_LOAD_7(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,_ver_) \
198
+ GL_FUNC_LOAD(7, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,0,0,0,_ver_)
199
+ #define GL_FUNC_LOAD_8(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,_ver_) \
200
+ GL_FUNC_LOAD(8, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,0,0,_ver_)
201
+ #define GL_FUNC_LOAD_9(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,_ver_) \
202
+ GL_FUNC_LOAD(9, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,0,_ver_)
203
+ #define GL_FUNC_LOAD_10(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_) \
204
+ GL_FUNC_LOAD(10, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_)
205
+
206
+ #define GL_FUNC_STATIC_0(_name_,_returntype_) \
207
+ GL_FUNC_STATIC(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0)
208
+ #define GL_FUNC_STATIC_1(_name_,_returntype_,targ1) \
209
+ GL_FUNC_STATIC(1, _name_,_returntype_,targ1,0,0,0,0,0,0,0,0,0)
210
+ #define GL_FUNC_STATIC_2(_name_,_returntype_,targ1,targ2) \
211
+ GL_FUNC_STATIC(2, _name_,_returntype_,targ1,targ2,0,0,0,0,0,0,0,0)
212
+ #define GL_FUNC_STATIC_3(_name_,_returntype_,targ1,targ2,targ3) \
213
+ GL_FUNC_STATIC(3, _name_,_returntype_,targ1,targ2,targ3,0,0,0,0,0,0,0)
214
+ #define GL_FUNC_STATIC_4(_name_,_returntype_,targ1,targ2,targ3,targ4) \
215
+ GL_FUNC_STATIC(4, _name_,_returntype_,targ1,targ2,targ3,targ4,0,0,0,0,0,0)
216
+ #define GL_FUNC_STATIC_5(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5) \
217
+ GL_FUNC_STATIC(5, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,0,0,0,0,0)
218
+ #define GL_FUNC_STATIC_6(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6) \
219
+ GL_FUNC_STATIC(6, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,0,0,0,0)
220
+ #define GL_FUNC_STATIC_7(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7) \
221
+ GL_FUNC_STATIC(7, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,0,0,0)
222
+ #define GL_FUNC_STATIC_8(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8) \
223
+ GL_FUNC_STATIC(8, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,0,0)
224
+ #define GL_FUNC_STATIC_9(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9) \
225
+ GL_FUNC_STATIC(9, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,0)
226
+ #define GL_FUNC_STATIC_10(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10_ver_) \
227
+ GL_FUNC_STATIC(10, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)
228
+
229
+ /* Templates for glGen* and glDelete* */
230
+
231
+ #define GL_FUNC_GENOBJECTS_LOAD(_name_,_ver_) \
232
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
233
+ { \
234
+ GLsizei n; \
235
+ GLuint *objects; \
236
+ VALUE ret; \
237
+ GLsizei i; \
238
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLsizei,GLuint *)); \
239
+ LOAD_GL_FUNC(gl##_name_,_ver_); \
240
+ n = CONV_GLsizei(arg1); \
241
+ objects = ALLOC_N(GLuint, n); \
242
+ fptr_gl##_name_(n,objects); \
243
+ ret = rb_ary_new2(n); \
244
+ for (i = 0; i < n; i++) \
245
+ rb_ary_push(ret, RETCONV_GLuint(objects[i])); \
246
+ xfree(objects); \
247
+ CHECK_GLERROR_FROM("gl" #_name_); \
248
+ return ret; \
249
+ }
250
+
251
+ #define GL_FUNC_GENOBJECTS(_name_) \
252
+ GL_FUNC_GENOBJECTS_LOAD(_name_,"1.1")
253
+
254
+ #define GL_FUNC_DELETEOBJECTS_LOAD(_name_,_ver_) \
255
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
256
+ { \
257
+ GLsizei n; \
258
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLsizei,const GLuint *)); \
259
+ LOAD_GL_FUNC(gl##_name_,_ver_); \
260
+ if (TYPE(arg1)==T_ARRAY) { \
261
+ GLuint *objects; \
262
+ n = (GLsizei)RARRAY_LENINT(arg1); \
263
+ objects = ALLOC_N(GLuint,n); \
264
+ ary2cuint(arg1,objects,n); \
265
+ fptr_gl##_name_(n,objects); \
266
+ xfree(objects); \
267
+ } else { \
268
+ GLuint object; \
269
+ object = CONV_GLsizei(arg1); \
270
+ fptr_gl##_name_(1,&object); \
271
+ } \
272
+ CHECK_GLERROR_FROM("gl" #_name_); \
273
+ return Qnil; \
274
+ }
275
+
276
+ #define GL_FUNC_DELETEOBJECTS(_name_) \
277
+ GL_FUNC_DELETEOBJECTS_LOAD(_name_,"1.1")
278
+
279
+ #endif
@@ -0,0 +1,3345 @@
1
+ /*
2
+ * Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
3
+ * Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
4
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
5
+ *
6
+ * This program is distributed under the terms of the MIT license.
7
+ * See the included MIT-LICENSE file for the terms of this license.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
12
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
13
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
14
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
15
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ */
17
+
18
+ #include "common.h"
19
+
20
+ #ifndef MAX
21
+ #define MAX(a, b) (((a) > (b)) ? (a) : (b))
22
+ #endif
23
+
24
+ /* OpenGL 1.0 + 1.1 functions */
25
+
26
+ GL_FUNC_STATIC_2(Accum,GLvoid, GLenum,GLfloat)
27
+ GL_FUNC_STATIC_2(AlphaFunc,GLvoid, GLenum,GLclampf)
28
+ GL_FUNC_STATIC_1(ArrayElement,GLvoid, GLint)
29
+ GL_FUNC_STATIC_2(BindTexture,GLvoid, GLenum,GLuint)
30
+ GL_FUNC_STATIC_2(BlendFunc,GLvoid, GLenum,GLenum)
31
+ GL_FUNC_STATIC_1(CallList,GLvoid, GLuint)
32
+ GL_FUNC_STATIC_1(Clear,GLvoid, GLbitfield)
33
+ GL_FUNC_STATIC_4(ClearAccum,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
34
+ GL_FUNC_STATIC_4(ClearColor,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
35
+ GL_FUNC_STATIC_1(ClearDepth,GLvoid, GLclampd)
36
+ GL_FUNC_STATIC_1(ClearIndex,GLvoid, GLfloat)
37
+ GL_FUNC_STATIC_1(ClearStencil,GLvoid, GLint)
38
+ GL_FUNC_STATIC_3(Color3b,GLvoid, GLbyte,GLbyte,GLbyte)
39
+ GL_FUNC_STATIC_3(Color3d,GLvoid, GLdouble,GLdouble,GLdouble)
40
+ GL_FUNC_STATIC_3(Color3f,GLvoid, GLfloat,GLfloat,GLfloat)
41
+ GL_FUNC_STATIC_3(Color3i,GLvoid, GLint,GLint,GLint)
42
+ GL_FUNC_STATIC_3(Color3s,GLvoid, GLshort,GLshort,GLshort)
43
+ GL_FUNC_STATIC_3(Color3ub,GLvoid, GLubyte,GLubyte,GLubyte)
44
+ GL_FUNC_STATIC_3(Color3ui,GLvoid, GLuint,GLuint,GLuint)
45
+ GL_FUNC_STATIC_3(Color3us,GLvoid, GLushort,GLushort,GLushort)
46
+ GL_FUNC_STATIC_4(Color4b,GLvoid, GLbyte,GLbyte,GLbyte,GLbyte)
47
+ GL_FUNC_STATIC_4(Color4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
48
+ GL_FUNC_STATIC_4(Color4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
49
+ GL_FUNC_STATIC_4(Color4i,GLvoid, GLint,GLint,GLint,GLint)
50
+ GL_FUNC_STATIC_4(Color4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
51
+ GL_FUNC_STATIC_4(Color4ub,GLvoid, GLubyte,GLubyte,GLubyte,GLubyte)
52
+ GL_FUNC_STATIC_4(Color4ui,GLvoid, GLuint,GLuint,GLuint,GLuint)
53
+ GL_FUNC_STATIC_4(Color4us,GLvoid, GLushort,GLushort,GLushort,GLushort)
54
+ GL_FUNC_STATIC_4(ColorMask,GLvoid, GLboolean,GLboolean,GLboolean,GLboolean)
55
+ GL_FUNC_STATIC_2(ColorMaterial,GLvoid, GLenum,GLenum)
56
+ GL_FUNC_STATIC_5(CopyPixels,GLvoid, GLint,GLint,GLsizei,GLsizei,GLenum)
57
+ GL_FUNC_STATIC_7(CopyTexImage1D,GLvoid, GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLint)
58
+ GL_FUNC_STATIC_8(CopyTexImage2D,GLvoid, GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint)
59
+ GL_FUNC_STATIC_6(CopyTexSubImage1D,GLvoid, GLenum,GLint,GLint,GLint,GLint,GLsizei)
60
+ GL_FUNC_STATIC_8(CopyTexSubImage2D,GLvoid, GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei)
61
+ GL_FUNC_STATIC_1(CullFace,GLvoid, GLenum)
62
+ GL_FUNC_STATIC_2(DeleteLists,GLvoid, GLuint,GLuint)
63
+ GL_FUNC_STATIC_1(DepthFunc,GLvoid, GLenum)
64
+ GL_FUNC_STATIC_1(DepthMask,GLvoid, GLboolean)
65
+ GL_FUNC_STATIC_2(DepthRange,GLvoid, GLclampd,GLclampd)
66
+ GL_FUNC_STATIC_3(DrawArrays,GLvoid, GLenum,GLint,GLsizei)
67
+ GL_FUNC_STATIC_1(DrawBuffer,GLvoid, GLenum)
68
+ GL_FUNC_STATIC_1(EdgeFlag,GLvoid, GLboolean)
69
+ GL_FUNC_STATIC_1(EvalCoord1d,GLvoid, GLdouble)
70
+ GL_FUNC_STATIC_1(EvalCoord1f,GLvoid, GLfloat)
71
+ GL_FUNC_STATIC_2(EvalCoord2d,GLvoid, GLdouble,GLdouble)
72
+ GL_FUNC_STATIC_2(EvalCoord2f,GLvoid, GLfloat,GLfloat)
73
+ GL_FUNC_STATIC_3(EvalMesh1,GLvoid, GLenum,GLint,GLint)
74
+ GL_FUNC_STATIC_5(EvalMesh2,GLvoid, GLenum,GLint,GLint,GLint,GLint)
75
+ GL_FUNC_STATIC_1(EvalPoint1,GLvoid, GLint)
76
+ GL_FUNC_STATIC_2(EvalPoint2,GLvoid, GLint,GLint)
77
+ GL_FUNC_STATIC_0(Finish,GLvoid)
78
+ GL_FUNC_STATIC_0(Flush,GLvoid)
79
+ GL_FUNC_STATIC_2(Fogi,GLvoid, GLenum,GLint)
80
+ GL_FUNC_STATIC_2(Fogf,GLvoid, GLenum,GLfloat)
81
+ GL_FUNC_STATIC_1(FrontFace,GLvoid, GLenum)
82
+ GL_FUNC_STATIC_6(Frustum,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble)
83
+ GL_FUNC_STATIC_1(GenLists,GLuint, GLsizei)
84
+ GL_FUNC_STATIC_0(GetError,GLenum)
85
+ GL_FUNC_STATIC_2(Hint,GLvoid, GLenum,GLenum)
86
+ GL_FUNC_STATIC_1(Indexd,GLvoid, GLdouble)
87
+ GL_FUNC_STATIC_1(Indexf,GLvoid, GLfloat)
88
+ GL_FUNC_STATIC_1(Indexi,GLvoid, GLint)
89
+ GL_FUNC_STATIC_1(IndexMask,GLvoid, GLuint)
90
+ GL_FUNC_STATIC_1(Indexs,GLvoid, GLshort)
91
+ GL_FUNC_STATIC_1(Indexub,GLvoid, GLubyte)
92
+ GL_FUNC_STATIC_0(InitNames,GLvoid)
93
+ GL_FUNC_STATIC_1(IsEnabled,GLboolean, GLenum)
94
+ GL_FUNC_STATIC_1(IsList,GLboolean, GLuint)
95
+ GL_FUNC_STATIC_1(IsTexture,GLboolean, GLuint)
96
+ GL_FUNC_STATIC_2(LightModelf,GLvoid, GLenum,GLfloat)
97
+ GL_FUNC_STATIC_2(LightModeli,GLvoid, GLenum,GLint)
98
+ GL_FUNC_STATIC_3(Lightf,GLvoid, GLenum,GLenum,GLfloat)
99
+ GL_FUNC_STATIC_3(Lighti,GLvoid, GLenum,GLenum,GLint)
100
+ GL_FUNC_STATIC_2(LineStipple,GLvoid, GLint,GLushort)
101
+ GL_FUNC_STATIC_1(LineWidth,GLvoid, GLfloat)
102
+ GL_FUNC_STATIC_1(ListBase,GLvoid, GLuint)
103
+ GL_FUNC_STATIC_0(LoadIdentity,GLvoid)
104
+ GL_FUNC_STATIC_1(LoadName,GLvoid, GLuint)
105
+ GL_FUNC_STATIC_1(LogicOp,GLvoid, GLenum)
106
+ GL_FUNC_STATIC_3(MapGrid1d,GLvoid, GLint,GLdouble,GLdouble)
107
+ GL_FUNC_STATIC_3(MapGrid1f,GLvoid, GLint,GLfloat,GLfloat)
108
+ GL_FUNC_STATIC_6(MapGrid2d,GLvoid, GLint,GLdouble,GLdouble,GLint,GLdouble,GLdouble)
109
+ GL_FUNC_STATIC_6(MapGrid2f,GLvoid, GLint,GLfloat,GLfloat,GLint,GLfloat,GLfloat)
110
+ GL_FUNC_STATIC_3(Materialf,GLvoid, GLenum,GLenum,GLfloat)
111
+ GL_FUNC_STATIC_3(Materiali,GLvoid, GLenum,GLenum,GLint)
112
+ GL_FUNC_STATIC_1(MatrixMode,GLvoid, GLenum)
113
+ GL_FUNC_STATIC_3(Normal3b,GLvoid, GLbyte,GLbyte,GLbyte)
114
+ GL_FUNC_STATIC_3(Normal3d,GLvoid, GLdouble,GLdouble,GLdouble)
115
+ GL_FUNC_STATIC_3(Normal3f,GLvoid, GLfloat,GLfloat,GLfloat)
116
+ GL_FUNC_STATIC_3(Normal3i,GLvoid, GLint,GLint,GLint)
117
+ GL_FUNC_STATIC_3(Normal3s,GLvoid, GLshort,GLshort,GLshort)
118
+ GL_FUNC_STATIC_6(Ortho,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble)
119
+ GL_FUNC_STATIC_1(PassThrough,GLvoid, GLfloat)
120
+ GL_FUNC_STATIC_2(PixelStoref,GLvoid, GLenum,GLfloat)
121
+ GL_FUNC_STATIC_2(PixelStorei,GLvoid, GLenum,GLint)
122
+ GL_FUNC_STATIC_2(PixelTransferf,GLvoid, GLenum,GLfloat)
123
+ GL_FUNC_STATIC_2(PixelTransferi,GLvoid, GLenum,GLint)
124
+ GL_FUNC_STATIC_2(PixelZoom,GLvoid, GLfloat,GLfloat)
125
+ GL_FUNC_STATIC_1(PointSize,GLvoid, GLfloat)
126
+ GL_FUNC_STATIC_2(PolygonMode,GLvoid, GLenum,GLenum)
127
+ GL_FUNC_STATIC_2(PolygonOffset,GLvoid, GLfloat,GLfloat)
128
+ GL_FUNC_STATIC_0(PopAttrib,GLvoid)
129
+ GL_FUNC_STATIC_0(PopClientAttrib,GLvoid)
130
+ GL_FUNC_STATIC_0(PopName,GLvoid)
131
+ GL_FUNC_STATIC_1(PushAttrib,GLvoid, GLbitfield)
132
+ GL_FUNC_STATIC_1(PushClientAttrib,GLvoid, GLbitfield)
133
+ GL_FUNC_STATIC_1(PushName,GLvoid, GLuint)
134
+ GL_FUNC_STATIC_2(RasterPos2d,GLvoid, GLdouble,GLdouble)
135
+ GL_FUNC_STATIC_2(RasterPos2f,GLvoid, GLfloat,GLfloat)
136
+ GL_FUNC_STATIC_2(RasterPos2i,GLvoid, GLint,GLint)
137
+ GL_FUNC_STATIC_2(RasterPos2s,GLvoid, GLshort,GLshort)
138
+ GL_FUNC_STATIC_3(RasterPos3d,GLvoid, GLdouble,GLdouble,GLdouble)
139
+ GL_FUNC_STATIC_3(RasterPos3f,GLvoid, GLfloat,GLfloat,GLfloat)
140
+ GL_FUNC_STATIC_3(RasterPos3i,GLvoid, GLint,GLint,GLint)
141
+ GL_FUNC_STATIC_3(RasterPos3s,GLvoid, GLshort,GLshort,GLshort)
142
+ GL_FUNC_STATIC_4(RasterPos4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
143
+ GL_FUNC_STATIC_4(RasterPos4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
144
+ GL_FUNC_STATIC_4(RasterPos4i,GLvoid, GLint,GLint,GLint,GLint)
145
+ GL_FUNC_STATIC_4(RasterPos4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
146
+ GL_FUNC_STATIC_1(ReadBuffer,GLvoid, GLenum)
147
+ GL_FUNC_STATIC_4(Rectd,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
148
+ GL_FUNC_STATIC_4(Rectf,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
149
+ GL_FUNC_STATIC_4(Recti,GLvoid, GLint,GLint,GLint,GLint)
150
+ GL_FUNC_STATIC_4(Rects,GLvoid, GLshort,GLshort,GLshort,GLshort)
151
+ GL_FUNC_STATIC_1(RenderMode,GLint, GLenum)
152
+ GL_FUNC_STATIC_4(Rotated,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
153
+ GL_FUNC_STATIC_4(Rotatef,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
154
+ GL_FUNC_STATIC_3(Scaled,GLvoid, GLdouble,GLdouble,GLdouble)
155
+ GL_FUNC_STATIC_3(Scalef,GLvoid, GLfloat,GLfloat,GLfloat)
156
+ GL_FUNC_STATIC_4(Scissor,GLvoid, GLint,GLint,GLint,GLint)
157
+ GL_FUNC_STATIC_1(ShadeModel,GLvoid, GLenum)
158
+ GL_FUNC_STATIC_3(StencilFunc,GLvoid, GLenum,GLint,GLuint)
159
+ GL_FUNC_STATIC_1(StencilMask,GLvoid, GLuint)
160
+ GL_FUNC_STATIC_3(StencilOp,GLvoid, GLenum,GLenum,GLenum)
161
+ GL_FUNC_STATIC_1(TexCoord1d,GLvoid, GLdouble)
162
+ GL_FUNC_STATIC_1(TexCoord1f,GLvoid, GLfloat)
163
+ GL_FUNC_STATIC_1(TexCoord1i,GLvoid, GLint)
164
+ GL_FUNC_STATIC_1(TexCoord1s,GLvoid, GLshort)
165
+ GL_FUNC_STATIC_2(TexCoord2d,GLvoid, GLdouble,GLdouble)
166
+ GL_FUNC_STATIC_2(TexCoord2f,GLvoid, GLfloat,GLfloat)
167
+ GL_FUNC_STATIC_2(TexCoord2i,GLvoid, GLint,GLint)
168
+ GL_FUNC_STATIC_2(TexCoord2s,GLvoid, GLshort,GLshort)
169
+ GL_FUNC_STATIC_3(TexCoord3d,GLvoid, GLdouble,GLdouble,GLdouble)
170
+ GL_FUNC_STATIC_3(TexCoord3f,GLvoid, GLfloat,GLfloat,GLfloat)
171
+ GL_FUNC_STATIC_3(TexCoord3i,GLvoid, GLint,GLint,GLint)
172
+ GL_FUNC_STATIC_3(TexCoord3s,GLvoid, GLshort,GLshort,GLshort)
173
+ GL_FUNC_STATIC_4(TexCoord4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
174
+ GL_FUNC_STATIC_4(TexCoord4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
175
+ GL_FUNC_STATIC_4(TexCoord4i,GLvoid, GLint,GLint,GLint,GLint)
176
+ GL_FUNC_STATIC_4(TexCoord4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
177
+ GL_FUNC_STATIC_3(TexEnvf,GLvoid, GLenum,GLenum,GLfloat)
178
+ GL_FUNC_STATIC_3(TexEnvi,GLvoid, GLenum,GLenum,GLint)
179
+ GL_FUNC_STATIC_3(TexGend,GLvoid, GLenum,GLenum,GLdouble)
180
+ GL_FUNC_STATIC_3(TexGenf,GLvoid, GLenum,GLenum,GLfloat)
181
+ GL_FUNC_STATIC_3(TexGeni,GLvoid, GLenum,GLenum,GLint)
182
+ GL_FUNC_STATIC_3(TexParameterf,GLvoid, GLenum,GLenum,GLfloat)
183
+ GL_FUNC_STATIC_3(TexParameteri,GLvoid, GLenum,GLenum,GLint)
184
+ GL_FUNC_STATIC_3(Translated,GLvoid, GLdouble,GLdouble,GLdouble)
185
+ GL_FUNC_STATIC_3(Translatef,GLvoid, GLfloat,GLfloat,GLfloat)
186
+ GL_FUNC_STATIC_2(Vertex2d,GLvoid, GLdouble,GLdouble)
187
+ GL_FUNC_STATIC_2(Vertex2f,GLvoid, GLfloat,GLfloat)
188
+ GL_FUNC_STATIC_2(Vertex2i,GLvoid, GLint,GLint)
189
+ GL_FUNC_STATIC_2(Vertex2s,GLvoid, GLshort,GLshort)
190
+ GL_FUNC_STATIC_3(Vertex3d,GLvoid, GLdouble,GLdouble,GLdouble)
191
+ GL_FUNC_STATIC_3(Vertex3f,GLvoid, GLfloat,GLfloat,GLfloat)
192
+ GL_FUNC_STATIC_3(Vertex3i,GLvoid, GLint,GLint,GLint)
193
+ GL_FUNC_STATIC_3(Vertex3s,GLvoid, GLshort,GLshort,GLshort)
194
+ GL_FUNC_STATIC_4(Vertex4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
195
+ GL_FUNC_STATIC_4(Vertex4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
196
+ GL_FUNC_STATIC_4(Vertex4i,GLvoid, GLint,GLint,GLint,GLint)
197
+ GL_FUNC_STATIC_4(Vertex4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
198
+ GL_FUNC_STATIC_4(Viewport,GLvoid, GLuint,GLuint,GLuint,GLuint)
199
+
200
+ struct gl_endisable_args {
201
+ VALUE obj;
202
+ VALUE caps;
203
+ };
204
+
205
+ static VALUE
206
+ gl_Enable1(struct gl_endisable_args *args)
207
+ {
208
+ long i;
209
+ VALUE obj = args->obj;
210
+ DECL_GL_FUNC_PTR(void,glEnable,(GLenum cap));
211
+
212
+ LOAD_GL_FUNC(glEnable, NULL);
213
+ for (i = 0; i < RARRAY_LEN(args->caps); i++) {
214
+ fptr_glEnable(CONV_GLenum(rb_ary_entry(args->caps, i)));
215
+
216
+ CHECK_GLERROR_FROM("glEnable");
217
+ }
218
+
219
+ return Qnil;
220
+ }
221
+
222
+ static VALUE
223
+ gl_Enable0(struct gl_endisable_args *args)
224
+ {
225
+ gl_Enable1(args);
226
+
227
+ if (rb_block_given_p())
228
+ rb_yield(Qundef);
229
+
230
+ return Qnil;
231
+ }
232
+
233
+ static VALUE
234
+ gl_Disable1(struct gl_endisable_args *args)
235
+ {
236
+ long i;
237
+ VALUE obj = args->obj;
238
+ DECL_GL_FUNC_PTR(void,glDisable,(GLenum cap));
239
+
240
+ LOAD_GL_FUNC(glDisable, NULL);
241
+ for (i = 0; i < RARRAY_LEN(args->caps); i++) {
242
+ fptr_glDisable(CONV_GLenum(rb_ary_entry(args->caps, i)));
243
+
244
+ CHECK_GLERROR_FROM("glDisable");
245
+ }
246
+
247
+ return Qnil;
248
+ }
249
+
250
+ static VALUE
251
+ gl_Disable0(struct gl_endisable_args *args)
252
+ {
253
+ gl_Disable1(args);
254
+
255
+ if (rb_block_given_p())
256
+ rb_yield(Qundef);
257
+
258
+ return Qnil;
259
+ }
260
+
261
+ static VALUE
262
+ gl_Enable(int argc, VALUE *argv, VALUE obj)
263
+ {
264
+ int i;
265
+ VALUE caps, rev;
266
+
267
+ rb_scan_args(argc, argv, "1*", NULL, NULL);
268
+
269
+ caps = rb_ary_new2(argc);
270
+
271
+ for (i = 0; i < argc; i++)
272
+ rb_ary_push(caps, argv[i]);
273
+
274
+ rev = rb_ary_reverse(caps);
275
+
276
+ if (rb_block_given_p()){
277
+ struct gl_endisable_args enargs = { obj, caps };
278
+ struct gl_endisable_args disargs = { obj, rev };
279
+ return rb_ensure(gl_Enable0, (VALUE)&enargs, gl_Disable1, (VALUE)&disargs);
280
+ } else {
281
+ struct gl_endisable_args args = { obj, caps };
282
+ gl_Enable0(&args);
283
+ }
284
+
285
+ return Qnil;
286
+ }
287
+
288
+ static VALUE
289
+ gl_Disable(int argc, VALUE *argv, VALUE obj)
290
+ {
291
+ int i;
292
+ VALUE caps, rev;
293
+
294
+ rb_scan_args(argc, argv, "1*", NULL, NULL);
295
+
296
+ caps = rb_ary_new2(argc);
297
+
298
+ for (i = 0; i < argc; i++)
299
+ rb_ary_push(caps, argv[i]);
300
+
301
+ rev = rb_ary_reverse(caps);
302
+
303
+ if (rb_block_given_p()){
304
+ struct gl_endisable_args disargs = { obj, caps };
305
+ struct gl_endisable_args enargs = { obj, rev };
306
+ return rb_ensure(gl_Disable0, (VALUE)&disargs, gl_Enable1, (VALUE)&enargs);
307
+ } else {
308
+ struct gl_endisable_args args = { obj, caps };
309
+ gl_Disable0(&args);
310
+ }
311
+
312
+ return Qnil;
313
+ }
314
+
315
+ struct gl_client_state_args {
316
+ VALUE obj;
317
+ VALUE ary;
318
+ };
319
+
320
+ static VALUE
321
+ gl_EnableClientState1(struct gl_client_state_args *args)
322
+ {
323
+ long i;
324
+ VALUE obj = args->obj;
325
+ DECL_GL_FUNC_PTR(void,glEnableClientState,(GLenum cap));
326
+
327
+ LOAD_GL_FUNC(glEnableClientState, NULL);
328
+ for (i = 0; i < RARRAY_LEN(args->ary); i++) {
329
+ fptr_glEnableClientState(CONV_GLenum(rb_ary_entry(args->ary, i)));
330
+
331
+ CHECK_GLERROR_FROM("glEnableClientState");
332
+ }
333
+
334
+ return Qnil;
335
+ }
336
+
337
+ static VALUE
338
+ gl_EnableClientState0(struct gl_client_state_args *args)
339
+ {
340
+ gl_EnableClientState1(args);
341
+
342
+ if (rb_block_given_p())
343
+ rb_yield(Qundef);
344
+
345
+ return Qnil;
346
+ }
347
+
348
+ static VALUE
349
+ gl_DisableClientState1(struct gl_client_state_args *args)
350
+ {
351
+ long i;
352
+ VALUE obj = args->obj;
353
+ DECL_GL_FUNC_PTR(void,glDisableClientState,(GLenum cap));
354
+
355
+ LOAD_GL_FUNC(glDisableClientState, NULL);
356
+ for (i = 0; i < RARRAY_LEN(args->ary); i++) {
357
+ fptr_glDisableClientState(CONV_GLenum(rb_ary_entry(args->ary, i)));
358
+
359
+ CHECK_GLERROR_FROM("glDisableClientState");
360
+ }
361
+
362
+ return Qnil;
363
+ }
364
+
365
+ static VALUE
366
+ gl_DisableClientState0(struct gl_client_state_args *args)
367
+ {
368
+ gl_DisableClientState1(args);
369
+
370
+ if (rb_block_given_p())
371
+ rb_yield(Qundef);
372
+
373
+ return Qnil;
374
+ }
375
+
376
+ static VALUE
377
+ gl_EnableClientState(int argc, VALUE *argv, VALUE obj)
378
+ {
379
+ int i;
380
+ VALUE ary, rev;
381
+
382
+ rb_scan_args(argc, argv, "1*", NULL, NULL);
383
+
384
+ ary = rb_ary_new2(argc);
385
+
386
+ for (i = 0; i < argc; i++)
387
+ rb_ary_push(ary, argv[i]);
388
+
389
+ rev = rb_ary_reverse(ary);
390
+
391
+ if (rb_block_given_p()){
392
+ struct gl_client_state_args enargs = { obj, ary };
393
+ struct gl_client_state_args disargs = { obj, rev };
394
+ return rb_ensure(gl_EnableClientState0, (VALUE)&enargs, gl_DisableClientState1, (VALUE)&disargs);
395
+ } else {
396
+ struct gl_client_state_args args = { obj, ary };
397
+ gl_EnableClientState0(&args);
398
+ }
399
+
400
+ return Qnil;
401
+ }
402
+
403
+ static VALUE
404
+ gl_DisableClientState(int argc, VALUE *argv, VALUE obj)
405
+ {
406
+ int i;
407
+ VALUE ary, rev;
408
+
409
+ rb_scan_args(argc, argv, "1*", NULL, NULL);
410
+
411
+ ary = rb_ary_new2(argc);
412
+
413
+ for (i = 0; i < argc; i++)
414
+ rb_ary_push(ary, argv[i]);
415
+
416
+ rev = rb_ary_reverse(ary);
417
+
418
+ if (rb_block_given_p()){
419
+ struct gl_client_state_args disargs = { obj, ary };
420
+ struct gl_client_state_args enargs = { obj, rev };
421
+ return rb_ensure(gl_DisableClientState0, (VALUE)&disargs, gl_EnableClientState1, (VALUE)&enargs);
422
+ } else {
423
+ struct gl_client_state_args args = { obj, ary };
424
+ gl_DisableClientState0(&args);
425
+ }
426
+
427
+ return Qnil;
428
+ }
429
+
430
+ struct gl_begin0_args {
431
+ VALUE obj;
432
+ GLenum mode;
433
+ };
434
+
435
+ static VALUE
436
+ gl_Begin0(struct gl_begin0_args *args)
437
+ {
438
+ VALUE obj = args->obj;
439
+ DECL_GL_FUNC_PTR(void,glBegin,(GLenum mode));
440
+
441
+ LOAD_GL_FUNC(glBegin, NULL);
442
+ fptr_glBegin(args->mode);
443
+
444
+ if (rb_block_given_p())
445
+ rb_yield(Qundef);
446
+
447
+ return Qnil;
448
+ }
449
+
450
+ static VALUE
451
+ gl_End(VALUE obj)
452
+ {
453
+ DECL_GL_FUNC_PTR(void,glEnd,(void));
454
+
455
+ LOAD_GL_FUNC(glEnd, NULL);
456
+ SET_GLIMPL_VARIABLE(inside_begin_end, Qfalse);
457
+
458
+ fptr_glEnd();
459
+
460
+ CHECK_GLERROR_FROM("glEnd");
461
+
462
+ return Qnil;
463
+ }
464
+
465
+ static VALUE
466
+ gl_Begin(VALUE obj, VALUE mode)
467
+ {
468
+ struct gl_begin0_args args = { obj, CONV_GLenum(mode) };
469
+
470
+ SET_GLIMPL_VARIABLE(inside_begin_end, Qtrue);
471
+
472
+ if (rb_block_given_p())
473
+ return rb_ensure(gl_Begin0, (VALUE)&args, gl_End, obj);
474
+ else
475
+ gl_Begin0(&args);
476
+
477
+ return Qnil;
478
+ }
479
+
480
+ static VALUE
481
+ gl_PopMatrix(VALUE obj)
482
+ {
483
+ DECL_GL_FUNC_PTR(void,glPopMatrix,(void));
484
+
485
+ LOAD_GL_FUNC(glPopMatrix, NULL);
486
+ fptr_glPopMatrix();
487
+
488
+ CHECK_GLERROR_FROM("glPopMatrix");
489
+
490
+ return Qnil;
491
+ }
492
+
493
+ static VALUE
494
+ gl_PushMatrix0(VALUE obj)
495
+ {
496
+ DECL_GL_FUNC_PTR(void,glPushMatrix,(void));
497
+
498
+ LOAD_GL_FUNC(glPushMatrix, NULL);
499
+ fptr_glPushMatrix();
500
+
501
+ if (rb_block_given_p())
502
+ rb_yield(Qnil);
503
+
504
+ return Qnil;
505
+ }
506
+
507
+ static VALUE
508
+ gl_PushMatrix(VALUE obj)
509
+ {
510
+ if (rb_block_given_p())
511
+ return rb_ensure(gl_PushMatrix0, obj, gl_PopMatrix, obj);
512
+ else {
513
+ DECL_GL_FUNC_PTR(void,glPushMatrix,(void));
514
+ LOAD_GL_FUNC(glPushMatrix, NULL);
515
+ fptr_glPushMatrix();
516
+ }
517
+
518
+ return Qnil;
519
+ }
520
+
521
+ struct gl_list_args {
522
+ VALUE obj;
523
+ VALUE list;
524
+ VALUE mode;
525
+ };
526
+
527
+ static VALUE
528
+ gl_NewList0(struct gl_list_args *args)
529
+ {
530
+ GLuint list;
531
+ GLenum mode;
532
+ VALUE obj = args->obj;
533
+ DECL_GL_FUNC_PTR(void,glNewList,(GLuint list, GLenum mode));
534
+
535
+ LOAD_GL_FUNC(glNewList, NULL);
536
+ list = (GLuint)NUM2UINT(args->list);
537
+ mode = RUBY2GLENUM(args->mode);
538
+
539
+ fptr_glNewList(list, mode);
540
+
541
+ if (rb_block_given_p())
542
+ rb_yield(Qundef);
543
+
544
+ return Qnil;
545
+ }
546
+
547
+ static VALUE
548
+ gl_EndList(VALUE obj)
549
+ {
550
+ DECL_GL_FUNC_PTR(void,glEndList,(void));
551
+
552
+ LOAD_GL_FUNC(glEndList, NULL);
553
+ fptr_glEndList();
554
+
555
+ return Qnil;
556
+ }
557
+
558
+ static VALUE
559
+ gl_NewList(VALUE obj, VALUE list, VALUE mode)
560
+ {
561
+ struct gl_list_args args = { obj, list, mode };
562
+
563
+ if (rb_block_given_p())
564
+ return rb_ensure(gl_NewList0, (VALUE)&args, gl_EndList, obj);
565
+ else
566
+ gl_NewList0(&args);
567
+
568
+ return Qnil;
569
+ }
570
+
571
+ static VALUE
572
+ gl_CallLists(obj,arg1,arg2)
573
+ VALUE obj,arg1,arg2;
574
+ {
575
+ GLsizei n;
576
+ GLenum type;
577
+ VALUE lists;
578
+ DECL_GL_FUNC_PTR(GLvoid,glCallLists,(GLsizei n, GLenum type, const GLvoid *lists));
579
+
580
+ LOAD_GL_FUNC(glCallLists, NULL);
581
+ type = CONV_GLenum(arg1);
582
+ lists = pack_array_or_pass_string(type,arg2);
583
+ n = (GLsizei)RSTRING_LENINT(lists) / gltype_glformat_unit_size(type,1);
584
+ fptr_glCallLists(n, type, RSTRING_PTR(lists));
585
+ CHECK_GLERROR_FROM("glCallLists");
586
+ return Qnil;
587
+ }
588
+
589
+ static VALUE
590
+ gl_Bitmap(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
591
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
592
+ {
593
+ GLsizei width;
594
+ GLsizei height;
595
+ GLfloat xorig;
596
+ GLfloat yorig;
597
+ GLfloat xmove;
598
+ GLfloat ymove;
599
+ DECL_GL_FUNC_PTR(void,glBitmap,(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap));
600
+
601
+ LOAD_GL_FUNC(glBitmap, NULL);
602
+ width = (GLsizei)NUM2UINT(arg1);
603
+ height = (GLsizei)NUM2UINT(arg2);
604
+ xorig = (GLfloat)NUM2DBL(arg3);
605
+ yorig = (GLfloat)NUM2DBL(arg4);
606
+ xmove = (GLfloat)NUM2DBL(arg5);
607
+ ymove = (GLfloat)NUM2DBL(arg6);
608
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
609
+ fptr_glBitmap(width, height, xorig, yorig, xmove, ymove, (GLubyte *)NUM2SIZET(arg7));
610
+ } else {
611
+ VALUE data;
612
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
613
+
614
+ if ((RSTRING_LEN(data)*8) < (width * height))
615
+ rb_raise(rb_eArgError, "string length:%li", RSTRING_LEN(data));
616
+
617
+ fptr_glBitmap(width, height, xorig, yorig, xmove, ymove, (const GLubyte *)RSTRING_PTR(data));
618
+ }
619
+ CHECK_GLERROR_FROM("glBitmap");
620
+ return Qnil;
621
+ }
622
+
623
+ static VALUE
624
+ gl_EdgeFlagv(obj,arg1)
625
+ VALUE obj,arg1;
626
+ {
627
+ GLboolean flag[1] = { GL_FALSE };
628
+ DECL_GL_FUNC_PTR(void,glEdgeFlagv,(const GLboolean *flag));
629
+
630
+ LOAD_GL_FUNC(glEdgeFlagv, NULL);
631
+ Check_Type(arg1,T_ARRAY);
632
+ ary2cboolean(arg1,flag,1);
633
+ fptr_glEdgeFlagv(flag);
634
+ CHECK_GLERROR_FROM("glEdgeFlagv");
635
+ return Qnil;
636
+ }
637
+
638
+ static VALUE
639
+ gl_Indexdv(obj,arg1)
640
+ VALUE obj,arg1;
641
+ {
642
+ GLdouble c[1] = {0.0};
643
+ DECL_GL_FUNC_PTR(void,glIndexdv,(const GLdouble *c));
644
+
645
+ LOAD_GL_FUNC(glIndexdv, NULL);
646
+ Check_Type(arg1,T_ARRAY);
647
+ ary2cdbl(arg1,c,1);
648
+ fptr_glIndexdv(c);
649
+ CHECK_GLERROR_FROM("glIndexdv");
650
+ return Qnil;
651
+ }
652
+
653
+ static VALUE
654
+ gl_Indexfv(obj,arg1)
655
+ VALUE obj,arg1;
656
+ {
657
+ GLfloat c[1] = { (GLfloat)0.0 };
658
+ DECL_GL_FUNC_PTR(void,glIndexfv,(const GLfloat *c));
659
+
660
+ LOAD_GL_FUNC(glIndexfv, NULL);
661
+ Check_Type(arg1,T_ARRAY);
662
+ ary2cflt(arg1,c,1);
663
+ fptr_glIndexfv(c);
664
+ CHECK_GLERROR_FROM("glIndexfv");
665
+ return Qnil;
666
+ }
667
+
668
+ static VALUE
669
+ gl_Indexiv(obj,arg1)
670
+ VALUE obj,arg1;
671
+ {
672
+ GLint c[1] = {0};
673
+ DECL_GL_FUNC_PTR(void,glIndexiv,(const GLint *c));
674
+
675
+ LOAD_GL_FUNC(glIndexiv, NULL);
676
+ Check_Type(arg1,T_ARRAY);
677
+ ary2cint(arg1,c,1);
678
+ fptr_glIndexiv(c);
679
+ CHECK_GLERROR_FROM("glIndexiv");
680
+ return Qnil;
681
+ }
682
+
683
+ static VALUE
684
+ gl_Indexsv(obj,arg1)
685
+ VALUE obj,arg1;
686
+ {
687
+ GLshort c[1] = {0};
688
+ DECL_GL_FUNC_PTR(void,glIndexsv,(const GLshort *c));
689
+
690
+ LOAD_GL_FUNC(glIndexsv, NULL);
691
+ Check_Type(arg1,T_ARRAY);
692
+ ary2cshort(arg1,c,1);
693
+ fptr_glIndexsv(c);
694
+ CHECK_GLERROR_FROM("glIndexsv");
695
+ return Qnil;
696
+ }
697
+
698
+ static VALUE
699
+ gl_ClipPlane(obj,arg1,arg2)
700
+ VALUE obj,arg1,arg2;
701
+ {
702
+ GLenum plane;
703
+ GLdouble equation[4];
704
+ DECL_GL_FUNC_PTR(void,glClipPlane,(GLenum plane, const GLdouble *equation));
705
+
706
+ LOAD_GL_FUNC(glClipPlane, NULL);
707
+ plane = (GLenum)NUM2INT(arg1);
708
+ Check_Type(arg2,T_ARRAY);
709
+ ary2cdbl(arg2, equation, 4);
710
+ fptr_glClipPlane(plane,equation);
711
+ CHECK_GLERROR_FROM("glClipPlane");
712
+ return Qnil;
713
+ }
714
+
715
+ static VALUE
716
+ gl_Fogfv(obj,arg1,arg2)
717
+ VALUE obj,arg1,arg2;
718
+ {
719
+ GLenum pname;
720
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
721
+ DECL_GL_FUNC_PTR(void,glFogfv,(GLenum pname, const GLfloat *params));
722
+
723
+ LOAD_GL_FUNC(glFogfv, NULL);
724
+ pname = (GLenum)NUM2INT(arg1);
725
+ Check_Type(arg2,T_ARRAY);
726
+ ary2cflt(arg2,params,4);
727
+ fptr_glFogfv(pname,params);
728
+ CHECK_GLERROR_FROM("glFogfv");
729
+ return Qnil;
730
+ }
731
+
732
+ static VALUE
733
+ gl_Fogiv(obj,arg1,arg2)
734
+ VALUE obj,arg1,arg2;
735
+ {
736
+ GLenum pname;
737
+ GLint params[4] = {0,0,0,0};
738
+ DECL_GL_FUNC_PTR(void,glFogiv,(GLenum pname, const GLint *params));
739
+
740
+ LOAD_GL_FUNC(glFogiv, NULL);
741
+ pname = (GLenum)NUM2INT(arg1);
742
+ Check_Type(arg2,T_ARRAY);
743
+ ary2cint(arg2,params,4);
744
+ fptr_glFogiv(pname,params);
745
+ CHECK_GLERROR_FROM("glFogiv");
746
+ return Qnil;
747
+ }
748
+
749
+ static VALUE
750
+ gl_Lightfv(obj,arg1,arg2,arg3)
751
+ VALUE obj,arg1,arg2,arg3;
752
+ {
753
+ GLenum light;
754
+ GLenum pname;
755
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
756
+ DECL_GL_FUNC_PTR(void,glLightfv,(GLenum light, GLenum pname, const GLfloat *params));
757
+
758
+ LOAD_GL_FUNC(glLightfv, NULL);
759
+ light = (GLenum)NUM2INT(arg1);
760
+ pname = (GLenum)NUM2INT(arg2);
761
+ Check_Type(arg3,T_ARRAY);
762
+ ary2cflt(arg3,params,4);
763
+ fptr_glLightfv(light,pname,params);
764
+ CHECK_GLERROR_FROM("glLightfv");
765
+ return Qnil;
766
+ }
767
+
768
+ static VALUE
769
+ gl_Lightiv(obj,arg1,arg2,arg3)
770
+ VALUE obj,arg1,arg2,arg3;
771
+ {
772
+ GLenum light;
773
+ GLenum pname;
774
+ GLint params[4]={0,0,0,0};
775
+ DECL_GL_FUNC_PTR(void,glLightiv,(GLenum light, GLenum pname, const GLint *params));
776
+
777
+ LOAD_GL_FUNC(glLightiv, NULL);
778
+ light = (GLenum)NUM2INT(arg1);
779
+ pname = (GLenum)NUM2INT(arg2);
780
+ Check_Type(arg3,T_ARRAY);
781
+ ary2cint(arg3,params,4);
782
+ fptr_glLightiv(light,pname,params);
783
+ CHECK_GLERROR_FROM("glLightiv");
784
+ return Qnil;
785
+ }
786
+
787
+ static VALUE
788
+ gl_LightModelfv(obj,arg1,arg2)
789
+ VALUE obj,arg1,arg2;
790
+ {
791
+ GLenum pname;
792
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
793
+ DECL_GL_FUNC_PTR(void,glLightModelfv,(GLenum pname, const GLfloat *params));
794
+
795
+ LOAD_GL_FUNC(glLightModelfv, NULL);
796
+ pname = (GLenum)NUM2INT(arg1);
797
+ Check_Type(arg2,T_ARRAY);
798
+ ary2cflt(arg2,params,4);
799
+ fptr_glLightModelfv(pname,params);
800
+ CHECK_GLERROR_FROM("glLightModelfv");
801
+ return Qnil;
802
+ }
803
+
804
+ static VALUE
805
+ gl_LightModeliv(obj,arg1,arg2)
806
+ VALUE obj,arg1,arg2;
807
+ {
808
+ GLenum pname;
809
+ GLint params[4] = {0,0,0,0};
810
+ DECL_GL_FUNC_PTR(void,glLightModeliv,(GLenum pname, const GLint *params));
811
+
812
+ LOAD_GL_FUNC(glLightModeliv, NULL);
813
+ pname = (GLenum)NUM2INT(arg1);
814
+ Check_Type(arg2,T_ARRAY);
815
+ ary2cint(arg2,params,4);
816
+ fptr_glLightModeliv(pname,params);
817
+ CHECK_GLERROR_FROM("glLightModeliv");
818
+ return Qnil;
819
+ }
820
+
821
+
822
+ static VALUE
823
+ gl_Materialfv(obj,arg1,arg2,arg3)
824
+ VALUE obj,arg1,arg2,arg3;
825
+ {
826
+ GLenum face;
827
+ GLenum pname;
828
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
829
+ DECL_GL_FUNC_PTR(void,glMaterialfv,(GLenum face, GLenum pname, const GLfloat *params));
830
+
831
+ LOAD_GL_FUNC(glMaterialfv, NULL);
832
+ face = (GLenum)NUM2INT(arg1);
833
+ pname = (GLenum)NUM2INT(arg2);
834
+ Check_Type(arg3,T_ARRAY);
835
+ ary2cflt(arg3,params,4);
836
+ fptr_glMaterialfv(face,pname,params);
837
+ CHECK_GLERROR_FROM("glMaterialfv");
838
+ return Qnil;
839
+ }
840
+
841
+ static VALUE
842
+ gl_Materialiv(obj,arg1,arg2,arg3)
843
+ VALUE obj,arg1,arg2,arg3;
844
+ {
845
+ GLenum face;
846
+ GLenum pname;
847
+ GLint params[4] = {0,0,0,0};
848
+ DECL_GL_FUNC_PTR(void,glMaterialiv,(GLenum face, GLenum pname, const GLint *params));
849
+
850
+ LOAD_GL_FUNC(glMaterialiv, NULL);
851
+ face = (GLenum)NUM2INT(arg1);
852
+ pname = (GLenum)NUM2INT(arg2);
853
+ Check_Type(arg3,T_ARRAY);
854
+ ary2cint(arg3,params,4);
855
+ fptr_glMaterialiv(face,pname,params);
856
+ CHECK_GLERROR_FROM("glMaterialiv");
857
+ return Qnil;
858
+ }
859
+
860
+ static VALUE
861
+ gl_PolygonStipple(obj,arg1)
862
+ VALUE obj,arg1;
863
+ {
864
+ DECL_GL_FUNC_PTR(void,glPolygonStipple,(const GLubyte *mask));
865
+
866
+ LOAD_GL_FUNC(glPolygonStipple, NULL);
867
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
868
+ fptr_glPolygonStipple((GLubyte *)NUM2SIZET(arg1));
869
+ } else {
870
+ VALUE data;
871
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg1);
872
+ if (RSTRING_LEN(data) < 128)
873
+ rb_raise(rb_eArgError, "string length:%li", RSTRING_LEN(data));
874
+
875
+ fptr_glPolygonStipple((GLubyte *)RSTRING_PTR(data));
876
+ }
877
+ CHECK_GLERROR_FROM("glPolygonStipple");
878
+ return Qnil;
879
+ }
880
+
881
+
882
+ static VALUE
883
+ gl_TexParameterfv(obj,arg1,arg2,arg3)
884
+ VALUE obj,arg1,arg2,arg3;
885
+ {
886
+ GLenum target;
887
+ GLenum pname;
888
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
889
+ DECL_GL_FUNC_PTR(void,glTexParameterfv,(GLenum target, GLenum pname, const GLfloat *params));
890
+
891
+ LOAD_GL_FUNC(glTexParameterfv, NULL);
892
+ target = (GLenum)NUM2INT(arg1);
893
+ pname = (GLenum)NUM2INT(arg2);
894
+ Check_Type(arg3,T_ARRAY);
895
+ ary2cflt(arg3,params,4);
896
+ fptr_glTexParameterfv(target,pname,params);
897
+ CHECK_GLERROR_FROM("glTexParameterfv");
898
+ return Qnil;
899
+ }
900
+
901
+ static VALUE
902
+ gl_TexParameteriv(obj,arg1,arg2,arg3)
903
+ VALUE obj,arg1,arg2,arg3;
904
+ {
905
+ GLenum target;
906
+ GLenum pname;
907
+ GLint params[4] = {0,0,0,0};
908
+ DECL_GL_FUNC_PTR(void,glTexParameteriv,(GLenum target, GLenum pname, const GLint *params));
909
+
910
+ LOAD_GL_FUNC(glTexParameteriv, NULL);
911
+ target = (GLenum)NUM2INT(arg1);
912
+ pname = (GLenum)NUM2INT(arg2);
913
+ Check_Type(arg3,T_ARRAY);
914
+ ary2cint(arg3,params,4);
915
+ fptr_glTexParameteriv(target,pname,params);
916
+ CHECK_GLERROR_FROM("glTexParameteriv");
917
+ return Qnil;
918
+ }
919
+
920
+ static VALUE
921
+ gl_TexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
922
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
923
+ {
924
+ GLenum target;
925
+ GLint level;
926
+ GLint components;
927
+ GLsizei width;
928
+ GLint border;
929
+ GLenum format;
930
+ GLenum type;
931
+ const char *pixels;
932
+ DECL_GL_FUNC_PTR(void,glTexImage1D,(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
933
+
934
+ LOAD_GL_FUNC(glTexImage1D, NULL);
935
+ target = (GLenum)NUM2INT(arg1);
936
+ level = (GLint)NUM2INT(arg2);
937
+ components = (GLint)NUM2INT(arg3);
938
+ width = (GLsizei)NUM2UINT(arg4);
939
+ border = (GLint)NUM2INT(arg5);
940
+ format = (GLenum)NUM2INT(arg6);
941
+ type = (GLenum)NUM2INT(arg7);
942
+
943
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
944
+ fptr_glTexImage1D(target,level,components,width,border,format,type,(GLvoid *)NUM2SIZET(arg8));
945
+ CHECK_GLERROR_FROM("glTexImage1D");
946
+ return Qnil;
947
+ }
948
+
949
+ if (target == GL_PROXY_TEXTURE_1D || NIL_P(arg8)) { /* proxy texture, no data read */
950
+ pixels = NULL;
951
+ } else {
952
+ VALUE data;
953
+ data = pack_array_or_pass_string(type,arg8);
954
+ CheckDataSize(type,format,width,data);
955
+ pixels = RSTRING_PTR(data);
956
+ }
957
+ fptr_glTexImage1D(target,level,components,width,border,format,type,pixels);
958
+ CHECK_GLERROR_FROM("glTexImage1D");
959
+ return Qnil;
960
+ }
961
+
962
+ static VALUE
963
+ gl_TexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
964
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
965
+ {
966
+ GLenum target;
967
+ GLint level;
968
+ GLint components;
969
+ GLsizei width;
970
+ GLsizei height;
971
+ GLint border;
972
+ GLenum format;
973
+ GLenum type;
974
+ const char *pixels;
975
+ DECL_GL_FUNC_PTR(void,glTexImage2D,(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
976
+
977
+ LOAD_GL_FUNC(glTexImage2D, NULL);
978
+ target = (GLenum)NUM2INT(arg1);
979
+ level = (GLint)NUM2INT(arg2);
980
+ components = (GLint)NUM2INT(arg3);
981
+ width = (GLsizei)NUM2UINT(arg4);
982
+ height = (GLsizei)NUM2UINT(arg5);
983
+ border = (GLint)NUM2INT(arg6);
984
+ format = (GLenum)NUM2INT(arg7);
985
+ type = (GLenum)NUM2INT(arg8);
986
+
987
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
988
+ fptr_glTexImage2D(target,level,components,width,height,border,format,type,(GLvoid *)NUM2SIZET(arg9));
989
+ CHECK_GLERROR_FROM("glTexImage2D");
990
+ return Qnil;
991
+ }
992
+
993
+ if (target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_1D_ARRAY_EXT || target == GL_PROXY_TEXTURE_CUBE_MAP || NIL_P(arg9)) { /* proxy texture, no data read */
994
+ pixels = NULL;
995
+ } else {
996
+ VALUE data;
997
+ data = pack_array_or_pass_string(type,arg9);
998
+ CheckDataSize(type,format,width*height,data);
999
+ pixels = RSTRING_PTR(data);
1000
+ }
1001
+ fptr_glTexImage2D(target,level,components,width,height,border,format,type,pixels);
1002
+ CHECK_GLERROR_FROM("glTexImage2D");
1003
+ return Qnil;
1004
+ }
1005
+
1006
+ static VALUE
1007
+ gl_TexEnvfv(obj,arg1,arg2,arg3)
1008
+ VALUE obj,arg1,arg2,arg3;
1009
+ {
1010
+ GLenum target;
1011
+ GLenum pname;
1012
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1013
+ DECL_GL_FUNC_PTR(void,glTexEnvfv,(GLenum target, GLenum pname, const GLfloat *params));
1014
+
1015
+ LOAD_GL_FUNC(glTexEnvfv, NULL);
1016
+ target = (GLenum)NUM2INT(arg1);
1017
+ pname = (GLenum)NUM2INT(arg2);
1018
+ Check_Type(arg3,T_ARRAY);
1019
+ ary2cflt(arg3,params,4);
1020
+ fptr_glTexEnvfv(target,pname,params);
1021
+ CHECK_GLERROR_FROM("glTexEnvfv");
1022
+ return Qnil;
1023
+ }
1024
+
1025
+ static VALUE
1026
+ gl_TexEnviv(obj,arg1,arg2,arg3)
1027
+ VALUE obj,arg1,arg2,arg3;
1028
+ {
1029
+ GLenum target;
1030
+ GLenum pname;
1031
+ GLint params[4] = {0,0,0,0};
1032
+ DECL_GL_FUNC_PTR(void,glTexEnviv,(GLenum target, GLenum pname, const GLint *params));
1033
+
1034
+ LOAD_GL_FUNC(glTexEnviv, NULL);
1035
+ target = (GLenum)NUM2INT(arg1);
1036
+ pname = (GLenum)NUM2INT(arg2);
1037
+ Check_Type(arg3,T_ARRAY);
1038
+ ary2cint(arg3,params,4);
1039
+ fptr_glTexEnviv(target,pname,params);
1040
+ CHECK_GLERROR_FROM("glTexEnviv");
1041
+ return Qnil;
1042
+ }
1043
+
1044
+
1045
+ static VALUE
1046
+ gl_TexGendv(obj,arg1,arg2,arg3)
1047
+ VALUE obj,arg1,arg2,arg3;
1048
+ {
1049
+ GLenum coord;
1050
+ GLenum pname;
1051
+ GLdouble params[4] = {0.0,0.0,0.0,0.0};
1052
+ DECL_GL_FUNC_PTR(void,glTexGendv,(GLenum coord, GLenum pname, const GLdouble *params));
1053
+
1054
+ LOAD_GL_FUNC(glTexGendv, NULL);
1055
+ coord = (GLenum)NUM2INT(arg1);
1056
+ pname = (GLenum)NUM2INT(arg2);
1057
+ Check_Type(arg3,T_ARRAY);
1058
+ ary2cdbl(arg3,params,4);
1059
+ fptr_glTexGendv(coord,pname,params);
1060
+ CHECK_GLERROR_FROM("glTexGendv");
1061
+ return Qnil;
1062
+ }
1063
+
1064
+
1065
+ static VALUE
1066
+ gl_TexGenfv(obj,arg1,arg2,arg3)
1067
+ VALUE obj,arg1,arg2,arg3;
1068
+ {
1069
+ GLenum coord;
1070
+ GLenum pname;
1071
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1072
+ DECL_GL_FUNC_PTR(void,glTexGenfv,(GLenum coord, GLenum pname, const GLfloat *params));
1073
+
1074
+ LOAD_GL_FUNC(glTexGenfv, NULL);
1075
+ coord = (GLenum)NUM2INT(arg1);
1076
+ pname = (GLenum)NUM2INT(arg2);
1077
+ Check_Type(arg3,T_ARRAY);
1078
+ ary2cflt(arg3,params,4);
1079
+ fptr_glTexGenfv(coord,pname,params);
1080
+ CHECK_GLERROR_FROM("glTexGenfv");
1081
+ return Qnil;
1082
+ }
1083
+
1084
+
1085
+ static VALUE
1086
+ gl_TexGeniv(obj,arg1,arg2,arg3)
1087
+ VALUE obj,arg1,arg2,arg3;
1088
+ {
1089
+ GLenum coord;
1090
+ GLenum pname;
1091
+ GLint params[4] = {0,0,0,0};
1092
+ DECL_GL_FUNC_PTR(void,glTexGeniv,(GLenum coord, GLenum pname, const GLint *params));
1093
+
1094
+ LOAD_GL_FUNC(glTexGeniv, NULL);
1095
+ coord = (GLenum)NUM2INT(arg1);
1096
+ pname = (GLenum)NUM2INT(arg2);
1097
+ Check_Type(arg3,T_ARRAY);
1098
+ ary2cint(arg3,params,4);
1099
+ fptr_glTexGeniv(coord,pname,params);
1100
+ CHECK_GLERROR_FROM("glTexGeniv");
1101
+ return Qnil;
1102
+ }
1103
+ static VALUE
1104
+ gl_FeedbackBuffer(obj,arg1,arg2)
1105
+ VALUE obj,arg1,arg2;
1106
+ {
1107
+ GLsizei size;
1108
+ GLenum type;
1109
+ VALUE current_feed_buffer;
1110
+ DECL_GL_FUNC_PTR(void,glFeedbackBuffer,(GLsizei size, GLenum type, GLfloat *buffer));
1111
+
1112
+ LOAD_GL_FUNC(glFeedbackBuffer, NULL);
1113
+ size = (GLsizei)NUM2UINT(arg1);
1114
+ type = (GLenum)NUM2INT(arg2);
1115
+ current_feed_buffer = allocate_buffer_with_string(sizeof(GLfloat)*size);
1116
+ rb_str_freeze(current_feed_buffer);
1117
+ fptr_glFeedbackBuffer(size, type, (GLfloat*)RSTRING_PTR(current_feed_buffer));
1118
+ CHECK_GLERROR_FROM("glFeedbackBuffer");
1119
+ SET_GLIMPL_VARIABLE(current_feed_buffer, current_feed_buffer);
1120
+ return current_feed_buffer;
1121
+ }
1122
+
1123
+ static VALUE
1124
+ gl_SelectBuffer(obj,arg1)
1125
+ VALUE obj,arg1;
1126
+ {
1127
+ GLsizei size;
1128
+ VALUE current_sel_buffer;
1129
+ DECL_GL_FUNC_PTR(void,glSelectBuffer,(GLsizei size, GLuint *buffer));
1130
+
1131
+ LOAD_GL_FUNC(glSelectBuffer, NULL);
1132
+ size = (GLsizei)NUM2UINT(arg1);
1133
+ current_sel_buffer = allocate_buffer_with_string(sizeof(GLuint)*size);
1134
+ rb_str_freeze(current_sel_buffer);
1135
+ fptr_glSelectBuffer(size, (GLuint*)RSTRING_PTR(current_sel_buffer));
1136
+ CHECK_GLERROR_FROM("glSelectBuffer");
1137
+ SET_GLIMPL_VARIABLE(current_sel_buffer, current_sel_buffer);
1138
+ return current_sel_buffer;
1139
+ }
1140
+
1141
+
1142
+ static VALUE
1143
+ gl_Map1d(obj,arg1,arg2,arg3,arg4,arg5,arg6)
1144
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
1145
+ {
1146
+ GLenum target;
1147
+ GLdouble u1;
1148
+ GLdouble u2;
1149
+ GLint stride;
1150
+ GLint order;
1151
+ GLdouble *points;
1152
+
1153
+ VALUE work_ary;
1154
+ DECL_GL_FUNC_PTR(void,glMap1d,(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points));
1155
+
1156
+ LOAD_GL_FUNC(glMap1d, NULL);
1157
+ target = (GLenum)NUM2INT(arg1);
1158
+ u1 = (GLdouble)NUM2DBL(arg2);
1159
+ u2 = (GLdouble)NUM2DBL(arg3);
1160
+ stride = (GLint)NUM2INT(arg4);
1161
+ order = (GLint)NUM2INT(arg5);
1162
+ points = ALLOC_N(GLdouble, order*stride);
1163
+ work_ary = rb_funcall(arg6,rb_intern("flatten"),0);
1164
+ ary2cdbl(work_ary, points, order*stride);
1165
+ fptr_glMap1d(target, u1, u2, stride, order, points);
1166
+ xfree(points);
1167
+ CHECK_GLERROR_FROM("glMap1d");
1168
+ return Qnil;
1169
+ }
1170
+
1171
+ static VALUE
1172
+ gl_Map1f(obj,arg1,arg2,arg3,arg4,arg5,arg6)
1173
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
1174
+ {
1175
+ GLenum target;
1176
+ GLfloat u1;
1177
+ GLfloat u2;
1178
+ GLint stride;
1179
+ GLint order;
1180
+ GLfloat *points;
1181
+
1182
+ VALUE work_ary;
1183
+ DECL_GL_FUNC_PTR(void,glMap1f,(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points));
1184
+
1185
+ LOAD_GL_FUNC(glMap1f, NULL);
1186
+ target = (GLenum)NUM2INT(arg1);
1187
+ u1 = (GLfloat)NUM2DBL(arg2);
1188
+ u2 = (GLfloat)NUM2DBL(arg3);
1189
+ stride = (GLint)NUM2INT(arg4);
1190
+ order = (GLint)NUM2INT(arg5);
1191
+ points = ALLOC_N(GLfloat, order*stride);
1192
+ work_ary = rb_funcall(arg6,rb_intern("flatten"),0);
1193
+ ary2cflt(work_ary, points, order*stride);
1194
+ fptr_glMap1f(target, u1, u2, stride, order, points);
1195
+ xfree(points);
1196
+ CHECK_GLERROR_FROM("glMap1f");
1197
+ return Qnil;
1198
+ }
1199
+
1200
+ static VALUE
1201
+ gl_Map2d(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
1202
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
1203
+ {
1204
+ GLenum target;
1205
+ GLdouble u1;
1206
+ GLdouble u2;
1207
+ GLint ustride;
1208
+ GLint uorder;
1209
+ GLdouble v1;
1210
+ GLdouble v2;
1211
+ GLint vstride;
1212
+ GLint vorder;
1213
+ GLdouble *points;
1214
+
1215
+ VALUE work_ary;
1216
+ DECL_GL_FUNC_PTR(void,glMap2d,(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points));
1217
+
1218
+ LOAD_GL_FUNC(glMap2d, NULL);
1219
+ target = (GLenum)NUM2INT(arg1);
1220
+ u1 = (GLdouble)NUM2INT(arg2);
1221
+ u2 = (GLdouble)NUM2INT(arg3);
1222
+ ustride = (GLint)NUM2INT(arg4);
1223
+ uorder = (GLint)NUM2INT(arg5);
1224
+ v1 = (GLdouble)NUM2INT(arg6);
1225
+ v2 = (GLdouble)NUM2INT(arg7);
1226
+ vstride = (GLint)NUM2INT(arg8);
1227
+ vorder = (GLint)NUM2INT(arg9);
1228
+ points = ALLOC_N(GLdouble, MAX(ustride*uorder, vstride*vorder));
1229
+ work_ary = rb_funcall(arg10,rb_intern("flatten"),0);
1230
+ ary2cdbl(work_ary, points, MAX(ustride*uorder, vstride*vorder));
1231
+ fptr_glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
1232
+ xfree(points);
1233
+ CHECK_GLERROR_FROM("glMap2d");
1234
+ return Qnil;
1235
+ }
1236
+
1237
+ static VALUE
1238
+ gl_Map2f(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
1239
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
1240
+ {
1241
+ GLenum target;
1242
+ GLfloat u1;
1243
+ GLfloat u2;
1244
+ GLint ustride;
1245
+ GLint uorder;
1246
+ GLfloat v1;
1247
+ GLfloat v2;
1248
+ GLint vstride;
1249
+ GLint vorder;
1250
+ GLfloat *points;
1251
+
1252
+ VALUE work_ary;
1253
+ DECL_GL_FUNC_PTR(void,glMap2f,(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points));
1254
+
1255
+ LOAD_GL_FUNC(glMap2f, NULL);
1256
+ target = (GLenum)NUM2INT(arg1);
1257
+ u1 = (GLfloat)NUM2INT(arg2);
1258
+ u2 = (GLfloat)NUM2INT(arg3);
1259
+ ustride = (GLint)NUM2INT(arg4);
1260
+ uorder = (GLint)NUM2INT(arg5);
1261
+ v1 = (GLfloat)NUM2INT(arg6);
1262
+ v2 = (GLfloat)NUM2INT(arg7);
1263
+ vstride = (GLint)NUM2INT(arg8);
1264
+ vorder = (GLint)NUM2INT(arg9);
1265
+ points = ALLOC_N(GLfloat, MAX(ustride*uorder, vstride*vorder));
1266
+ work_ary = rb_funcall(arg10,rb_intern("flatten"),0);
1267
+ ary2cflt(work_ary, points, MAX(ustride*uorder, vstride*vorder));
1268
+ fptr_glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
1269
+ xfree(points);
1270
+ CHECK_GLERROR_FROM("glMap2f");
1271
+ return Qnil;
1272
+ }
1273
+
1274
+ static VALUE
1275
+ gl_EvalCoord1dv(obj,arg1)
1276
+ VALUE obj,arg1;
1277
+ {
1278
+ GLdouble params[1] = {0.0};
1279
+ DECL_GL_FUNC_PTR(void,glEvalCoord1dv,(const GLdouble *u));
1280
+
1281
+ LOAD_GL_FUNC(glEvalCoord1dv, NULL);
1282
+ Check_Type(arg1,T_ARRAY);
1283
+ ary2cdbl(arg1,params,1);
1284
+ fptr_glEvalCoord1dv(params);
1285
+ CHECK_GLERROR_FROM("glEvalCoord1dv");
1286
+ return Qnil;
1287
+ }
1288
+
1289
+ static VALUE
1290
+ gl_EvalCoord1fv(obj,arg1)
1291
+ VALUE obj,arg1;
1292
+ {
1293
+ GLfloat params[1] = {(GLfloat)0.0};
1294
+ DECL_GL_FUNC_PTR(void,glEvalCoord1fv,(const GLfloat *u));
1295
+
1296
+ LOAD_GL_FUNC(glEvalCoord1fv, NULL);
1297
+ Check_Type(arg1,T_ARRAY);
1298
+ ary2cflt(arg1,params,1);
1299
+ fptr_glEvalCoord1fv(params);
1300
+ CHECK_GLERROR_FROM("glEvalCoord1fv");
1301
+ return Qnil;
1302
+ }
1303
+
1304
+ static VALUE
1305
+ gl_EvalCoord2dv(obj,arg1)
1306
+ VALUE obj,arg1;
1307
+ {
1308
+ GLdouble params[2] = {0.0,0.0};
1309
+ DECL_GL_FUNC_PTR(void,glEvalCoord2dv,(const GLdouble *u));
1310
+
1311
+ LOAD_GL_FUNC(glEvalCoord2dv, NULL);
1312
+ Check_Type(arg1,T_ARRAY);
1313
+ ary2cdbl(arg1,params,2);
1314
+ fptr_glEvalCoord2dv(params);
1315
+ CHECK_GLERROR_FROM("glEvalCoord2fv");
1316
+ return Qnil;
1317
+ }
1318
+
1319
+ static VALUE
1320
+ gl_EvalCoord2fv(obj,arg1)
1321
+ VALUE obj,arg1;
1322
+ {
1323
+ GLfloat params[2] = {(GLfloat)0.0,(GLfloat)0.0};
1324
+ DECL_GL_FUNC_PTR(void,glEvalCoord2fv,(const GLfloat *u));
1325
+
1326
+ LOAD_GL_FUNC(glEvalCoord2fv, NULL);
1327
+ Check_Type(arg1,T_ARRAY);
1328
+ ary2cflt(arg1,params,2);
1329
+ fptr_glEvalCoord2fv(params);
1330
+ CHECK_GLERROR_FROM("glEvalCoord2fv");
1331
+ return Qnil;
1332
+ }
1333
+
1334
+
1335
+ #define GLPIXELMAP_FUNC(_type_,_vartype_,_convert_) \
1336
+ static VALUE \
1337
+ gl_PixelMap##_type_##v(argc,argv,obj) \
1338
+ int argc; \
1339
+ VALUE *argv; \
1340
+ VALUE obj; \
1341
+ { \
1342
+ GLenum map; \
1343
+ _vartype_ *values; \
1344
+ GLsizei size; \
1345
+ VALUE args[4]; \
1346
+ DECL_GL_FUNC_PTR(void,glPixelMap##_type_##v,(GLenum map, GLsizei mapsize, const _vartype_ *values)); \
1347
+ LOAD_GL_FUNC(glPixelMap##_type_##v, NULL); \
1348
+ switch(rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2])) { \
1349
+ default: \
1350
+ case 2: \
1351
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
1352
+ rb_raise(rb_eArgError, "Pixel unpack buffer bound, but offset argument missing"); \
1353
+ map = (GLenum)NUM2INT(args[0]); \
1354
+ Check_Type(args[1],T_ARRAY); \
1355
+ size = (int)RARRAY_LENINT(args[1]); \
1356
+ values = ALLOC_N(_vartype_,size); \
1357
+ _convert_(args[1],values,size); \
1358
+ fptr_glPixelMap##_type_##v(map,size,values); \
1359
+ xfree(values); \
1360
+ break; \
1361
+ case 3: \
1362
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
1363
+ rb_raise(rb_eArgError, "Pixel unpack buffer not bound"); \
1364
+ map = (GLenum)NUM2INT(args[0]); \
1365
+ size = (GLsizei)NUM2INT(args[1]); \
1366
+ fptr_glPixelMap##_type_##v(map,size,(GLvoid *)NUM2SIZET(args[2])); \
1367
+ break; \
1368
+ } \
1369
+ CHECK_GLERROR_FROM("glPixelMap" #_type_ "v"); \
1370
+ return Qnil; \
1371
+ }
1372
+
1373
+ GLPIXELMAP_FUNC(f,GLfloat,ary2cflt)
1374
+ GLPIXELMAP_FUNC(ui,GLuint,ary2cuint)
1375
+ GLPIXELMAP_FUNC(us,GLushort,ary2cushort)
1376
+ #undef GLPIXELMAP_FUNC
1377
+
1378
+
1379
+ static VALUE
1380
+ gl_ReadPixels(argc,argv,obj)
1381
+ int argc;
1382
+ VALUE *argv;
1383
+ VALUE obj;
1384
+ {
1385
+ GLint x;
1386
+ GLint y;
1387
+ GLsizei width;
1388
+ GLsizei height;
1389
+ int format;
1390
+ int type;
1391
+ VALUE pixels;
1392
+ VALUE args[7];
1393
+ int numargs;
1394
+ DECL_GL_FUNC_PTR(void,glReadPixels,(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels));
1395
+
1396
+ LOAD_GL_FUNC(glReadPixels, NULL);
1397
+ numargs = rb_scan_args(argc, argv, "61", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6]);
1398
+ x = (GLint)NUM2INT(args[0]);
1399
+ y = (GLint)NUM2INT(args[1]);
1400
+ width = (GLsizei)NUM2UINT(args[2]);
1401
+ height = (GLsizei)NUM2UINT(args[3]);
1402
+ format = NUM2INT(args[4]);
1403
+ type = NUM2INT(args[5]);
1404
+
1405
+ switch(numargs) {
1406
+ default:
1407
+ case 6:
1408
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1409
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
1410
+ pixels = allocate_buffer_with_string(GetDataSize(type,format,width*height));
1411
+ FORCE_PIXEL_STORE_MODE
1412
+ fptr_glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING_PTR(pixels));
1413
+ RESTORE_PIXEL_STORE_MODE
1414
+ CHECK_GLERROR_FROM("glReadPixels");
1415
+ return pixels;
1416
+ break;
1417
+ case 7:
1418
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1419
+ rb_raise(rb_eArgError, "Pixel pack buffer not bound");
1420
+ FORCE_PIXEL_STORE_MODE
1421
+ fptr_glReadPixels(x,y,width,height,format,type,(GLvoid*)NUM2SIZET(args[6]));
1422
+ RESTORE_PIXEL_STORE_MODE
1423
+ CHECK_GLERROR_FROM("glReadPixels");
1424
+ return Qnil;
1425
+ break;
1426
+ }
1427
+ }
1428
+
1429
+ static VALUE
1430
+ gl_DrawPixels(obj,arg1,arg2,arg3,arg4,arg5)
1431
+ VALUE obj,arg1,arg2,arg3,arg4,arg5;
1432
+ {
1433
+ GLsizei width;
1434
+ GLsizei height;
1435
+ GLenum format;
1436
+ GLenum type;
1437
+ const char *pixels;
1438
+ DECL_GL_FUNC_PTR(void,glDrawPixels,(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels));
1439
+
1440
+ LOAD_GL_FUNC(glDrawPixels, NULL);
1441
+ width = (GLsizei)NUM2UINT(arg1);
1442
+ height = (GLsizei)NUM2UINT(arg2);
1443
+ format = (GLenum)NUM2INT(arg3);
1444
+ type = (GLenum)NUM2INT(arg4);
1445
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
1446
+ fptr_glDrawPixels(width,height,format,type,(GLvoid *)NUM2SIZET(arg5));
1447
+ } else {
1448
+ VALUE data;
1449
+ data = pack_array_or_pass_string(type,arg5);
1450
+ CheckDataSize(type,format,width*height,data);
1451
+ pixels = RSTRING_PTR(data);
1452
+ fptr_glDrawPixels(width,height,format,type,pixels);
1453
+ }
1454
+ CHECK_GLERROR_FROM("glDrawPixels");
1455
+ return Qnil;
1456
+ }
1457
+
1458
+ static VALUE
1459
+ gl_GetClipPlane(obj,arg1)
1460
+ VALUE obj,arg1;
1461
+ {
1462
+ GLenum plane;
1463
+ GLdouble equation[4] = {0.0,0.0,0.0,0.0};
1464
+ VALUE retary;
1465
+ int i;
1466
+ DECL_GL_FUNC_PTR(void,glGetClipPlane,(GLenum plane, GLdouble *equation));
1467
+
1468
+ LOAD_GL_FUNC(glGetClipPlane, NULL);
1469
+ plane = (GLenum)NUM2INT(arg1);
1470
+ fptr_glGetClipPlane(plane,equation);
1471
+ retary = rb_ary_new2(4);
1472
+ for(i=0;i<4;i++)
1473
+ rb_ary_push(retary, rb_float_new(equation[i]));
1474
+ CHECK_GLERROR_FROM("glGetClipPlane");
1475
+ return retary;
1476
+ }
1477
+
1478
+ #define GLGET_FUNC(_name_,_type_,_conv_) \
1479
+ static VALUE \
1480
+ gl_Get##_name_##v(obj,arg1) \
1481
+ VALUE obj,arg1; \
1482
+ { \
1483
+ GLenum pname; \
1484
+ int nitems; \
1485
+ VALUE ary, ary2; \
1486
+ int i,j; \
1487
+ _type_ items[64]; \
1488
+ DECL_GL_FUNC_PTR(void,glGet##_name_##v,(GLenum pname, _type_ *params)); \
1489
+ LOAD_GL_FUNC(glGet##_name_##v, NULL); \
1490
+ pname = NUM2INT(arg1); \
1491
+ switch(pname) { \
1492
+ case GL_ACCUM_CLEAR_VALUE: \
1493
+ case GL_BLEND_COLOR: \
1494
+ case GL_COLOR_CLEAR_VALUE: \
1495
+ case GL_COLOR_WRITEMASK: \
1496
+ case GL_CURRENT_COLOR: \
1497
+ case GL_CURRENT_RASTER_COLOR: \
1498
+ case GL_CURRENT_RASTER_POSITION: \
1499
+ case GL_CURRENT_RASTER_SECONDARY_COLOR: \
1500
+ case GL_CURRENT_RASTER_TEXTURE_COORDS: \
1501
+ case GL_CURRENT_TEXTURE_COORDS: \
1502
+ case GL_FOG_COLOR: \
1503
+ case GL_LIGHT_MODEL_AMBIENT: \
1504
+ case GL_MAP2_GRID_DOMAIN: \
1505
+ case GL_CURRENT_SECONDARY_COLOR: \
1506
+ case GL_SCISSOR_BOX: \
1507
+ case GL_TEXTURE_ENV_COLOR: \
1508
+ case GL_VIEWPORT: \
1509
+ case GL_REFERENCE_PLANE_EQUATION_SGIX: \
1510
+ case GL_FOG_OFFSET_VALUE_SGIX: \
1511
+ case GL_TEXTURE_ENV_BIAS_SGIX: \
1512
+ case GL_CULL_VERTEX_OBJECT_POSITION_EXT: \
1513
+ case GL_CULL_VERTEX_EYE_POSITION_EXT: \
1514
+ case GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX: \
1515
+ case GL_CONSTANT_COLOR0_NV: \
1516
+ case GL_CONSTANT_COLOR1_NV: \
1517
+ case GL_TEXTURE_COLOR_WRITEMASK_SGIS: \
1518
+ case GL_FLOAT_CLEAR_COLOR_VALUE_NV: \
1519
+ case GL_RGBA_SIGNED_COMPONENTS_EXT: \
1520
+ nitems = 4; \
1521
+ break; \
1522
+ case GL_CURRENT_NORMAL: \
1523
+ case GL_POINT_DISTANCE_ATTENUATION: \
1524
+ case GL_SPRITE_AXIS_SGIX: \
1525
+ case GL_SPRITE_TRANSLATION_SGIX: \
1526
+ case GL_CURRENT_RASTER_NORMAL_SGIX: \
1527
+ case GL_CURRENT_TANGENT_EXT: \
1528
+ case GL_CURRENT_BINORMAL_EXT: \
1529
+ nitems = 3; \
1530
+ break; \
1531
+ case GL_DEPTH_RANGE: \
1532
+ case GL_LINE_WIDTH_RANGE: \
1533
+ case GL_MAP1_GRID_DOMAIN: \
1534
+ case GL_MAP2_GRID_SEGMENTS: \
1535
+ case GL_MAX_VIEWPORT_DIMS: \
1536
+ case GL_POINT_SIZE_RANGE: \
1537
+ case GL_POLYGON_MODE: \
1538
+ case GL_ALIASED_LINE_WIDTH_RANGE: \
1539
+ case GL_ALIASED_POINT_SIZE_RANGE: \
1540
+ case GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX: \
1541
+ case GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX: \
1542
+ case GL_FOG_FUNC_SGIS: \
1543
+ case GL_DEPTH_BOUNDS_EXT: \
1544
+ nitems = 2; \
1545
+ break; \
1546
+ case GL_MODELVIEW_MATRIX: \
1547
+ case GL_PROJECTION_MATRIX: \
1548
+ case GL_TEXTURE_MATRIX: \
1549
+ case GL_COLOR_MATRIX: \
1550
+ case GL_TRANSPOSE_MODELVIEW_MATRIX: \
1551
+ case GL_TRANSPOSE_PROJECTION_MATRIX: \
1552
+ case GL_TRANSPOSE_TEXTURE_MATRIX: \
1553
+ case GL_TRANSPOSE_COLOR_MATRIX: \
1554
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB: \
1555
+ case GL_MODELVIEW0_ARB: \
1556
+ case GL_MODELVIEW1_ARB: \
1557
+ case GL_MODELVIEW2_ARB: \
1558
+ case GL_MODELVIEW3_ARB: \
1559
+ case GL_MODELVIEW4_ARB: \
1560
+ case GL_MODELVIEW5_ARB: \
1561
+ case GL_MODELVIEW6_ARB: \
1562
+ case GL_MODELVIEW7_ARB: \
1563
+ case GL_MODELVIEW8_ARB: \
1564
+ case GL_MODELVIEW9_ARB: \
1565
+ case GL_MODELVIEW10_ARB: \
1566
+ case GL_MODELVIEW11_ARB: \
1567
+ case GL_MODELVIEW12_ARB: \
1568
+ case GL_MODELVIEW13_ARB: \
1569
+ case GL_MODELVIEW14_ARB: \
1570
+ case GL_MODELVIEW15_ARB: \
1571
+ case GL_MODELVIEW16_ARB: \
1572
+ case GL_MODELVIEW17_ARB: \
1573
+ case GL_MODELVIEW18_ARB: \
1574
+ case GL_MODELVIEW19_ARB: \
1575
+ case GL_MODELVIEW20_ARB: \
1576
+ case GL_MODELVIEW21_ARB: \
1577
+ case GL_MODELVIEW22_ARB: \
1578
+ case GL_MODELVIEW23_ARB: \
1579
+ case GL_MODELVIEW24_ARB: \
1580
+ case GL_MODELVIEW25_ARB: \
1581
+ case GL_MODELVIEW26_ARB: \
1582
+ case GL_MODELVIEW27_ARB: \
1583
+ case GL_MODELVIEW28_ARB: \
1584
+ case GL_MODELVIEW29_ARB: \
1585
+ case GL_MODELVIEW30_ARB: \
1586
+ case GL_MODELVIEW31_ARB: \
1587
+ case GL_MATRIX_PALETTE_ARB: \
1588
+ case GL_PIXEL_TRANSFORM_2D_MATRIX_EXT: \
1589
+ case GL_MODELVIEW1_MATRIX_EXT: \
1590
+ case GL_CURRENT_MATRIX_NV: \
1591
+ fptr_glGet##_name_##v(pname, items); \
1592
+ ary = rb_ary_new2(4); \
1593
+ for (i = 0; i < 4; i++) { \
1594
+ ary2 = rb_ary_new2(4); \
1595
+ rb_ary_push(ary, ary2); \
1596
+ for (j = 0; j < 4; j++) \
1597
+ rb_ary_push(ary2, _conv_(items[i*4+j])); \
1598
+ } \
1599
+ CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1600
+ return ary; \
1601
+ case GL_POLYGON_STIPPLE: \
1602
+ fptr_glGet##_name_##v(pname, items); \
1603
+ CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1604
+ return rb_str_new((const char*)items, 32); \
1605
+ case GL_COMPRESSED_TEXTURE_FORMATS: \
1606
+ { \
1607
+ DECL_GL_FUNC_PTR(void,glGetIntegerv,(GLenum pname, GLint *params)); \
1608
+ LOAD_GL_FUNC(glGetIntegerv, NULL); \
1609
+ fptr_glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nitems); \
1610
+ CHECK_GLERROR_FROM("glGetIntegerv"); \
1611
+ if (nitems<=0||nitems>64) \
1612
+ return INT2NUM(0); \
1613
+ } \
1614
+ break; \
1615
+ default: /* size=1 */ \
1616
+ fptr_glGet##_name_##v(pname, items); \
1617
+ CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1618
+ return _conv_(items[0]); \
1619
+ } \
1620
+ fptr_glGet##_name_##v(pname, items); \
1621
+ ary = rb_ary_new2(nitems); \
1622
+ for (i = 0; i < nitems; i++) \
1623
+ rb_ary_push(ary, _conv_(items[i])); \
1624
+ CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1625
+ return ary; \
1626
+ }
1627
+
1628
+ GLGET_FUNC(Double,GLdouble,rb_float_new)
1629
+ GLGET_FUNC(Float,GLfloat,rb_float_new)
1630
+ GLGET_FUNC(Integer,GLint,INT2NUM)
1631
+ GLGET_FUNC(Boolean,GLboolean,GLBOOL2RUBY)
1632
+
1633
+ #undef GLGET_FUNC
1634
+
1635
+
1636
+ static VALUE
1637
+ gl_GetLightfv(obj,arg1,arg2)
1638
+ VALUE obj,arg1,arg2;
1639
+ {
1640
+ GLenum light;
1641
+ GLenum pname;
1642
+ GLsizei size;
1643
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1644
+ DECL_GL_FUNC_PTR(void,glGetLightfv,(GLenum light, GLenum pname, GLfloat *params));
1645
+
1646
+ LOAD_GL_FUNC(glGetLightfv, NULL);
1647
+ light = (GLenum)NUM2INT(arg1);
1648
+ pname = (GLenum)NUM2INT(arg2);
1649
+ switch(pname) {
1650
+ case GL_AMBIENT:
1651
+ case GL_DIFFUSE:
1652
+ case GL_SPECULAR:
1653
+ case GL_POSITION:
1654
+ size = 4;
1655
+ break;
1656
+ case GL_SPOT_DIRECTION:
1657
+ size = 3;
1658
+ break;
1659
+ case GL_CONSTANT_ATTENUATION:
1660
+ case GL_LINEAR_ATTENUATION:
1661
+ case GL_QUADRATIC_ATTENUATION:
1662
+ case GL_SPOT_EXPONENT:
1663
+ case GL_SPOT_CUTOFF:
1664
+ size = 1;
1665
+ break;
1666
+ default:
1667
+ rb_raise(rb_eArgError, "unknown pname:%d",pname);
1668
+ break; /* not reached */
1669
+ }
1670
+ fptr_glGetLightfv(light,pname,params);
1671
+ RET_ARRAY_OR_SINGLE("glGetLightfv", size, rb_float_new, params);
1672
+ }
1673
+
1674
+ static VALUE
1675
+ gl_GetLightiv(obj,arg1,arg2)
1676
+ VALUE obj,arg1,arg2;
1677
+ {
1678
+ GLenum light;
1679
+ GLenum pname;
1680
+ GLsizei size;
1681
+ GLint params[4] = {0,0,0,0};
1682
+ DECL_GL_FUNC_PTR(void,glGetLightiv,(GLenum light, GLenum pname, GLint *params));
1683
+
1684
+ LOAD_GL_FUNC(glGetLightiv, NULL);
1685
+ light = (GLenum)NUM2INT(arg1);
1686
+ pname = (GLenum)NUM2INT(arg2);
1687
+ switch(pname) {
1688
+ case GL_AMBIENT:
1689
+ case GL_DIFFUSE:
1690
+ case GL_SPECULAR:
1691
+ case GL_POSITION:
1692
+ size = 4;
1693
+ break;
1694
+ case GL_SPOT_DIRECTION:
1695
+ size = 3;
1696
+ break;
1697
+ case GL_CONSTANT_ATTENUATION:
1698
+ case GL_LINEAR_ATTENUATION:
1699
+ case GL_QUADRATIC_ATTENUATION:
1700
+ case GL_SPOT_EXPONENT:
1701
+ case GL_SPOT_CUTOFF:
1702
+ size = 1;
1703
+ break;
1704
+ default:
1705
+ rb_raise(rb_eArgError, "unknown pname:%d",pname);
1706
+ break; /* not reached */
1707
+ }
1708
+ fptr_glGetLightiv(light,pname,params);
1709
+ RET_ARRAY_OR_SINGLE("glGetLightiv", size, INT2NUM, params);
1710
+ }
1711
+
1712
+ #define GETMAP_FUNC(_name_,_type_) \
1713
+ static VALUE \
1714
+ gl_##_name_(obj,arg1,arg2) \
1715
+ VALUE obj,arg1,arg2; \
1716
+ { \
1717
+ GLenum target; \
1718
+ GLenum query; \
1719
+ int dims; \
1720
+ int pointsize; \
1721
+ int size=0; \
1722
+ _type_ *points; \
1723
+ GLint order[2] = {0,0}; /* for GL_COEFF, [order] or [uorder,vorder] (MAP1/MAP2) */ \
1724
+ DECL_GL_FUNC_PTR(void,gl##_name_,(GLenum target, GLenum query, _type_ *v)); \
1725
+ LOAD_GL_FUNC(gl##_name_, NULL); \
1726
+ target = (GLenum)NUM2INT(arg1); \
1727
+ query = (GLenum)NUM2INT(arg2); \
1728
+ switch(target) { \
1729
+ case GL_MAP1_INDEX: \
1730
+ case GL_MAP1_TEXTURE_COORD_1: dims=1; pointsize=1; break; \
1731
+ case GL_MAP1_TEXTURE_COORD_2: dims=1; pointsize=2; break; \
1732
+ case GL_MAP1_VERTEX_3: \
1733
+ case GL_MAP1_NORMAL: \
1734
+ case GL_MAP1_TEXTURE_COORD_3: dims=1; pointsize=3; break; \
1735
+ case GL_MAP1_COLOR_4: \
1736
+ case GL_MAP1_TEXTURE_COORD_4: \
1737
+ case GL_MAP1_VERTEX_4: dims=1; pointsize=4; break; \
1738
+ case GL_MAP2_INDEX: \
1739
+ case GL_MAP2_TEXTURE_COORD_1: dims=2; pointsize=1; break; \
1740
+ case GL_MAP2_TEXTURE_COORD_2: dims=2; pointsize=2; break; \
1741
+ case GL_MAP2_VERTEX_3: \
1742
+ case GL_MAP2_NORMAL: \
1743
+ case GL_MAP2_TEXTURE_COORD_3: dims=2; pointsize=3; break; \
1744
+ case GL_MAP2_COLOR_4: \
1745
+ case GL_MAP2_TEXTURE_COORD_4: \
1746
+ case GL_MAP2_VERTEX_4: dims=2; pointsize=4; break; \
1747
+ default: \
1748
+ rb_raise(rb_eArgError, "unknown target:%d",target); \
1749
+ break; /* not reached */ \
1750
+ } \
1751
+ switch(query) { \
1752
+ case GL_ORDER: size = dims; break; \
1753
+ case GL_DOMAIN: size = dims*2; break; \
1754
+ case GL_COEFF: \
1755
+ { \
1756
+ DECL_GL_FUNC_PTR(void,glGetMapiv,(GLenum target, GLenum query, GLint *v)); \
1757
+ LOAD_GL_FUNC(glGetMapiv, NULL); \
1758
+ fptr_glGetMapiv(target,GL_ORDER,order); \
1759
+ CHECK_GLERROR_FROM("glGetMapiv"); \
1760
+ if (dims==1) \
1761
+ size = order[0] * pointsize; \
1762
+ else \
1763
+ size = (order[0]*order[1]) * pointsize; \
1764
+ } \
1765
+ break; \
1766
+ default: \
1767
+ rb_raise(rb_eArgError, "unknown target:%d",target); \
1768
+ break; /* not reached */ \
1769
+ } \
1770
+ points = ALLOC_N(_type_,size); \
1771
+ fptr_gl##_name_(target,query,points); \
1772
+ \
1773
+ RET_ARRAY_OR_SINGLE_FREE("gl" #_name_, size, RETCONV_##_type_, points); \
1774
+ }
1775
+
1776
+ GETMAP_FUNC(GetMapdv,GLdouble)
1777
+ GETMAP_FUNC(GetMapfv,GLfloat)
1778
+ GETMAP_FUNC(GetMapiv,GLint)
1779
+ #undef GETMAP_FUNC
1780
+
1781
+ static VALUE
1782
+ gl_GetMaterialfv(obj,arg1,arg2)
1783
+ VALUE obj,arg1,arg2;
1784
+ {
1785
+ GLenum face;
1786
+ GLenum pname;
1787
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1788
+ int size;
1789
+ DECL_GL_FUNC_PTR(void,glGetMaterialfv,(GLenum face, GLenum pname, GLfloat *params));
1790
+
1791
+ LOAD_GL_FUNC(glGetMaterialfv, NULL);
1792
+ face = (GLenum)NUM2INT(arg1);
1793
+ pname = (GLenum)NUM2INT(arg2);
1794
+ switch(pname) {
1795
+ case GL_AMBIENT:
1796
+ case GL_DIFFUSE:
1797
+ case GL_SPECULAR:
1798
+ case GL_EMISSION:
1799
+ size = 4;
1800
+ break;
1801
+ case GL_COLOR_INDEXES:
1802
+ size = 3;
1803
+ break;
1804
+ case GL_SHININESS:
1805
+ size = 1;
1806
+ break;
1807
+ default:
1808
+ rb_raise(rb_eArgError, "unknown pname:%d",pname);
1809
+ break; /* not reached */
1810
+ }
1811
+ fptr_glGetMaterialfv(face,pname,params);
1812
+ RET_ARRAY_OR_SINGLE("glGetMaterialfv", size, rb_float_new, params);
1813
+ }
1814
+
1815
+ static VALUE
1816
+ gl_GetMaterialiv(obj,arg1,arg2)
1817
+ VALUE obj,arg1,arg2;
1818
+ {
1819
+ GLenum face;
1820
+ GLenum pname;
1821
+ GLint params[4] = {0,0,0,0};
1822
+ int size;
1823
+ DECL_GL_FUNC_PTR(void,glGetMaterialiv,(GLenum face, GLenum pname, GLint *params));
1824
+
1825
+ LOAD_GL_FUNC(glGetMaterialiv, NULL);
1826
+ face = (GLenum)NUM2INT(arg1);
1827
+ pname = (GLenum)NUM2INT(arg2);
1828
+ switch(pname) {
1829
+ case GL_AMBIENT:
1830
+ case GL_DIFFUSE:
1831
+ case GL_SPECULAR:
1832
+ case GL_EMISSION:
1833
+ size = 4;
1834
+ break;
1835
+ case GL_COLOR_INDEXES:
1836
+ size = 3;
1837
+ break;
1838
+ case GL_SHININESS:
1839
+ size = 1;
1840
+ break;
1841
+ default:
1842
+ rb_raise(rb_eArgError, "unknown pname:%d",pname);
1843
+ break; /* not reached */
1844
+ }
1845
+ fptr_glGetMaterialiv(face,pname,params);
1846
+ RET_ARRAY_OR_SINGLE("glGetMaterialiv", size, INT2NUM, params);
1847
+ }
1848
+
1849
+ #define GLGETPIXELMAP_FUNC(_type_,_vartype_,_convert_) \
1850
+ static VALUE \
1851
+ gl_GetPixelMap##_type_##v(argc,argv,obj) \
1852
+ int argc; \
1853
+ VALUE *argv; \
1854
+ VALUE obj; \
1855
+ { \
1856
+ GLenum map; \
1857
+ GLenum map_size; \
1858
+ GLint size = 0; \
1859
+ _vartype_ *values; \
1860
+ VALUE args[2]; \
1861
+ DECL_GL_FUNC_PTR(void,glGetPixelMap##_type_##v,(GLenum map, _vartype_ *values)); \
1862
+ LOAD_GL_FUNC(glGetPixelMap##_type_##v, NULL); \
1863
+ switch (rb_scan_args(argc, argv, "11", &args[0], &args[1])) { \
1864
+ default: \
1865
+ case 1: \
1866
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING)) \
1867
+ rb_raise(rb_eArgError, \
1868
+ "Pixel pack buffer bound, but offset argument missing"); \
1869
+ \
1870
+ map = (GLenum)NUM2INT(args[0]); \
1871
+ switch(map) { \
1872
+ case GL_PIXEL_MAP_I_TO_I: map_size=GL_PIXEL_MAP_I_TO_I_SIZE; break; \
1873
+ case GL_PIXEL_MAP_S_TO_S: map_size=GL_PIXEL_MAP_S_TO_S_SIZE; break; \
1874
+ case GL_PIXEL_MAP_I_TO_R: map_size=GL_PIXEL_MAP_I_TO_R_SIZE; break; \
1875
+ case GL_PIXEL_MAP_I_TO_G: map_size=GL_PIXEL_MAP_I_TO_G_SIZE; break; \
1876
+ case GL_PIXEL_MAP_I_TO_B: map_size=GL_PIXEL_MAP_I_TO_B_SIZE; break; \
1877
+ case GL_PIXEL_MAP_I_TO_A: map_size=GL_PIXEL_MAP_I_TO_A_SIZE; break; \
1878
+ case GL_PIXEL_MAP_R_TO_R: map_size=GL_PIXEL_MAP_R_TO_R_SIZE; break; \
1879
+ case GL_PIXEL_MAP_G_TO_G: map_size=GL_PIXEL_MAP_G_TO_G_SIZE; break; \
1880
+ case GL_PIXEL_MAP_B_TO_B: map_size=GL_PIXEL_MAP_B_TO_B_SIZE; break; \
1881
+ case GL_PIXEL_MAP_A_TO_A: map_size=GL_PIXEL_MAP_A_TO_A_SIZE; break; \
1882
+ default: \
1883
+ rb_raise(rb_eArgError, "unknown map:%d",map); \
1884
+ break; \
1885
+ } \
1886
+ { \
1887
+ DECL_GL_FUNC_PTR(void,glGetIntegerv,(GLenum pname, GLint *params)); \
1888
+ LOAD_GL_FUNC(glGetIntegerv, NULL); \
1889
+ fptr_glGetIntegerv(map_size,&size); \
1890
+ } \
1891
+ CHECK_GLERROR_FROM("glGetIntegerv"); \
1892
+ values = ALLOC_N(_vartype_,size); \
1893
+ fptr_glGetPixelMap##_type_##v(map,values); \
1894
+ RET_ARRAY_OR_SINGLE_FREE("glGetPixelMap" #_type_ "v", size, _convert_, \
1895
+ values); \
1896
+ break; \
1897
+ case 2: \
1898
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING)) \
1899
+ rb_raise(rb_eArgError, "Pixel pack buffer not bound"); \
1900
+ \
1901
+ map = (GLenum)NUM2INT(args[0]); \
1902
+ fptr_glGetPixelMap##_type_##v(map,(GLvoid*)NUM2SIZET(args[1])); \
1903
+ CHECK_GLERROR_FROM("glGetPixelMap" #_type_ "v"); \
1904
+ return Qnil; \
1905
+ } \
1906
+ }
1907
+
1908
+ GLGETPIXELMAP_FUNC(f,GLfloat,rb_float_new)
1909
+ GLGETPIXELMAP_FUNC(ui,GLuint,INT2NUM)
1910
+ GLGETPIXELMAP_FUNC(us,GLushort,INT2NUM)
1911
+ #undef GLGETPIXELMAP_FUNC
1912
+
1913
+ static VALUE
1914
+ gl_GetPolygonStipple(argc,argv,obj)
1915
+ int argc;
1916
+ VALUE *argv;
1917
+ VALUE obj;
1918
+ {
1919
+ VALUE args[1];
1920
+ GLubyte mask[128];
1921
+ DECL_GL_FUNC_PTR(void,glGetPolygonStipple,(GLubyte *mask));
1922
+
1923
+ LOAD_GL_FUNC(glGetPolygonStipple, NULL);
1924
+ switch(rb_scan_args(argc, argv, "01", &args[0])) {
1925
+ default:
1926
+ case 0:
1927
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1928
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
1929
+ memset(mask, 0x0, sizeof(GLubyte)*128);
1930
+ FORCE_PIXEL_STORE_MODE
1931
+ fptr_glGetPolygonStipple(mask);
1932
+ RESTORE_PIXEL_STORE_MODE
1933
+ CHECK_GLERROR_FROM("glGetPolygonStipple");
1934
+ return rb_str_new((const char*)mask, 128);
1935
+ case 1:
1936
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1937
+ rb_raise(rb_eArgError, "Pixel pack buffer not bound");
1938
+ fptr_glGetPolygonStipple((GLvoid *)NUM2SIZET(args[0]));
1939
+ CHECK_GLERROR_FROM("glGetPolygonStipple");
1940
+ return Qnil;
1941
+ }
1942
+ }
1943
+
1944
+ static VALUE
1945
+ gl_GetString(obj,arg1)
1946
+ VALUE obj,arg1;
1947
+ {
1948
+ GLenum name;
1949
+ const GLubyte *ret;
1950
+ DECL_GL_FUNC_PTR(const GLubyte *,glGetString,(GLenum name));
1951
+
1952
+ LOAD_GL_FUNC(glGetString, NULL);
1953
+ name = (GLenum)NUM2INT(arg1);
1954
+ ret = fptr_glGetString(name);
1955
+ CHECK_GLERROR_FROM("glGetString");
1956
+ return rb_str_new2((const char*)ret);
1957
+ }
1958
+
1959
+ #define GETTEXENVFUNC(_name_,_type_) \
1960
+ static VALUE \
1961
+ gl_##_name_(obj,arg1,arg2) \
1962
+ VALUE obj,arg1,arg2; \
1963
+ { \
1964
+ GLenum target; \
1965
+ GLenum pname; \
1966
+ _type_ params[4] = {(_type_)0.0, (_type_)0.0, (_type_)0.0, (_type_)0.0}; \
1967
+ int size; \
1968
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLenum target, GLenum pname, _type_ *params)); \
1969
+ LOAD_GL_FUNC(gl##_name_, NULL); \
1970
+ target = (GLenum)NUM2INT(arg1); \
1971
+ pname = (GLenum)NUM2INT(arg2); \
1972
+ switch(pname) { \
1973
+ case GL_TEXTURE_ENV_COLOR: \
1974
+ case GL_TEXTURE_ENV_BIAS_SGIX: \
1975
+ case GL_CULL_MODES_NV: \
1976
+ case GL_OFFSET_TEXTURE_MATRIX_NV: \
1977
+ size = 4; \
1978
+ break; \
1979
+ case GL_CONST_EYE_NV: \
1980
+ size = 3; \
1981
+ break; \
1982
+ default: \
1983
+ size = 1; \
1984
+ break; \
1985
+ } \
1986
+ fptr_gl##_name_(target,pname,params); \
1987
+ RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
1988
+ }
1989
+
1990
+ GETTEXENVFUNC(GetTexEnvfv,GLfloat)
1991
+ GETTEXENVFUNC(GetTexEnviv,GLint)
1992
+ #undef GETTEXENVFUNC
1993
+
1994
+ #define GETTEXGENFUNC(_name_,_type_) \
1995
+ static VALUE \
1996
+ gl_##_name_(obj,arg1,arg2) \
1997
+ VALUE obj,arg1,arg2; \
1998
+ { \
1999
+ GLenum coord; \
2000
+ GLenum pname; \
2001
+ _type_ params[4] = {(_type_)0.0, (_type_)0.0, (_type_)0.0, (_type_)0.0}; \
2002
+ int size; \
2003
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLenum coord, GLenum pname, _type_ *params)); \
2004
+ LOAD_GL_FUNC(gl##_name_, NULL); \
2005
+ coord = (GLenum)NUM2INT(arg1); \
2006
+ pname = (GLenum)NUM2INT(arg2); \
2007
+ switch(pname) { \
2008
+ case GL_OBJECT_PLANE: \
2009
+ case GL_EYE_PLANE: \
2010
+ size = 4; \
2011
+ break; \
2012
+ default: \
2013
+ size = 1; \
2014
+ break; \
2015
+ } \
2016
+ fptr_gl##_name_(coord,pname,params); \
2017
+ RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
2018
+ }
2019
+
2020
+ GETTEXGENFUNC(GetTexGendv,GLdouble)
2021
+ GETTEXGENFUNC(GetTexGenfv,GLfloat)
2022
+ GETTEXGENFUNC(GetTexGeniv,GLint)
2023
+ #undef GETTEXGENFUNC
2024
+
2025
+ static VALUE
2026
+ gl_GetTexImage(argc,argv,obj)
2027
+ int argc;
2028
+ VALUE *argv;
2029
+ VALUE obj;
2030
+ {
2031
+ GLenum tex;
2032
+ GLint lod;
2033
+ GLenum format;
2034
+ GLenum type;
2035
+ GLint width = 0;
2036
+ GLint height = 0;
2037
+ GLint depth = 0;
2038
+ GLint size4d = 0;
2039
+ GLint size;
2040
+ VALUE pixels;
2041
+ VALUE args[5];
2042
+ int numargs;
2043
+ DECL_GL_FUNC_PTR(void,glGetTexImage,(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels));
2044
+
2045
+ LOAD_GL_FUNC(glGetTexImage, NULL);
2046
+ numargs = rb_scan_args(argc, argv, "41", &args[0], &args[1], &args[2], &args[3], &args[4]);
2047
+ tex = (GLenum)NUM2INT(args[0]);
2048
+ lod = (GLint)NUM2INT(args[1]);
2049
+ format = (GLenum)NUM2INT(args[2]);
2050
+ type = (GLenum)NUM2INT(args[3]);
2051
+ switch(numargs) {
2052
+ default:
2053
+ case 4:
2054
+ {
2055
+ DECL_GL_FUNC_PTR(void,glGetTexLevelParameteriv,(GLenum target, GLint level, GLenum pname, GLint *params));
2056
+ LOAD_GL_FUNC(glGetTexLevelParameteriv, NULL);
2057
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
2058
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
2059
+
2060
+ size = 1;
2061
+ switch(tex) {
2062
+ case GL_TEXTURE_4D_SGIS:
2063
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_4DSIZE_SGIS,&size4d);
2064
+ size *= size4d;
2065
+ /* fall through */
2066
+ case GL_TEXTURE_3D:
2067
+ case GL_TEXTURE_1D_STACK_MESAX:
2068
+ case GL_TEXTURE_2D_STACK_MESAX:
2069
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_DEPTH,&depth);
2070
+ size *= depth;
2071
+ /* fall through */
2072
+ case GL_TEXTURE_2D:
2073
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
2074
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
2075
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
2076
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
2077
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
2078
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
2079
+ case GL_TEXTURE_RECTANGLE_ARB:
2080
+ case GL_DETAIL_TEXTURE_2D_SGIS:
2081
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_HEIGHT,&height);
2082
+ size *= height;
2083
+ /* fall through */
2084
+ case GL_TEXTURE_1D:
2085
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_WIDTH,&width);
2086
+ size *= width;
2087
+ break;
2088
+ default:
2089
+ rb_raise(rb_eArgError, "Target type not supported");
2090
+ }
2091
+ CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
2092
+ pixels = allocate_buffer_with_string(GetDataSize(type,format,size));
2093
+
2094
+ FORCE_PIXEL_STORE_MODE
2095
+ fptr_glGetTexImage(tex,lod,format,type,(GLvoid*)RSTRING_PTR(pixels));
2096
+ RESTORE_PIXEL_STORE_MODE
2097
+ CHECK_GLERROR_FROM("glGetTexImage");
2098
+ return pixels;
2099
+ }
2100
+ break;
2101
+ case 5:
2102
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
2103
+ rb_raise(rb_eArgError, "Pixel pack buffer not bound");
2104
+
2105
+ FORCE_PIXEL_STORE_MODE
2106
+ fptr_glGetTexImage(tex,lod,format,type,(GLvoid*)NUM2SIZET(args[4]));
2107
+ RESTORE_PIXEL_STORE_MODE
2108
+ CHECK_GLERROR_FROM("glGetTexImage");
2109
+ return Qnil;
2110
+ }
2111
+ }
2112
+
2113
+ static VALUE
2114
+ gl_GetTexParameterfv(obj,arg1,arg2)
2115
+ VALUE obj,arg1,arg2;
2116
+ {
2117
+ GLenum target;
2118
+ GLenum pname;
2119
+ GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
2120
+ int size;
2121
+ DECL_GL_FUNC_PTR(void,glGetTexParameterfv,(GLenum target, GLenum pname, GLfloat *params));
2122
+
2123
+ LOAD_GL_FUNC(glGetTexParameterfv, NULL);
2124
+ target = (GLenum)NUM2INT(arg1);
2125
+ pname = (GLenum)NUM2INT(arg2);
2126
+ switch(pname) {
2127
+ case GL_TEXTURE_BORDER_COLOR:
2128
+ case GL_TEXTURE_BORDER_VALUES_NV:
2129
+ case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
2130
+ case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
2131
+ size = 4;
2132
+ break;
2133
+ default:
2134
+ size = 1;
2135
+ break;
2136
+ }
2137
+ fptr_glGetTexParameterfv(target,pname,params);
2138
+ RET_ARRAY_OR_SINGLE("glGetTexParameterfv", size, RETCONV_GLfloat, params);
2139
+ }
2140
+
2141
+ static VALUE
2142
+ gl_GetTexParameteriv(obj,arg1,arg2)
2143
+ VALUE obj,arg1,arg2;
2144
+ {
2145
+ GLenum target;
2146
+ GLenum pname;
2147
+ GLint params[4] = {0,0,0,0};
2148
+ int size;
2149
+ DECL_GL_FUNC_PTR(void,glGetTexParameteriv,(GLenum target, GLenum pname, GLint *params));
2150
+
2151
+ LOAD_GL_FUNC(glGetTexParameteriv, NULL);
2152
+ target = (GLenum)NUM2INT(arg1);
2153
+ pname = (GLenum)NUM2INT(arg2);
2154
+ switch(pname) {
2155
+ case GL_TEXTURE_BORDER_COLOR:
2156
+ case GL_TEXTURE_BORDER_VALUES_NV:
2157
+ case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
2158
+ case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
2159
+ size = 4;
2160
+ break;
2161
+ default:
2162
+ size = 1;
2163
+ break;
2164
+ }
2165
+ fptr_glGetTexParameteriv(target,pname,params);
2166
+ RET_ARRAY_OR_SINGLE_BOOL("glGetTexParameteriv", size, cond_GLBOOL2RUBY,
2167
+ pname, params);
2168
+ }
2169
+
2170
+ static VALUE
2171
+ gl_GetTexLevelParameterfv(obj,arg1,arg2,arg3)
2172
+ VALUE obj,arg1,arg2,arg3;
2173
+ {
2174
+ GLenum target;
2175
+ GLint level;
2176
+ GLenum pname;
2177
+ GLfloat params = (GLfloat)0.0;
2178
+ DECL_GL_FUNC_PTR(void,glGetTexLevelParameterfv,(GLenum target, GLint level, GLenum pname, GLfloat *params));
2179
+
2180
+ LOAD_GL_FUNC(glGetTexLevelParameterfv, NULL);
2181
+ target = (GLenum)NUM2INT(arg1);
2182
+ level = (GLint)NUM2INT(arg2);
2183
+ pname = (GLenum)NUM2INT(arg3);
2184
+ fptr_glGetTexLevelParameterfv(target,level,pname,&params);
2185
+ CHECK_GLERROR_FROM("glGetTexLevelParameterfv");
2186
+ return RETCONV_GLfloat(params);
2187
+ }
2188
+
2189
+ static VALUE
2190
+ gl_GetTexLevelParameteriv(obj,arg1,arg2,arg3)
2191
+ VALUE obj,arg1,arg2,arg3;
2192
+ {
2193
+ GLenum target;
2194
+ GLint level;
2195
+ GLenum pname;
2196
+ GLint params = 0;
2197
+ DECL_GL_FUNC_PTR(void,glGetTexLevelParameteriv,(GLenum target, GLint level, GLenum pname, GLint *params));
2198
+
2199
+ LOAD_GL_FUNC(glGetTexLevelParameteriv, NULL);
2200
+ target = (GLenum)NUM2INT(arg1);
2201
+ level = (GLint)NUM2INT(arg2);
2202
+ pname = (GLenum)NUM2INT(arg3);
2203
+ fptr_glGetTexLevelParameteriv(target,level,pname,&params);
2204
+ CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
2205
+ return cond_GLBOOL2RUBY(pname,params);
2206
+ }
2207
+
2208
+
2209
+ static VALUE
2210
+ gl_LoadMatrixf(obj,arg1)
2211
+ VALUE obj,arg1;
2212
+ {
2213
+ GLfloat m[4*4];
2214
+ DECL_GL_FUNC_PTR(void,glLoadMatrixf,(const GLfloat *m));
2215
+
2216
+ LOAD_GL_FUNC(glLoadMatrixf, NULL);
2217
+ ary2cmatfloat(arg1, m, 4, 4);
2218
+ fptr_glLoadMatrixf(m);
2219
+ CHECK_GLERROR_FROM("glLoadMatrixf");
2220
+ return Qnil;
2221
+ }
2222
+
2223
+ static VALUE
2224
+ gl_LoadMatrixd(obj,arg1)
2225
+ VALUE obj,arg1;
2226
+ {
2227
+ GLdouble m[4*4];
2228
+ DECL_GL_FUNC_PTR(void,glLoadMatrixd,(const GLdouble *m));
2229
+
2230
+ LOAD_GL_FUNC(glLoadMatrixd, NULL);
2231
+ ary2cmatdouble(arg1, m, 4, 4);
2232
+ fptr_glLoadMatrixd(m);
2233
+ CHECK_GLERROR_FROM("glLoadMatrixd");
2234
+ return Qnil;
2235
+ }
2236
+
2237
+ static VALUE
2238
+ gl_MultMatrixf(obj,arg1)
2239
+ VALUE obj,arg1;
2240
+ {
2241
+ GLfloat m[4*4];
2242
+ DECL_GL_FUNC_PTR(void,glMultMatrixf,(const GLfloat *m));
2243
+
2244
+ LOAD_GL_FUNC(glMultMatrixf, NULL);
2245
+ ary2cmatfloat(arg1, m, 4, 4);
2246
+ fptr_glMultMatrixf(m);
2247
+ CHECK_GLERROR_FROM("glMultMatrixf");
2248
+ return Qnil;
2249
+ }
2250
+
2251
+ static VALUE
2252
+ gl_MultMatrixd(obj,arg1)
2253
+ VALUE obj,arg1;
2254
+ {
2255
+ GLdouble m[4*4];
2256
+ DECL_GL_FUNC_PTR(void,glMultMatrixd,(const GLdouble *m));
2257
+
2258
+ LOAD_GL_FUNC(glMultMatrixd, NULL);
2259
+ ary2cmatdouble(arg1, m, 4, 4);
2260
+ fptr_glMultMatrixd(m);
2261
+ CHECK_GLERROR_FROM("glMultMatrixd");
2262
+ return Qnil;
2263
+ }
2264
+
2265
+
2266
+ #define POINTER_FUNC(_func_) \
2267
+ static VALUE \
2268
+ gl_##_func_##Pointer(obj, arg1, arg2, arg3, arg4) \
2269
+ VALUE obj, arg1, arg2, arg3, arg4; \
2270
+ { \
2271
+ GLint size; \
2272
+ GLenum type; \
2273
+ GLsizei stride; \
2274
+ DECL_GL_FUNC_PTR(GLvoid,gl##_func_##Pointer,(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)); \
2275
+ LOAD_GL_FUNC(gl##_func_##Pointer, NULL); \
2276
+ size = (GLint)NUM2INT(arg1); \
2277
+ type = (GLenum)NUM2INT(arg2); \
2278
+ stride = (GLsizei)NUM2UINT(arg3); \
2279
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) { \
2280
+ SET_GLIMPL_VARIABLE(_func_##_ptr, arg4); \
2281
+ fptr_gl##_func_##Pointer(size, type, stride, (const GLvoid*)NUM2SIZET(arg4)); \
2282
+ } else { \
2283
+ VALUE data; \
2284
+ data = pack_array_or_pass_string(type,arg4); \
2285
+ rb_str_freeze(data); \
2286
+ SET_GLIMPL_VARIABLE(_func_##_ptr, data); \
2287
+ fptr_gl##_func_##Pointer(size, type, stride, (const GLvoid*)RSTRING_PTR(data)); \
2288
+ } \
2289
+ CHECK_GLERROR_FROM("gl" #_func_ "Pointer"); \
2290
+ return Qnil; \
2291
+ }
2292
+
2293
+ POINTER_FUNC(Vertex)
2294
+ POINTER_FUNC(Color)
2295
+ POINTER_FUNC(TexCoord)
2296
+
2297
+ #undef POINTER_FUNC
2298
+
2299
+ static VALUE
2300
+ gl_DrawElements(obj,arg1,arg2,arg3,arg4)
2301
+ VALUE obj,arg1,arg2,arg3,arg4;
2302
+ {
2303
+ GLenum mode;
2304
+ GLsizei count;
2305
+ GLenum type;
2306
+ DECL_GL_FUNC_PTR(void,glDrawElements,(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices));
2307
+
2308
+ LOAD_GL_FUNC(glDrawElements, NULL);
2309
+ mode = (GLenum)NUM2INT(arg1);
2310
+ count = (GLsizei)NUM2UINT(arg2);
2311
+ type = (GLenum)NUM2INT(arg3);
2312
+ if (CHECK_BUFFER_BINDING(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
2313
+ fptr_glDrawElements(mode, count, type, (const GLvoid*)NUM2SIZET(arg4));
2314
+ } else {
2315
+ VALUE data;
2316
+ data = pack_array_or_pass_string(type,arg4);
2317
+ fptr_glDrawElements(mode, count, type, (const GLvoid*)RSTRING_PTR(data));
2318
+ }
2319
+ CHECK_GLERROR_FROM("glDrawElements");
2320
+ return Qnil;
2321
+ }
2322
+
2323
+ static VALUE
2324
+ gl_EdgeFlagPointer(obj,arg1,arg2)
2325
+ VALUE obj,arg1,arg2;
2326
+ {
2327
+ GLsizei stride;
2328
+ DECL_GL_FUNC_PTR(void,glEdgeFlagPointer,(GLsizei stride, const GLvoid *ptr));
2329
+
2330
+ LOAD_GL_FUNC(glEdgeFlagPointer, NULL);
2331
+ stride = (GLsizei)NUM2UINT(arg1);
2332
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
2333
+ SET_GLIMPL_VARIABLE(EdgeFlag_ptr, arg2);
2334
+ fptr_glEdgeFlagPointer(stride, (const GLvoid*) NUM2SIZET(arg2));
2335
+ } else {
2336
+ VALUE data;
2337
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg2);
2338
+ rb_str_freeze(data);
2339
+ SET_GLIMPL_VARIABLE(EdgeFlag_ptr, data);
2340
+ fptr_glEdgeFlagPointer(stride, (const GLvoid*)RSTRING_PTR(data));
2341
+ }
2342
+ CHECK_GLERROR_FROM("glEdgeFlagPointer");
2343
+ return Qnil;
2344
+ }
2345
+
2346
+ static VALUE
2347
+ gl_GetPointerv(obj,arg1)
2348
+ VALUE obj,arg1;
2349
+ {
2350
+ GLenum pname;
2351
+
2352
+ pname = (GLenum)NUM2INT(arg1);
2353
+ switch (pname) {
2354
+ case GL_VERTEX_ARRAY_POINTER:
2355
+ return GET_GLIMPL_VARIABLE(Vertex_ptr);
2356
+ case GL_NORMAL_ARRAY_POINTER:
2357
+ return GET_GLIMPL_VARIABLE(Normal_ptr);
2358
+ case GL_COLOR_ARRAY_POINTER:
2359
+ return GET_GLIMPL_VARIABLE(Color_ptr);
2360
+ case GL_INDEX_ARRAY_POINTER:
2361
+ return GET_GLIMPL_VARIABLE(Index_ptr);
2362
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
2363
+ return GET_GLIMPL_VARIABLE(TexCoord_ptr);
2364
+ case GL_EDGE_FLAG_ARRAY_POINTER:
2365
+ return GET_GLIMPL_VARIABLE(EdgeFlag_ptr);
2366
+ case GL_FOG_COORD_ARRAY_POINTER:
2367
+ return GET_GLIMPL_VARIABLE(FogCoord_ptr);
2368
+ case GL_SECONDARY_COLOR_ARRAY_POINTER:
2369
+ return GET_GLIMPL_VARIABLE(SecondaryColor_ptr);
2370
+ case GL_FEEDBACK_BUFFER_POINTER:
2371
+ return GET_GLIMPL_VARIABLE(current_feed_buffer);
2372
+ case GL_SELECTION_BUFFER_POINTER:
2373
+ return GET_GLIMPL_VARIABLE(current_sel_buffer);
2374
+ default:
2375
+ rb_raise(rb_eArgError, "Invalid pname %d",pname);
2376
+ break; /* not reached */
2377
+ }
2378
+ return Qnil;
2379
+ }
2380
+
2381
+ static VALUE
2382
+ gl_IndexPointer(obj,arg1,arg2,arg3)
2383
+ VALUE obj,arg1,arg2,arg3;
2384
+ {
2385
+ GLenum type;
2386
+ GLsizei stride;
2387
+ DECL_GL_FUNC_PTR(void,glIndexPointer,(GLenum type, GLsizei stride, const GLvoid *ptr));
2388
+
2389
+ LOAD_GL_FUNC(glIndexPointer, NULL);
2390
+ type = (GLenum)NUM2INT(arg1);
2391
+ stride = (GLsizei)NUM2UINT(arg2);
2392
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
2393
+ SET_GLIMPL_VARIABLE(Index_ptr, arg3);
2394
+ fptr_glIndexPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
2395
+ } else {
2396
+ VALUE data;
2397
+ data = pack_array_or_pass_string(type,arg3);
2398
+ SET_GLIMPL_VARIABLE(Index_ptr, data);
2399
+ fptr_glIndexPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
2400
+ }
2401
+ CHECK_GLERROR_FROM("glIndexPointer");
2402
+ return Qnil;
2403
+ }
2404
+
2405
+ static VALUE
2406
+ gl_InterleavedArrays(obj,arg1,arg2,arg3)
2407
+ VALUE obj,arg1,arg2,arg3;
2408
+ {
2409
+ GLenum format;
2410
+ GLsizei stride;
2411
+ VALUE data;
2412
+ DECL_GL_FUNC_PTR(void,glInterleavedArrays,(GLenum format, GLsizei stride, const GLvoid *pointer));
2413
+
2414
+ LOAD_GL_FUNC(glInterleavedArrays, NULL);
2415
+ format = (GLenum)NUM2INT(arg1);
2416
+ stride = (GLsizei)NUM2UINT(arg2);
2417
+ /* FIXME: add support for GL_C4UB_V2F,GL_C4UB_V3F, GL_T2F_C4UB_V3 */
2418
+ data = pack_array_or_pass_string(GL_FLOAT,arg3);
2419
+ rb_str_freeze(data);
2420
+ fptr_glInterleavedArrays(format, stride, (const GLvoid*)RSTRING_PTR(data));
2421
+ CHECK_GLERROR_FROM("glInterleavedArrays");
2422
+ return Qnil;
2423
+ }
2424
+
2425
+ static VALUE
2426
+ gl_NormalPointer(obj,arg1,arg2,arg3)
2427
+ VALUE obj,arg1,arg2,arg3;
2428
+ {
2429
+ GLenum type;
2430
+ GLsizei stride;
2431
+ DECL_GL_FUNC_PTR(void,glNormalPointer,(GLenum type, GLsizei stride, const GLvoid *ptr));
2432
+
2433
+ LOAD_GL_FUNC(glNormalPointer, NULL);
2434
+ type = (GLenum)NUM2INT(arg1);
2435
+ stride = (GLsizei)NUM2UINT(arg2);
2436
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
2437
+ SET_GLIMPL_VARIABLE(Normal_ptr, arg3);
2438
+ fptr_glNormalPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
2439
+ } else {
2440
+ VALUE data;
2441
+ data = pack_array_or_pass_string(type,arg3);
2442
+ rb_str_freeze(data);
2443
+ SET_GLIMPL_VARIABLE(Normal_ptr, data);
2444
+ fptr_glNormalPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
2445
+ }
2446
+ CHECK_GLERROR_FROM("glNormalPointer");
2447
+ return Qnil;
2448
+ }
2449
+
2450
+
2451
+ static VALUE
2452
+ gl_TexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
2453
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
2454
+ {
2455
+ GLenum target;
2456
+ GLint level;
2457
+ GLint xoffset;
2458
+ GLsizei width;
2459
+ GLenum format;
2460
+ GLenum type;
2461
+ VALUE data;
2462
+ DECL_GL_FUNC_PTR(void,glTexSubImage1D,(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels));
2463
+
2464
+ LOAD_GL_FUNC(glTexSubImage1D, NULL);
2465
+ target = (GLenum)NUM2INT(arg1);
2466
+ level = (GLint)NUM2INT(arg2);
2467
+ xoffset = (GLint)NUM2INT(arg3);
2468
+ width = (GLsizei)NUM2UINT(arg4);
2469
+ format = (GLenum)NUM2INT(arg5);
2470
+ type = (GLenum)NUM2INT(arg6);
2471
+
2472
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
2473
+ fptr_glTexSubImage1D(target,level,xoffset,width,format,type,(GLvoid *)NUM2SIZET(arg7));
2474
+ CHECK_GLERROR_FROM("glTexSubImage1D");
2475
+ return Qnil;
2476
+ }
2477
+
2478
+ data = pack_array_or_pass_string(type,arg7);
2479
+ CheckDataSize(type,format,width,data);
2480
+
2481
+ fptr_glTexSubImage1D(target,level,xoffset,width,format,type,RSTRING_PTR(data));
2482
+ CHECK_GLERROR_FROM("glTexSubImage1D");
2483
+ return Qnil;
2484
+ }
2485
+
2486
+ static VALUE
2487
+ gl_TexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
2488
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
2489
+ {
2490
+ GLenum target;
2491
+ GLint level;
2492
+ GLint xoffset;
2493
+ GLint yoffset;
2494
+ GLsizei width;
2495
+ GLsizei height;
2496
+ GLenum format;
2497
+ GLenum type;
2498
+ VALUE data;
2499
+ DECL_GL_FUNC_PTR(void,glTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels));
2500
+
2501
+ LOAD_GL_FUNC(glTexSubImage2D, NULL);
2502
+ target = (GLenum)NUM2INT(arg1);
2503
+ level = (GLint)NUM2INT(arg2);
2504
+ xoffset = (GLint)NUM2INT(arg3);
2505
+ yoffset = (GLint)NUM2INT(arg4);
2506
+ width = (GLsizei)NUM2UINT(arg5);
2507
+ height = (GLsizei)NUM2UINT(arg6);
2508
+ format = (GLenum)NUM2INT(arg7);
2509
+ type = (GLenum)NUM2INT(arg8);
2510
+
2511
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
2512
+ fptr_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,(GLvoid *)NUM2SIZET(arg9));
2513
+ CHECK_GLERROR_FROM("glTexSubImage2D");
2514
+ return Qnil;
2515
+ }
2516
+
2517
+ data = pack_array_or_pass_string(type,arg9);
2518
+ CheckDataSize(type,format,width*height,data);
2519
+
2520
+ fptr_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,RSTRING_PTR(data));
2521
+ CHECK_GLERROR_FROM("glTexSubImage2D");
2522
+ return Qnil;
2523
+ }
2524
+
2525
+ static VALUE
2526
+ gl_AreTexturesResident(obj,arg1)
2527
+ VALUE obj,arg1;
2528
+ {
2529
+ GLuint *textures;
2530
+ GLboolean *residences;
2531
+ GLsizei size;
2532
+ GLboolean r;
2533
+ VALUE retary;
2534
+ VALUE ary;
2535
+ int i;
2536
+ DECL_GL_FUNC_PTR(GLboolean,glAreTexturesResident,(GLsizei n, const GLuint *textures, GLboolean *residences));
2537
+
2538
+ LOAD_GL_FUNC(glAreTexturesResident, NULL);
2539
+ ary = rb_Array(arg1);
2540
+ size = (int)RARRAY_LENINT(ary);
2541
+ textures = ALLOC_N(GLuint,size);
2542
+ residences = ALLOC_N(GLboolean,size);
2543
+ ary2cuint(ary,textures,size);
2544
+ r = fptr_glAreTexturesResident(size,textures,residences);
2545
+ retary = rb_ary_new2(size);
2546
+ if (r==GL_TRUE) { /* all are resident */
2547
+ for(i=0;i<size;i++)
2548
+ rb_ary_push(retary, GLBOOL2RUBY(GL_TRUE));
2549
+ } else {
2550
+ for(i=0;i<size;i++)
2551
+ rb_ary_push(retary, GLBOOL2RUBY(residences[i]));
2552
+ }
2553
+ xfree(textures);
2554
+ xfree(residences);
2555
+ CHECK_GLERROR_FROM("glAreTexturesResident");
2556
+ return retary;
2557
+ }
2558
+
2559
+ GL_FUNC_GENOBJECTS(GenTextures)
2560
+ GL_FUNC_DELETEOBJECTS(DeleteTextures)
2561
+
2562
+ static VALUE
2563
+ gl_PrioritizeTextures(obj,arg1,arg2)
2564
+ VALUE obj,arg1,arg2;
2565
+ {
2566
+ GLuint *textures;
2567
+ GLclampf *priorities;
2568
+ GLsizei size;
2569
+ DECL_GL_FUNC_PTR(void,glPrioritizeTextures,(GLsizei n, const GLuint *textures, const GLclampf *priorities));
2570
+
2571
+ LOAD_GL_FUNC(glPrioritizeTextures, NULL);
2572
+ Check_Type(arg1,T_ARRAY);
2573
+ Check_Type(arg2,T_ARRAY);
2574
+ if ((size = (GLsizei)RARRAY_LENINT(arg1)) != (GLsizei)RARRAY_LENINT(arg2))
2575
+ rb_raise(rb_eArgError, "passed arrays must have the same length");
2576
+ textures = ALLOC_N(GLuint,size);
2577
+ priorities = ALLOC_N(GLclampf,size);
2578
+ ary2cuint(arg1,textures,size);
2579
+ ary2cflt(arg2,priorities,size);
2580
+ fptr_glPrioritizeTextures(size,textures,priorities);
2581
+ xfree(textures);
2582
+ xfree(priorities);
2583
+ CHECK_GLERROR_FROM("glPrioritizeTextures");
2584
+ return Qnil;
2585
+ }
2586
+
2587
+ static VALUE
2588
+ gl_Indexubv(obj,arg1)
2589
+ VALUE obj,arg1;
2590
+ {
2591
+ GLubyte c[1] = {0};
2592
+ DECL_GL_FUNC_PTR(void,glIndexubv,(const GLubyte *c));
2593
+
2594
+ LOAD_GL_FUNC(glIndexubv, NULL);
2595
+ Check_Type(arg1,T_ARRAY);
2596
+ ary2cubyte(arg1,c,1);
2597
+ fptr_glIndexubv(c);
2598
+ CHECK_GLERROR_FROM("glIndexubv");
2599
+ return Qnil;
2600
+ }
2601
+
2602
+
2603
+ /* additional functions */
2604
+
2605
+ #define GLCOLOR_VFUNC(_type_) \
2606
+ static VALUE \
2607
+ gl_Color##_type_##v(argc,argv,obj) \
2608
+ int argc; \
2609
+ VALUE *argv; \
2610
+ VALUE obj; \
2611
+ { \
2612
+ int num; \
2613
+ VALUE args[4]; \
2614
+ VALUE ary; \
2615
+ switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
2616
+ case 1: \
2617
+ ary = rb_convert_type(args[0], T_ARRAY, "Array", "to_a"); \
2618
+ switch (RARRAY_LEN(ary)) { \
2619
+ case 3: \
2620
+ gl_Color3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
2621
+ break; \
2622
+ case 4: \
2623
+ gl_Color4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
2624
+ break; \
2625
+ default: \
2626
+ rb_raise(rb_eArgError, "array length:%li", RARRAY_LEN(ary)); \
2627
+ } \
2628
+ break; \
2629
+ case 3: \
2630
+ gl_Color3##_type_(obj,args[0], args[1], args[2]); \
2631
+ break; \
2632
+ case 4: \
2633
+ gl_Color4##_type_(obj,args[0], args[1], args[2], args[3]); \
2634
+ break; \
2635
+ default: \
2636
+ rb_raise(rb_eArgError, "arg length:%d", num); \
2637
+ } \
2638
+ return Qnil; \
2639
+ }
2640
+
2641
+ GLCOLOR_VFUNC(b)
2642
+ GLCOLOR_VFUNC(d)
2643
+ GLCOLOR_VFUNC(f)
2644
+ GLCOLOR_VFUNC(i)
2645
+ GLCOLOR_VFUNC(s)
2646
+ GLCOLOR_VFUNC(ub)
2647
+ GLCOLOR_VFUNC(ui)
2648
+ GLCOLOR_VFUNC(us)
2649
+ #undef GLCOLOR_VFUNC
2650
+
2651
+ #define GLNORMAL_VFUNC(_type_) \
2652
+ static VALUE \
2653
+ gl_Normal##_type_##v(argc,argv,obj) \
2654
+ int argc; \
2655
+ VALUE *argv; \
2656
+ VALUE obj; \
2657
+ { \
2658
+ int num; \
2659
+ VALUE args[3]; \
2660
+ VALUE ary; \
2661
+ switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \
2662
+ case 1: \
2663
+ ary = rb_convert_type(args[0], T_ARRAY, "Array", "to_a"); \
2664
+ switch (RARRAY_LEN(ary)) { \
2665
+ case 3: \
2666
+ gl_Normal3##_type_(obj,RARRAY_PTR(ary)[0], RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
2667
+ break; \
2668
+ default: \
2669
+ rb_raise(rb_eArgError, "array length: %li", RARRAY_LEN(ary)); \
2670
+ } \
2671
+ break; \
2672
+ case 3: \
2673
+ gl_Normal3##_type_(obj,args[0], args[1], args[2]); \
2674
+ break; \
2675
+ default: \
2676
+ rb_raise(rb_eArgError, "arg length:%d",num); \
2677
+ } \
2678
+ return Qnil; \
2679
+ }
2680
+
2681
+ GLNORMAL_VFUNC(b)
2682
+ GLNORMAL_VFUNC(d)
2683
+ GLNORMAL_VFUNC(f)
2684
+ GLNORMAL_VFUNC(i)
2685
+ GLNORMAL_VFUNC(s)
2686
+ #undef GLNORMAL_VFUNC
2687
+
2688
+ #define GLRASTERPOS_VFUNC(_type_) \
2689
+ static VALUE \
2690
+ gl_RasterPos##_type_##v(argc,argv,obj) \
2691
+ int argc; \
2692
+ VALUE *argv; \
2693
+ VALUE obj; \
2694
+ { \
2695
+ int num; \
2696
+ VALUE args[4]; \
2697
+ VALUE ary; \
2698
+ switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
2699
+ case 1: \
2700
+ ary = rb_convert_type(args[0], T_ARRAY, "Array", "to_a"); \
2701
+ switch (RARRAY_LEN(ary)) { \
2702
+ case 2: \
2703
+ gl_RasterPos2##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
2704
+ break; \
2705
+ case 3: \
2706
+ gl_RasterPos3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
2707
+ break; \
2708
+ case 4: \
2709
+ gl_RasterPos4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
2710
+ break; \
2711
+ default: \
2712
+ rb_raise(rb_eArgError, "array length:%d", num); \
2713
+ } \
2714
+ break; \
2715
+ case 2: \
2716
+ gl_RasterPos2##_type_(obj,args[0], args[1]); \
2717
+ break; \
2718
+ case 3: \
2719
+ gl_RasterPos3##_type_(obj,args[0], args[1], args[2]); \
2720
+ break; \
2721
+ case 4: \
2722
+ gl_RasterPos4##_type_(obj,args[0], args[1], args[2], args[3]); \
2723
+ break; \
2724
+ default: \
2725
+ rb_raise(rb_eArgError, "too many arguments"); \
2726
+ } \
2727
+ return Qnil; \
2728
+ }
2729
+
2730
+ GLRASTERPOS_VFUNC(d)
2731
+ GLRASTERPOS_VFUNC(f)
2732
+ GLRASTERPOS_VFUNC(i)
2733
+ GLRASTERPOS_VFUNC(s)
2734
+ #undef GLRASTERPOS_VFUNC
2735
+
2736
+ #define GLRECT_VFUNC(_type_) \
2737
+ static VALUE \
2738
+ gl_Rect##_type_##v(argc,argv,obj) \
2739
+ int argc; \
2740
+ VALUE *argv; \
2741
+ VALUE obj; \
2742
+ { \
2743
+ int num; \
2744
+ VALUE args[4]; \
2745
+ VALUE ary1, ary2; \
2746
+ switch (num = rb_scan_args(argc, argv, "22", &args[0], &args[1], &args[2], &args[3])) { \
2747
+ case 2: \
2748
+ ary1 = rb_convert_type(args[0], T_ARRAY, "Array", "to_a"); \
2749
+ ary2 = rb_convert_type(args[1], T_ARRAY, "Array", "to_a"); \
2750
+ if (RARRAY_LEN(ary1) != 2) \
2751
+ rb_raise(rb_eArgError, "first array must be of length 2 (was %li)", \
2752
+ RARRAY_LEN(ary1)); \
2753
+ \
2754
+ if (RARRAY_LEN(ary2) != 2) \
2755
+ rb_raise(rb_eArgError, "second array must be of length 2 (was %li)", \
2756
+ RARRAY_LEN(ary2)); \
2757
+ \
2758
+ gl_Rect##_type_(obj, \
2759
+ RARRAY_PTR(ary1)[0], RARRAY_PTR(ary1)[1], \
2760
+ RARRAY_PTR(ary2)[0], RARRAY_PTR(ary2)[1]); \
2761
+ break; \
2762
+ case 4: \
2763
+ gl_Rect##_type_(obj,args[0], args[1], args[2], args[3]); \
2764
+ break; \
2765
+ default: \
2766
+ rb_raise(rb_eArgError, "arg length: %d", num); \
2767
+ } \
2768
+ return Qnil; \
2769
+ }
2770
+
2771
+ GLRECT_VFUNC(d)
2772
+ GLRECT_VFUNC(f)
2773
+ GLRECT_VFUNC(i)
2774
+ GLRECT_VFUNC(s)
2775
+ #undef GLRECT_VFUNC
2776
+
2777
+ #define GLTEXCOORD_VFUNC(_type_) \
2778
+ static VALUE \
2779
+ gl_TexCoord##_type_##v(argc,argv,obj) \
2780
+ int argc; \
2781
+ VALUE *argv; \
2782
+ VALUE obj; \
2783
+ { \
2784
+ int num; \
2785
+ VALUE args[4]; \
2786
+ VALUE ary; \
2787
+ switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
2788
+ case 1: \
2789
+ ary = rb_convert_type(args[0], T_ARRAY, "Array", "to_a"); \
2790
+ switch (RARRAY_LEN(ary)) { \
2791
+ case 1: \
2792
+ gl_TexCoord1##_type_(obj,RARRAY_PTR(ary)[0]); \
2793
+ break; \
2794
+ case 2: \
2795
+ gl_TexCoord2##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
2796
+ break; \
2797
+ case 3: \
2798
+ gl_TexCoord3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
2799
+ break; \
2800
+ case 4: \
2801
+ gl_TexCoord4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
2802
+ break; \
2803
+ default: \
2804
+ rb_raise(rb_eArgError, "array length: %d", num); \
2805
+ } \
2806
+ break; \
2807
+ case 2: \
2808
+ gl_TexCoord2##_type_(obj,args[0], args[1]); \
2809
+ break; \
2810
+ case 3: \
2811
+ gl_TexCoord3##_type_(obj,args[0], args[1], args[2]); \
2812
+ break; \
2813
+ case 4: \
2814
+ gl_TexCoord4##_type_(obj,args[0], args[1], args[2], args[3]); \
2815
+ break; \
2816
+ default: \
2817
+ rb_raise(rb_eArgError, "too many arguments"); \
2818
+ break; \
2819
+ } \
2820
+ return Qnil; \
2821
+ }
2822
+
2823
+ GLTEXCOORD_VFUNC(d)
2824
+ GLTEXCOORD_VFUNC(f)
2825
+ GLTEXCOORD_VFUNC(i)
2826
+ GLTEXCOORD_VFUNC(s)
2827
+ #undef GLTEXCOORD_VFUNC
2828
+
2829
+ #define GLVERTEX_VFUNC(_type_) \
2830
+ static VALUE \
2831
+ gl_Vertex##_type_##v(argc,argv,obj) \
2832
+ int argc; \
2833
+ VALUE *argv; \
2834
+ VALUE obj; \
2835
+ { \
2836
+ VALUE args[4]; \
2837
+ VALUE ary; \
2838
+ switch (rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
2839
+ case 1: \
2840
+ ary = rb_convert_type(args[0], T_ARRAY, "Array", "to_a"); \
2841
+ switch (RARRAY_LEN(ary)) { \
2842
+ case 2: \
2843
+ gl_Vertex2##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
2844
+ break; \
2845
+ case 3: \
2846
+ gl_Vertex3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
2847
+ break; \
2848
+ case 4: \
2849
+ gl_Vertex4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
2850
+ break; \
2851
+ default: \
2852
+ rb_raise(rb_eRuntimeError, "glVertex vertex num error!: %ld", RARRAY_LEN(ary)); \
2853
+ } \
2854
+ break; \
2855
+ case 2: \
2856
+ gl_Vertex2##_type_(obj,args[0], args[1]); \
2857
+ break; \
2858
+ case 3: \
2859
+ gl_Vertex3##_type_(obj,args[0], args[1], args[2]); \
2860
+ break; \
2861
+ case 4: \
2862
+ gl_Vertex4##_type_(obj,args[0], args[1], args[2], args[3]); \
2863
+ break; \
2864
+ default: \
2865
+ rb_raise(rb_eArgError, "too many arguments"); \
2866
+ break; \
2867
+ } \
2868
+ return Qnil; \
2869
+ }
2870
+
2871
+ GLVERTEX_VFUNC(d)
2872
+ GLVERTEX_VFUNC(f)
2873
+ GLVERTEX_VFUNC(i)
2874
+ GLVERTEX_VFUNC(s)
2875
+ #undef GLVERTEX_VFUNC
2876
+
2877
+ /* */
2878
+
2879
+ static VALUE
2880
+ gl_LightModel(obj,arg1,arg2)
2881
+ VALUE obj,arg1,arg2;
2882
+ {
2883
+ if (TYPE(arg2) == T_ARRAY)
2884
+ gl_LightModelfv(obj,arg1,arg2);
2885
+ else
2886
+ gl_LightModelf(obj,arg1,arg2);
2887
+
2888
+ return Qnil;
2889
+ }
2890
+
2891
+ static VALUE
2892
+ gl_Material(VALUE self, VALUE face, VALUE pname, VALUE param)
2893
+ {
2894
+ VALUE ary;
2895
+
2896
+ if (RB_TYPE_P(param, T_ARRAY)) {
2897
+ gl_Materialfv(self, face, pname, param);
2898
+ } else if (rb_respond_to(param, rb_intern("to_a")) && (ary = rb_convert_type(param, T_ARRAY, "Array", "to_a"))) {
2899
+ gl_Materialfv(self, face, pname, ary);
2900
+ } else {
2901
+ gl_Materialf(self, face, pname, param);
2902
+ }
2903
+
2904
+ return Qnil;
2905
+ }
2906
+
2907
+ static VALUE
2908
+ gl_Fog(obj,arg1,arg2)
2909
+ VALUE obj,arg1,arg2;
2910
+ {
2911
+ if (TYPE(arg2) == T_ARRAY)
2912
+ gl_Fogfv(obj,arg1,arg2);
2913
+ else
2914
+ gl_Fogf(obj,arg1,arg2);
2915
+
2916
+ return Qnil;
2917
+ }
2918
+
2919
+ static VALUE
2920
+ gl_Light(obj,arg1,arg2,arg3)
2921
+ VALUE obj,arg1,arg2,arg3;
2922
+ {
2923
+ if (TYPE(arg3) == T_ARRAY)
2924
+ gl_Lightfv(obj,arg1,arg2,arg3);
2925
+ else
2926
+ gl_Lightf(obj,arg1,arg2,arg3);
2927
+
2928
+ return Qnil;
2929
+ }
2930
+
2931
+ static VALUE
2932
+ gl_TexParameter(obj,arg1,arg2,arg3)
2933
+ VALUE obj,arg1,arg2,arg3;
2934
+ {
2935
+ if (TYPE(arg3) == T_ARRAY)
2936
+ gl_TexParameterfv(obj,arg1,arg2,arg3);
2937
+ else
2938
+ gl_TexParameterf(obj,arg1,arg2,arg3);
2939
+
2940
+ return Qnil;
2941
+ }
2942
+
2943
+ static VALUE
2944
+ gl_TexEnv(obj,arg1,arg2,arg3)
2945
+ VALUE obj,arg1,arg2,arg3;
2946
+ {
2947
+ if (TYPE(arg3) == T_ARRAY)
2948
+ gl_TexEnvfv(obj,arg1,arg2,arg3);
2949
+ else
2950
+ gl_TexEnvf(obj,arg1,arg2,arg3);
2951
+
2952
+ return Qnil;
2953
+ }
2954
+
2955
+ static VALUE
2956
+ gl_TexGen(obj,arg1,arg2,arg3)
2957
+ VALUE obj,arg1,arg2,arg3;
2958
+ {
2959
+ if (TYPE(arg3) == T_ARRAY)
2960
+ gl_TexGenfv(obj,arg1,arg2,arg3);
2961
+ else
2962
+ gl_TexGenf(obj,arg1,arg2,arg3);
2963
+
2964
+ return Qnil;
2965
+ }
2966
+
2967
+ /* init */
2968
+ void gl_init_functions_1_0__1_1(VALUE klass)
2969
+ {
2970
+ /* OpenGL 1.0 functions */
2971
+ rb_define_method(klass, "glNewList", gl_NewList, 2);
2972
+ rb_define_method(klass, "glEndList", gl_EndList, 0);
2973
+ rb_define_method(klass, "glCallList", gl_CallList, 1);
2974
+ rb_define_method(klass, "glCallLists", gl_CallLists, 2);
2975
+ rb_define_method(klass, "glDeleteLists", gl_DeleteLists, 2);
2976
+ rb_define_method(klass, "glGenLists", gl_GenLists, 1);
2977
+ rb_define_method(klass, "glListBase", gl_ListBase, 1);
2978
+ rb_define_method(klass, "glBegin", gl_Begin, 1);
2979
+ rb_define_method(klass, "glBitmap", gl_Bitmap, 7);
2980
+ rb_define_method(klass, "glColor3b", gl_Color3b, 3);
2981
+ rb_define_method(klass, "glColor3d", gl_Color3d, 3);
2982
+ rb_define_method(klass, "glColor3f", gl_Color3f, 3);
2983
+ rb_define_method(klass, "glColor3i", gl_Color3i, 3);
2984
+ rb_define_method(klass, "glColor3s", gl_Color3s, 3);
2985
+ rb_define_method(klass, "glColor3ub", gl_Color3ub, 3);
2986
+ rb_define_method(klass, "glColor3ui", gl_Color3ui, 3);
2987
+ rb_define_method(klass, "glColor3us", gl_Color3us, 3);
2988
+ rb_define_method(klass, "glColor4b", gl_Color4b, 4);
2989
+ rb_define_method(klass, "glColor4d", gl_Color4d, 4);
2990
+ rb_define_method(klass, "glColor4f", gl_Color4f, 4);
2991
+ rb_define_method(klass, "glColor4i", gl_Color4i, 4);
2992
+ rb_define_method(klass, "glColor4s", gl_Color4s, 4);
2993
+ rb_define_method(klass, "glColor4ub", gl_Color4ub, 4);
2994
+ rb_define_method(klass, "glColor4ui", gl_Color4ui, 4);
2995
+ rb_define_method(klass, "glColor4us", gl_Color4us, 4);
2996
+ rb_define_method(klass, "glEdgeFlag", gl_EdgeFlag, 1);
2997
+ rb_define_method(klass, "glEdgeFlagv", gl_EdgeFlagv, 1);
2998
+ rb_define_method(klass, "glEnd", gl_End, 0);
2999
+ rb_define_method(klass, "glIndexd", gl_Indexd, 1);
3000
+ rb_define_method(klass, "glIndexdv", gl_Indexdv, 1);
3001
+ rb_define_method(klass, "glIndexf", gl_Indexf, 1);
3002
+ rb_define_method(klass, "glIndexfv", gl_Indexfv, 1);
3003
+ rb_define_method(klass, "glIndexi", gl_Indexi, 1);
3004
+ rb_define_method(klass, "glIndexiv", gl_Indexiv, 1);
3005
+ rb_define_method(klass, "glIndexs", gl_Indexs, 1);
3006
+ rb_define_method(klass, "glIndexsv", gl_Indexsv, 1);
3007
+ rb_define_method(klass, "glNormal3b", gl_Normal3b, 3);
3008
+ rb_define_method(klass, "glNormal3d", gl_Normal3d, 3);
3009
+ rb_define_method(klass, "glNormal3f", gl_Normal3f, 3);
3010
+ rb_define_method(klass, "glNormal3i", gl_Normal3i, 3);
3011
+ rb_define_method(klass, "glNormal3s", gl_Normal3s, 3);
3012
+ rb_define_method(klass, "glRasterPos2d", gl_RasterPos2d, 2);
3013
+ rb_define_method(klass, "glRasterPos2f", gl_RasterPos2f, 2);
3014
+ rb_define_method(klass, "glRasterPos2i", gl_RasterPos2i, 2);
3015
+ rb_define_method(klass, "glRasterPos2s", gl_RasterPos2s, 2);
3016
+ rb_define_method(klass, "glRasterPos3d", gl_RasterPos3d, 3);
3017
+ rb_define_method(klass, "glRasterPos3f", gl_RasterPos3f, 3);
3018
+ rb_define_method(klass, "glRasterPos3i", gl_RasterPos3i, 3);
3019
+ rb_define_method(klass, "glRasterPos3s", gl_RasterPos3s, 3);
3020
+ rb_define_method(klass, "glRasterPos4d", gl_RasterPos4d, 4);
3021
+ rb_define_method(klass, "glRasterPos4f", gl_RasterPos4f, 4);
3022
+ rb_define_method(klass, "glRasterPos4i", gl_RasterPos4i, 4);
3023
+ rb_define_method(klass, "glRasterPos4s", gl_RasterPos4s, 4);
3024
+ rb_define_method(klass, "glRectd", gl_Rectd, 4);
3025
+ rb_define_method(klass, "glRectf", gl_Rectf, 4);
3026
+ rb_define_method(klass, "glRecti", gl_Recti, 4);
3027
+ rb_define_method(klass, "glRects", gl_Rects, 4);
3028
+ rb_define_method(klass, "glTexCoord1d", gl_TexCoord1d, 1);
3029
+ rb_define_method(klass, "glTexCoord1f", gl_TexCoord1f, 1);
3030
+ rb_define_method(klass, "glTexCoord1i", gl_TexCoord1i, 1);
3031
+ rb_define_method(klass, "glTexCoord1s", gl_TexCoord1s, 1);
3032
+ rb_define_method(klass, "glTexCoord2d", gl_TexCoord2d, 2);
3033
+ rb_define_method(klass, "glTexCoord2f", gl_TexCoord2f, 2);
3034
+ rb_define_method(klass, "glTexCoord2i", gl_TexCoord2i, 2);
3035
+ rb_define_method(klass, "glTexCoord2s", gl_TexCoord2s, 2);
3036
+ rb_define_method(klass, "glTexCoord3d", gl_TexCoord3d, 3);
3037
+ rb_define_method(klass, "glTexCoord3f", gl_TexCoord3f, 3);
3038
+ rb_define_method(klass, "glTexCoord3i", gl_TexCoord3i, 3);
3039
+ rb_define_method(klass, "glTexCoord3s", gl_TexCoord3s, 3);
3040
+ rb_define_method(klass, "glTexCoord4d", gl_TexCoord4d, 4);
3041
+ rb_define_method(klass, "glTexCoord4f", gl_TexCoord4f, 4);
3042
+ rb_define_method(klass, "glTexCoord4i", gl_TexCoord4i, 4);
3043
+ rb_define_method(klass, "glTexCoord4s", gl_TexCoord4s, 4);
3044
+ rb_define_method(klass, "glVertex2d", gl_Vertex2d, 2);
3045
+ rb_define_method(klass, "glVertex2f", gl_Vertex2f, 2);
3046
+ rb_define_method(klass, "glVertex2i", gl_Vertex2i, 2);
3047
+ rb_define_method(klass, "glVertex2s", gl_Vertex2s, 2);
3048
+ rb_define_method(klass, "glVertex3d", gl_Vertex3d, 3);
3049
+ rb_define_method(klass, "glVertex3f", gl_Vertex3f, 3);
3050
+ rb_define_method(klass, "glVertex3i", gl_Vertex3i, 3);
3051
+ rb_define_method(klass, "glVertex3s", gl_Vertex3s, 3);
3052
+ rb_define_method(klass, "glVertex4d", gl_Vertex4d, 4);
3053
+ rb_define_method(klass, "glVertex4f", gl_Vertex4f, 4);
3054
+ rb_define_method(klass, "glVertex4i", gl_Vertex4i, 4);
3055
+ rb_define_method(klass, "glVertex4s", gl_Vertex4s, 4);
3056
+ rb_define_method(klass, "glClipPlane", gl_ClipPlane, 2);
3057
+ rb_define_method(klass, "glColorMaterial", gl_ColorMaterial, 2);
3058
+ rb_define_method(klass, "glCullFace", gl_CullFace, 1);
3059
+ rb_define_method(klass, "glFogf", gl_Fogf, 2);
3060
+ rb_define_method(klass, "glFogfv", gl_Fogfv, 2);
3061
+ rb_define_method(klass, "glFogi", gl_Fogi, 2);
3062
+ rb_define_method(klass, "glFogiv", gl_Fogiv, 2);
3063
+ rb_define_method(klass, "glFrontFace", gl_FrontFace, 1);
3064
+ rb_define_method(klass, "glHint", gl_Hint, 2);
3065
+ rb_define_method(klass, "glLightf", gl_Lightf, 3);
3066
+ rb_define_method(klass, "glLightfv", gl_Lightfv, 3);
3067
+ rb_define_method(klass, "glLighti", gl_Lighti, 3);
3068
+ rb_define_method(klass, "glLightiv", gl_Lightiv, 3);
3069
+ rb_define_method(klass, "glLightModelf", gl_LightModelf, 2);
3070
+ rb_define_method(klass, "glLightModelfv", gl_LightModelfv, 2);
3071
+ rb_define_method(klass, "glLightModeli", gl_LightModeli, 2);
3072
+ rb_define_method(klass, "glLightModeliv", gl_LightModeliv, 2);
3073
+ rb_define_method(klass, "glLineStipple", gl_LineStipple, 2);
3074
+ rb_define_method(klass, "glLineWidth", gl_LineWidth, 1);
3075
+ rb_define_method(klass, "glMaterialf", gl_Materialf, 3);
3076
+ rb_define_method(klass, "glMaterialfv", gl_Materialfv, 3);
3077
+ rb_define_method(klass, "glMateriali", gl_Materiali, 3);
3078
+ rb_define_method(klass, "glMaterialiv", gl_Materialiv, 3);
3079
+ rb_define_method(klass, "glPointSize", gl_PointSize, 1);
3080
+ rb_define_method(klass, "glPolygonMode", gl_PolygonMode, 2);
3081
+ rb_define_method(klass, "glPolygonStipple", gl_PolygonStipple, 1);
3082
+ rb_define_method(klass, "glScissor", gl_Scissor, 4);
3083
+ rb_define_method(klass, "glShadeModel", gl_ShadeModel, 1);
3084
+ rb_define_method(klass, "glTexParameterf", gl_TexParameterf, 3);
3085
+ rb_define_method(klass, "glTexParameterfv", gl_TexParameterfv, 3);
3086
+ rb_define_method(klass, "glTexParameteri", gl_TexParameteri, 3);
3087
+ rb_define_method(klass, "glTexParameteriv", gl_TexParameteriv, 3);
3088
+ rb_define_method(klass, "glTexImage1D", gl_TexImage1D, 8);
3089
+ rb_define_method(klass, "glTexImage2D", gl_TexImage2D, 9);
3090
+ rb_define_method(klass, "glTexEnvf", gl_TexEnvf, 3);
3091
+ rb_define_method(klass, "glTexEnvfv", gl_TexEnvfv, 3);
3092
+ rb_define_method(klass, "glTexEnvi", gl_TexEnvi, 3);
3093
+ rb_define_method(klass, "glTexEnviv", gl_TexEnviv, 3);
3094
+ rb_define_method(klass, "glTexGend", gl_TexGend, 3);
3095
+ rb_define_method(klass, "glTexGendv", gl_TexGendv, 3);
3096
+ rb_define_method(klass, "glTexGenf", gl_TexGenf, 3);
3097
+ rb_define_method(klass, "glTexGenfv", gl_TexGenfv, 3);
3098
+ rb_define_method(klass, "glTexGeni", gl_TexGeni, 3);
3099
+ rb_define_method(klass, "glTexGeniv", gl_TexGeniv, 3);
3100
+ rb_define_method(klass, "glFeedbackBuffer", gl_FeedbackBuffer, 2);
3101
+ rb_define_method(klass, "glSelectBuffer", gl_SelectBuffer, 1);
3102
+ rb_define_method(klass, "glRenderMode", gl_RenderMode, 1);
3103
+ rb_define_method(klass, "glInitNames", gl_InitNames, 0);
3104
+ rb_define_method(klass, "glLoadName", gl_LoadName, 1);
3105
+ rb_define_method(klass, "glPassThrough", gl_PassThrough, 1);
3106
+ rb_define_method(klass, "glPopName", gl_PopName, 0);
3107
+ rb_define_method(klass, "glPushName", gl_PushName, 1);
3108
+ rb_define_method(klass, "glDrawBuffer", gl_DrawBuffer, 1);
3109
+ rb_define_method(klass, "glClear", gl_Clear, 1);
3110
+ rb_define_method(klass, "glClearAccum", gl_ClearAccum, 4);
3111
+ rb_define_method(klass, "glClearIndex", gl_ClearIndex, 1);
3112
+ rb_define_method(klass, "glClearColor", gl_ClearColor, 4);
3113
+ rb_define_method(klass, "glClearStencil", gl_ClearStencil, 1);
3114
+ rb_define_method(klass, "glClearDepth", gl_ClearDepth, 1);
3115
+ rb_define_method(klass, "glStencilMask", gl_StencilMask, 1);
3116
+ rb_define_method(klass, "glColorMask", gl_ColorMask, 4);
3117
+ rb_define_method(klass, "glDepthMask", gl_DepthMask, 1);
3118
+ rb_define_method(klass, "glIndexMask", gl_IndexMask, 1);
3119
+ rb_define_method(klass, "glAccum", gl_Accum, 2);
3120
+ rb_define_method(klass, "glDisable", gl_Disable, -1);
3121
+ rb_define_method(klass, "glEnable", gl_Enable, -1);
3122
+ rb_define_method(klass, "glFinish", gl_Finish, 0);
3123
+ rb_define_method(klass, "glFlush", gl_Flush, 0);
3124
+ rb_define_method(klass, "glPopAttrib", gl_PopAttrib, 0);
3125
+ rb_define_method(klass, "glPushAttrib", gl_PushAttrib, 1);
3126
+ rb_define_method(klass, "glMap1d", gl_Map1d, 6);
3127
+ rb_define_method(klass, "glMap1f", gl_Map1f, 6);
3128
+ rb_define_method(klass, "glMap2d", gl_Map2d, 10);
3129
+ rb_define_method(klass, "glMap2f", gl_Map2f, 10);
3130
+ rb_define_method(klass, "glMapGrid1d", gl_MapGrid1d, 3);
3131
+ rb_define_method(klass, "glMapGrid1f", gl_MapGrid1f, 3);
3132
+ rb_define_method(klass, "glMapGrid2d", gl_MapGrid2d, 6);
3133
+ rb_define_method(klass, "glMapGrid2f", gl_MapGrid2f, 6);
3134
+ rb_define_method(klass, "glEvalCoord1d", gl_EvalCoord1d, 1);
3135
+ rb_define_method(klass, "glEvalCoord1dv", gl_EvalCoord1dv, 1);
3136
+ rb_define_method(klass, "glEvalCoord1f", gl_EvalCoord1f, 1);
3137
+ rb_define_method(klass, "glEvalCoord1fv", gl_EvalCoord1fv, 1);
3138
+ rb_define_method(klass, "glEvalCoord2d", gl_EvalCoord2d, 2);
3139
+ rb_define_method(klass, "glEvalCoord2dv", gl_EvalCoord2dv, 1);
3140
+ rb_define_method(klass, "glEvalCoord2f", gl_EvalCoord2f, 2);
3141
+ rb_define_method(klass, "glEvalCoord2fv", gl_EvalCoord2fv, 1);
3142
+ rb_define_method(klass, "glEvalMesh1", gl_EvalMesh1, 3);
3143
+ rb_define_method(klass, "glEvalPoint1", gl_EvalPoint1, 1);
3144
+ rb_define_method(klass, "glEvalMesh2", gl_EvalMesh2, 5);
3145
+ rb_define_method(klass, "glEvalPoint2", gl_EvalPoint2, 2);
3146
+ rb_define_method(klass, "glAlphaFunc", gl_AlphaFunc, 2);
3147
+ rb_define_method(klass, "glBlendFunc", gl_BlendFunc, 2);
3148
+ rb_define_method(klass, "glLogicOp", gl_LogicOp, 1);
3149
+ rb_define_method(klass, "glStencilFunc", gl_StencilFunc, 3);
3150
+ rb_define_method(klass, "glStencilOp", gl_StencilOp, 3);
3151
+ rb_define_method(klass, "glDepthFunc", gl_DepthFunc, 1);
3152
+ rb_define_method(klass, "glPixelZoom", gl_PixelZoom, 2);
3153
+ rb_define_method(klass, "glPixelTransferf", gl_PixelTransferf, 2);
3154
+ rb_define_method(klass, "glPixelTransferi", gl_PixelTransferi, 2);
3155
+ rb_define_method(klass, "glPixelStoref", gl_PixelStoref, 2);
3156
+ rb_define_method(klass, "glPixelStorei", gl_PixelStorei, 2);
3157
+ rb_define_method(klass, "glPixelMapfv", gl_PixelMapfv, -1);
3158
+ rb_define_method(klass, "glPixelMapuiv", gl_PixelMapuiv, -1);
3159
+ rb_define_method(klass, "glPixelMapusv", gl_PixelMapusv, -1);
3160
+ rb_define_method(klass, "glReadBuffer", gl_ReadBuffer, 1);
3161
+ rb_define_method(klass, "glCopyPixels", gl_CopyPixels, 5);
3162
+ rb_define_method(klass, "glReadPixels", gl_ReadPixels, -1);
3163
+ rb_define_method(klass, "glDrawPixels", gl_DrawPixels, 5);
3164
+ rb_define_method(klass, "glGetBooleanv", gl_GetBooleanv, 1);
3165
+ rb_define_method(klass, "glGetClipPlane", gl_GetClipPlane, 1);
3166
+ rb_define_method(klass, "glGetDoublev", gl_GetDoublev, 1);
3167
+ rb_define_method(klass, "glGetError", gl_GetError, 0);
3168
+ rb_define_method(klass, "glGetFloatv", gl_GetFloatv, 1);
3169
+ rb_define_method(klass, "glGetIntegerv", gl_GetIntegerv, 1);
3170
+ rb_define_method(klass, "glGetLightfv", gl_GetLightfv, 2);
3171
+ rb_define_method(klass, "glGetLightiv", gl_GetLightiv, 2);
3172
+ rb_define_method(klass, "glGetMapdv", gl_GetMapdv, 2);
3173
+ rb_define_method(klass, "glGetMapfv", gl_GetMapfv, 2);
3174
+ rb_define_method(klass, "glGetMapiv", gl_GetMapiv, 2);
3175
+ rb_define_method(klass, "glGetMaterialfv", gl_GetMaterialfv, 2);
3176
+ rb_define_method(klass, "glGetMaterialiv", gl_GetMaterialiv, 2);
3177
+ rb_define_method(klass, "glGetPixelMapfv", gl_GetPixelMapfv, -1);
3178
+ rb_define_method(klass, "glGetPixelMapuiv", gl_GetPixelMapuiv, -1);
3179
+ rb_define_method(klass, "glGetPixelMapusv", gl_GetPixelMapusv, -1);
3180
+ rb_define_method(klass, "glGetPolygonStipple", gl_GetPolygonStipple, -1);
3181
+ rb_define_method(klass, "glGetString", gl_GetString, 1);
3182
+ rb_define_method(klass, "glGetTexEnvfv", gl_GetTexEnvfv, 2);
3183
+ rb_define_method(klass, "glGetTexEnviv", gl_GetTexEnviv, 2);
3184
+ rb_define_method(klass, "glGetTexGendv", gl_GetTexGendv, 2);
3185
+ rb_define_method(klass, "glGetTexGenfv", gl_GetTexGenfv, 2);
3186
+ rb_define_method(klass, "glGetTexGeniv", gl_GetTexGeniv, 2);
3187
+ rb_define_method(klass, "glGetTexImage", gl_GetTexImage, -1);
3188
+ rb_define_method(klass, "glGetTexParameterfv", gl_GetTexParameterfv, 2);
3189
+ rb_define_method(klass, "glGetTexParameteriv", gl_GetTexParameteriv, 2);
3190
+ rb_define_method(klass, "glGetTexLevelParameterfv", gl_GetTexLevelParameterfv, 3);
3191
+ rb_define_method(klass, "glGetTexLevelParameteriv", gl_GetTexLevelParameteriv, 3);
3192
+ rb_define_method(klass, "glIsEnabled", gl_IsEnabled, 1);
3193
+ rb_define_method(klass, "glIsList", gl_IsList, 1);
3194
+ rb_define_method(klass, "glDepthRange", gl_DepthRange, 2);
3195
+ rb_define_method(klass, "glFrustum", gl_Frustum, 6);
3196
+ rb_define_method(klass, "glLoadIdentity", gl_LoadIdentity, 0);
3197
+ rb_define_method(klass, "glLoadMatrixf", gl_LoadMatrixf, 1);
3198
+ rb_define_method(klass, "glLoadMatrixd", gl_LoadMatrixd, 1);
3199
+ rb_define_method(klass, "glMatrixMode", gl_MatrixMode, 1);
3200
+ rb_define_method(klass, "glMultMatrixf", gl_MultMatrixf, 1);
3201
+ rb_define_method(klass, "glMultMatrixd", gl_MultMatrixd, 1);
3202
+ rb_define_method(klass, "glOrtho", gl_Ortho, 6);
3203
+ rb_define_method(klass, "glPopMatrix", gl_PopMatrix, 0);
3204
+ rb_define_method(klass, "glPushMatrix", gl_PushMatrix, 0);
3205
+ rb_define_method(klass, "glRotated", gl_Rotated, 4);
3206
+ rb_define_method(klass, "glRotatef", gl_Rotatef, 4);
3207
+ rb_define_method(klass, "glScaled", gl_Scaled, 3);
3208
+ rb_define_method(klass, "glScalef", gl_Scalef, 3);
3209
+ rb_define_method(klass, "glTranslated", gl_Translated, 3);
3210
+ rb_define_method(klass, "glTranslatef", gl_Translatef, 3);
3211
+ rb_define_method(klass, "glViewport", gl_Viewport, 4);
3212
+
3213
+ /* OpenGL 1.1 functions */
3214
+ rb_define_method(klass, "glArrayElement", gl_ArrayElement, 1);
3215
+ rb_define_method(klass, "glColorPointer", gl_ColorPointer, 4);
3216
+ rb_define_method(klass, "glDisableClientState", gl_DisableClientState, -1);
3217
+ rb_define_method(klass, "glDrawArrays", gl_DrawArrays, 3);
3218
+ rb_define_method(klass, "glDrawElements", gl_DrawElements, 4);
3219
+ rb_define_method(klass, "glEdgeFlagPointer", gl_EdgeFlagPointer, 2);
3220
+ rb_define_method(klass, "glEnableClientState", gl_EnableClientState, -1);
3221
+ rb_define_method(klass, "glGetPointerv", gl_GetPointerv, 1);
3222
+ rb_define_method(klass, "glIndexPointer", gl_IndexPointer, 3);
3223
+ rb_define_method(klass, "glInterleavedArrays", gl_InterleavedArrays, 3);
3224
+ rb_define_method(klass, "glNormalPointer", gl_NormalPointer, 3);
3225
+ rb_define_method(klass, "glTexCoordPointer", gl_TexCoordPointer, 4);
3226
+ rb_define_method(klass, "glVertexPointer", gl_VertexPointer, 4);
3227
+ rb_define_method(klass, "glPolygonOffset", gl_PolygonOffset, 2);
3228
+ rb_define_method(klass, "glCopyTexImage1D", gl_CopyTexImage1D, 7);
3229
+ rb_define_method(klass, "glCopyTexImage2D", gl_CopyTexImage2D, 8);
3230
+ rb_define_method(klass, "glCopyTexSubImage1D", gl_CopyTexSubImage1D, 6);
3231
+ rb_define_method(klass, "glCopyTexSubImage2D", gl_CopyTexSubImage2D, 8);
3232
+ rb_define_method(klass, "glTexSubImage1D", gl_TexSubImage1D, 7);
3233
+ rb_define_method(klass, "glTexSubImage2D", gl_TexSubImage2D, 9);
3234
+ rb_define_method(klass, "glAreTexturesResident", gl_AreTexturesResident, 1);
3235
+ rb_define_method(klass, "glBindTexture", gl_BindTexture, 2);
3236
+ rb_define_method(klass, "glDeleteTextures", gl_DeleteTextures, 1);
3237
+ rb_define_method(klass, "glGenTextures", gl_GenTextures, 1);
3238
+ rb_define_method(klass, "glIsTexture", gl_IsTexture, 1);
3239
+ rb_define_method(klass, "glPrioritizeTextures", gl_PrioritizeTextures, 2);
3240
+ rb_define_method(klass, "glIndexub", gl_Indexub, 1);
3241
+ rb_define_method(klass, "glIndexubv", gl_Indexubv, 1);
3242
+ rb_define_method(klass, "glPopClientAttrib", gl_PopClientAttrib, 0);
3243
+ rb_define_method(klass, "glPushClientAttrib", gl_PushClientAttrib, 1);
3244
+
3245
+ /* additional functions */
3246
+ rb_define_method(klass, "glColor", gl_Colordv, -1);
3247
+ rb_define_method(klass, "glColor3bv", gl_Colorbv, -1);
3248
+ rb_define_method(klass, "glColor3dv", gl_Colordv, -1);
3249
+ rb_define_method(klass, "glColor3fv", gl_Colorfv, -1);
3250
+ rb_define_method(klass, "glColor3iv", gl_Coloriv, -1);
3251
+ rb_define_method(klass, "glColor3sv", gl_Colorsv, -1);
3252
+ rb_define_method(klass, "glColor3ubv", gl_Colorubv, -1);
3253
+ rb_define_method(klass, "glColor3uiv", gl_Coloruiv, -1);
3254
+ rb_define_method(klass, "glColor3usv", gl_Colorusv, -1);
3255
+ rb_define_method(klass, "glColor4bv", gl_Colorbv, -1);
3256
+ rb_define_method(klass, "glColor4dv", gl_Colordv, -1);
3257
+ rb_define_method(klass, "glColor4fv", gl_Colorfv, -1);
3258
+ rb_define_method(klass, "glColor4iv", gl_Coloriv, -1);
3259
+ rb_define_method(klass, "glColor4sv", gl_Colorsv, -1);
3260
+ rb_define_method(klass, "glColor4ubv", gl_Colorubv, -1);
3261
+ rb_define_method(klass, "glColor4uiv", gl_Coloruiv, -1);
3262
+ rb_define_method(klass, "glColor4usv", gl_Colorusv, -1);
3263
+
3264
+ rb_define_method(klass, "glNormal", gl_Normaldv, -1);
3265
+ rb_define_method(klass, "glNormal3bv", gl_Normalbv, -1);
3266
+ rb_define_method(klass, "glNormal3dv", gl_Normaldv, -1);
3267
+ rb_define_method(klass, "glNormal3fv", gl_Normalfv, -1);
3268
+ rb_define_method(klass, "glNormal3iv", gl_Normaliv, -1);
3269
+ rb_define_method(klass, "glNormal3sv", gl_Normalsv, -1);
3270
+
3271
+ rb_define_method(klass, "glRasterPos", gl_RasterPosdv, -1);
3272
+ rb_define_method(klass, "glRasterPos2dv", gl_RasterPosdv, -1);
3273
+ rb_define_method(klass, "glRasterPos2fv", gl_RasterPosfv, -1);
3274
+ rb_define_method(klass, "glRasterPos2iv", gl_RasterPosiv, -1);
3275
+ rb_define_method(klass, "glRasterPos2sv", gl_RasterPossv, -1);
3276
+ rb_define_method(klass, "glRasterPos3dv", gl_RasterPosdv, -1);
3277
+ rb_define_method(klass, "glRasterPos3fv", gl_RasterPosfv, -1);
3278
+ rb_define_method(klass, "glRasterPos3iv", gl_RasterPosiv, -1);
3279
+ rb_define_method(klass, "glRasterPos3sv", gl_RasterPossv, -1);
3280
+ rb_define_method(klass, "glRasterPos4dv", gl_RasterPosdv, -1);
3281
+ rb_define_method(klass, "glRasterPos4fv", gl_RasterPosfv, -1);
3282
+ rb_define_method(klass, "glRasterPos4iv", gl_RasterPosiv, -1);
3283
+ rb_define_method(klass, "glRasterPos4sv", gl_RasterPossv, -1);
3284
+
3285
+ rb_define_method(klass, "glRect", gl_Rectdv, -1);
3286
+ rb_define_method(klass, "glRectdv", gl_Rectdv, -1);
3287
+ rb_define_method(klass, "glRectfv", gl_Rectfv, -1);
3288
+ rb_define_method(klass, "glRectiv", gl_Rectiv, -1);
3289
+ rb_define_method(klass, "glRectsv", gl_Rectsv, -1);
3290
+
3291
+ rb_define_method(klass, "glTexCoord", gl_TexCoorddv, -1);
3292
+ rb_define_method(klass, "glTexCoord1dv", gl_TexCoorddv, -1);
3293
+ rb_define_method(klass, "glTexCoord1fv", gl_TexCoordfv, -1);
3294
+ rb_define_method(klass, "glTexCoord1iv", gl_TexCoordiv, -1);
3295
+ rb_define_method(klass, "glTexCoord1sv", gl_TexCoordsv, -1);
3296
+ rb_define_method(klass, "glTexCoord2dv", gl_TexCoorddv, -1);
3297
+ rb_define_method(klass, "glTexCoord2fv", gl_TexCoordfv, -1);
3298
+ rb_define_method(klass, "glTexCoord2iv", gl_TexCoordiv, -1);
3299
+ rb_define_method(klass, "glTexCoord2sv", gl_TexCoordsv, -1);
3300
+ rb_define_method(klass, "glTexCoord3dv", gl_TexCoorddv, -1);
3301
+ rb_define_method(klass, "glTexCoord3fv", gl_TexCoordfv, -1);
3302
+ rb_define_method(klass, "glTexCoord3iv", gl_TexCoordiv, -1);
3303
+ rb_define_method(klass, "glTexCoord3sv", gl_TexCoordsv, -1);
3304
+ rb_define_method(klass, "glTexCoord4dv", gl_TexCoorddv, -1);
3305
+ rb_define_method(klass, "glTexCoord4fv", gl_TexCoordfv, -1);
3306
+ rb_define_method(klass, "glTexCoord4iv", gl_TexCoordiv, -1);
3307
+ rb_define_method(klass, "glTexCoord4sv", gl_TexCoordsv, -1);
3308
+
3309
+ rb_define_method(klass, "glVertex", gl_Vertexdv, -1);
3310
+ rb_define_method(klass, "glVertex2dv", gl_Vertexdv, -1);
3311
+ rb_define_method(klass, "glVertex2fv", gl_Vertexfv, -1);
3312
+ rb_define_method(klass, "glVertex2iv", gl_Vertexiv, -1);
3313
+ rb_define_method(klass, "glVertex2sv", gl_Vertexsv, -1);
3314
+ rb_define_method(klass, "glVertex3dv", gl_Vertexdv, -1);
3315
+ rb_define_method(klass, "glVertex3fv", gl_Vertexfv, -1);
3316
+ rb_define_method(klass, "glVertex3iv", gl_Vertexiv, -1);
3317
+ rb_define_method(klass, "glVertex3sv", gl_Vertexsv, -1);
3318
+ rb_define_method(klass, "glVertex4dv", gl_Vertexdv, -1);
3319
+ rb_define_method(klass, "glVertex4fv", gl_Vertexfv, -1);
3320
+ rb_define_method(klass, "glVertex4iv", gl_Vertexiv, -1);
3321
+ rb_define_method(klass, "glVertex4sv", gl_Vertexsv, -1);
3322
+
3323
+ /* these simply calls normal or vector (*v) function depending on
3324
+ if array or single value is passed to them */
3325
+ rb_define_method(klass, "glLightModel", gl_LightModel, 2);
3326
+ rb_define_method(klass, "glMaterial", gl_Material, 3);
3327
+ rb_define_method(klass, "glFog", gl_Fog, 2);
3328
+ rb_define_method(klass, "glLight", gl_Light, 3);
3329
+ rb_define_method(klass, "glTexParameter", gl_TexParameter, 3);
3330
+ rb_define_method(klass, "glTexEnv", gl_TexEnv, 3);
3331
+ rb_define_method(klass, "glTexGen", gl_TexGen, 3);
3332
+
3333
+ /* aliases */
3334
+ rb_define_method(klass, "glMultMatrix", gl_MultMatrixd, 1);
3335
+ rb_define_method(klass, "glLoadMatrix", gl_LoadMatrixd, 1);
3336
+ rb_define_method(klass, "glRotate", gl_Rotated, 4);
3337
+ rb_define_method(klass, "glScale", gl_Scaled, 3);
3338
+ rb_define_method(klass, "glTranslate", gl_Translated, 3);
3339
+
3340
+ rb_define_method(klass, "glPixelStore", gl_PixelStoref, 2);
3341
+ rb_define_method(klass, "glPixelTransfer", gl_PixelTransferf, 2);
3342
+ rb_define_method(klass, "glIndex", gl_Indexi, 1);
3343
+ rb_define_method(klass, "glGetMaterial", gl_GetMaterialfv, 2);
3344
+ rb_define_method(klass, "glGetDouble", gl_GetDoublev, 1);
3345
+ }