opengl 0.7.0.pre1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +8 -0
- data/History.txt +36 -0
- data/MIT-LICENSE +18 -0
- data/Manifest.txt +140 -0
- data/README.rdoc +51 -0
- data/Rakefile +129 -0
- data/Rakefile.cross +104 -0
- data/doc/build_install.txt +119 -0
- data/doc/extensions.txt.in +348 -0
- data/doc/history.txt +66 -0
- data/doc/requirements_and_design.txt +117 -0
- data/doc/roadmap.txt +28 -0
- data/doc/scientific_use.txt +35 -0
- data/doc/supplies/page_template.html +71 -0
- data/doc/thanks.txt +29 -0
- data/doc/tutorial.txt +469 -0
- data/examples/NeHe/nehe_lesson02.rb +117 -0
- data/examples/NeHe/nehe_lesson03.rb +122 -0
- data/examples/NeHe/nehe_lesson04.rb +133 -0
- data/examples/NeHe/nehe_lesson05.rb +186 -0
- data/examples/NeHe/nehe_lesson36.rb +303 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +376 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +406 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +16 -0
- data/examples/RedBook/aapoly.rb +142 -0
- data/examples/RedBook/aargb.rb +119 -0
- data/examples/RedBook/accanti.rb +162 -0
- data/examples/RedBook/accpersp.rb +215 -0
- data/examples/RedBook/alpha.rb +123 -0
- data/examples/RedBook/alpha3D.rb +158 -0
- data/examples/RedBook/bezcurve.rb +105 -0
- data/examples/RedBook/bezmesh.rb +137 -0
- data/examples/RedBook/checker.rb +124 -0
- data/examples/RedBook/clip.rb +95 -0
- data/examples/RedBook/colormat.rb +135 -0
- data/examples/RedBook/cube.rb +69 -0
- data/examples/RedBook/depthcue.rb +99 -0
- data/examples/RedBook/dof.rb +205 -0
- data/examples/RedBook/double.rb +105 -0
- data/examples/RedBook/drawf.rb +91 -0
- data/examples/RedBook/feedback.rb +145 -0
- data/examples/RedBook/fog.rb +167 -0
- data/examples/RedBook/font.rb +151 -0
- data/examples/RedBook/hello.rb +79 -0
- data/examples/RedBook/image.rb +137 -0
- data/examples/RedBook/jitter.rb +207 -0
- data/examples/RedBook/lines.rb +128 -0
- data/examples/RedBook/list.rb +111 -0
- data/examples/RedBook/material.rb +275 -0
- data/examples/RedBook/mipmap.rb +156 -0
- data/examples/RedBook/model.rb +113 -0
- data/examples/RedBook/movelight.rb +132 -0
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/RedBook/planet.rb +108 -0
- data/examples/RedBook/quadric.rb +158 -0
- data/examples/RedBook/robot.rb +115 -0
- data/examples/RedBook/select.rb +196 -0
- data/examples/RedBook/smooth.rb +95 -0
- data/examples/RedBook/stencil.rb +163 -0
- data/examples/RedBook/stroke.rb +167 -0
- data/examples/RedBook/surface.rb +166 -0
- data/examples/RedBook/teaambient.rb +132 -0
- data/examples/RedBook/teapots.rb +182 -0
- data/examples/RedBook/tess.rb +183 -0
- data/examples/RedBook/texbind.rb +147 -0
- data/examples/RedBook/texgen.rb +169 -0
- data/examples/RedBook/texturesurf.rb +128 -0
- data/examples/RedBook/varray.rb +159 -0
- data/examples/RedBook/wrap.rb +148 -0
- data/examples/misc/OGLBench.rb +337 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/fbo_test.rb +356 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/misc/glfwtest.rb +30 -0
- data/examples/misc/plane.rb +161 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/misc/sdltest.rb +34 -0
- data/examples/misc/trislam.rb +828 -0
- data/ext/common/common.h +448 -0
- data/ext/common/conv.h +234 -0
- data/ext/common/funcdef.h +280 -0
- data/ext/common/gl-enums.h +10031 -0
- data/ext/common/gl-error.h +23 -0
- data/ext/common/gl-types.h +67 -0
- data/ext/common/glu-enums.h +463 -0
- data/ext/gl/extconf.rb +43 -0
- data/ext/gl/gl-1.0-1.1.c +2811 -0
- data/ext/gl/gl-1.2.c +814 -0
- data/ext/gl/gl-1.3.c +443 -0
- data/ext/gl/gl-1.4.c +348 -0
- data/ext/gl/gl-1.5.c +225 -0
- data/ext/gl/gl-2.0.c +657 -0
- data/ext/gl/gl-2.1.c +57 -0
- data/ext/gl/gl-enums.c +3354 -0
- data/ext/gl/gl-error.c +104 -0
- data/ext/gl/gl-ext-3dfx.c +27 -0
- data/ext/gl/gl-ext-arb.c +866 -0
- data/ext/gl/gl-ext-ati.c +41 -0
- data/ext/gl/gl-ext-ext.c +889 -0
- data/ext/gl/gl-ext-gremedy.c +41 -0
- data/ext/gl/gl-ext-nv.c +679 -0
- data/ext/gl/gl.c +216 -0
- data/ext/glu/extconf.rb +51 -0
- data/ext/glu/glu-enums.c +164 -0
- data/ext/glu/glu.c +1530 -0
- data/ext/glut/extconf.rb +67 -0
- data/ext/glut/glut.c +1624 -0
- data/lib/opengl.rb +89 -0
- data/test/README +10 -0
- data/test/tc_common.rb +98 -0
- data/test/tc_ext_arb.rb +467 -0
- data/test/tc_ext_ati.rb +33 -0
- data/test/tc_ext_ext.rb +551 -0
- data/test/tc_ext_gremedy.rb +36 -0
- data/test/tc_ext_nv.rb +357 -0
- data/test/tc_func_10_11.rb +1281 -0
- data/test/tc_func_12.rb +186 -0
- data/test/tc_func_13.rb +229 -0
- data/test/tc_func_14.rb +197 -0
- data/test/tc_func_15.rb +270 -0
- data/test/tc_func_20.rb +346 -0
- data/test/tc_func_21.rb +541 -0
- data/test/tc_glu.rb +310 -0
- data/test/tc_include_gl.rb +35 -0
- data/test/tc_misc.rb +54 -0
- data/test/tc_require_gl.rb +34 -0
- data/utils/README +11 -0
- data/utils/enumgen.rb +112 -0
- data/utils/extlistgen.rb +90 -0
- data/utils/mkdn2html.rb +59 -0
- data/utils/post-mkdn2html.rb +91 -0
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +198 -0
- metadata +274 -0
data/ext/gl/extconf.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
def have_framework(fw, &b)
|
4
|
+
checking_for fw do
|
5
|
+
src = cpp_include("#{fw}/#{fw}.h") << "\n" "int main(void){return 0;}"
|
6
|
+
if try_link(src, opt = "-ObjC -framework #{fw}", &b)
|
7
|
+
$defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
|
8
|
+
$LDFLAGS << " " << opt
|
9
|
+
true
|
10
|
+
else
|
11
|
+
false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end unless respond_to? :have_framework
|
15
|
+
|
16
|
+
ok =
|
17
|
+
have_library('opengl32.lib') ||
|
18
|
+
have_library('opengl32') ||
|
19
|
+
have_library('GL', 'glVertex3d') ||
|
20
|
+
have_framework('OpenGL')
|
21
|
+
|
22
|
+
ok &&=
|
23
|
+
have_header('GL/gl.h') ||
|
24
|
+
have_header('OpenGL/gl.h') # OS X
|
25
|
+
|
26
|
+
have_header 'GL/glx.h' # *NIX only?
|
27
|
+
have_header 'dlfcn.h' # OS X dynamic loader
|
28
|
+
have_header 'windows.h'
|
29
|
+
|
30
|
+
have_header 'stdint.h'
|
31
|
+
have_header 'inttypes.h'
|
32
|
+
|
33
|
+
have_func 'wglGetProcAddress', 'wingdi.h' # Windows extension loader
|
34
|
+
|
35
|
+
have_struct_member 'struct RFloat', 'float_value'
|
36
|
+
|
37
|
+
have_type 'int64_t', 'stdint.h'
|
38
|
+
have_type 'uint64_t', 'stdint.h'
|
39
|
+
|
40
|
+
if ok then
|
41
|
+
create_header
|
42
|
+
create_makefile 'gl'
|
43
|
+
end
|
data/ext/gl/gl-1.0-1.1.c
ADDED
@@ -0,0 +1,2811 @@
|
|
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/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_1(Disable,GLvoid, GLenum)
|
67
|
+
GL_FUNC_STATIC_1(DisableClientState,GLvoid, GLenum)
|
68
|
+
GL_FUNC_STATIC_3(DrawArrays,GLvoid, GLenum,GLint,GLsizei)
|
69
|
+
GL_FUNC_STATIC_1(DrawBuffer,GLvoid, GLenum)
|
70
|
+
GL_FUNC_STATIC_1(EdgeFlag,GLvoid, GLboolean)
|
71
|
+
GL_FUNC_STATIC_1(Enable,GLvoid, GLenum)
|
72
|
+
GL_FUNC_STATIC_1(EnableClientState,GLvoid, GLenum)
|
73
|
+
GL_FUNC_STATIC_0(EndList,GLvoid)
|
74
|
+
GL_FUNC_STATIC_1(EvalCoord1d,GLvoid, GLdouble)
|
75
|
+
GL_FUNC_STATIC_1(EvalCoord1f,GLvoid, GLfloat)
|
76
|
+
GL_FUNC_STATIC_2(EvalCoord2d,GLvoid, GLdouble,GLdouble)
|
77
|
+
GL_FUNC_STATIC_2(EvalCoord2f,GLvoid, GLfloat,GLfloat)
|
78
|
+
GL_FUNC_STATIC_3(EvalMesh1,GLvoid, GLenum,GLint,GLint)
|
79
|
+
GL_FUNC_STATIC_5(EvalMesh2,GLvoid, GLenum,GLint,GLint,GLint,GLint)
|
80
|
+
GL_FUNC_STATIC_1(EvalPoint1,GLvoid, GLint)
|
81
|
+
GL_FUNC_STATIC_2(EvalPoint2,GLvoid, GLint,GLint)
|
82
|
+
GL_FUNC_STATIC_0(Finish,GLvoid)
|
83
|
+
GL_FUNC_STATIC_0(Flush,GLvoid)
|
84
|
+
GL_FUNC_STATIC_2(Fogi,GLvoid, GLenum,GLint)
|
85
|
+
GL_FUNC_STATIC_2(Fogf,GLvoid, GLenum,GLfloat)
|
86
|
+
GL_FUNC_STATIC_1(FrontFace,GLvoid, GLenum)
|
87
|
+
GL_FUNC_STATIC_6(Frustum,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble)
|
88
|
+
GL_FUNC_STATIC_1(GenLists,GLuint, GLsizei)
|
89
|
+
GL_FUNC_STATIC_0(GetError,GLenum)
|
90
|
+
GL_FUNC_STATIC_2(Hint,GLvoid, GLenum,GLenum)
|
91
|
+
GL_FUNC_STATIC_1(Indexd,GLvoid, GLdouble)
|
92
|
+
GL_FUNC_STATIC_1(Indexf,GLvoid, GLfloat)
|
93
|
+
GL_FUNC_STATIC_1(Indexi,GLvoid, GLint)
|
94
|
+
GL_FUNC_STATIC_1(IndexMask,GLvoid, GLuint)
|
95
|
+
GL_FUNC_STATIC_1(Indexs,GLvoid, GLshort)
|
96
|
+
GL_FUNC_STATIC_1(Indexub,GLvoid, GLubyte)
|
97
|
+
GL_FUNC_STATIC_0(InitNames,GLvoid)
|
98
|
+
GL_FUNC_STATIC_1(IsEnabled,GLboolean, GLenum)
|
99
|
+
GL_FUNC_STATIC_1(IsList,GLboolean, GLuint)
|
100
|
+
GL_FUNC_STATIC_1(IsTexture,GLboolean, GLuint)
|
101
|
+
GL_FUNC_STATIC_2(LightModelf,GLvoid, GLenum,GLfloat)
|
102
|
+
GL_FUNC_STATIC_2(LightModeli,GLvoid, GLenum,GLint)
|
103
|
+
GL_FUNC_STATIC_3(Lightf,GLvoid, GLenum,GLenum,GLfloat)
|
104
|
+
GL_FUNC_STATIC_3(Lighti,GLvoid, GLenum,GLenum,GLint)
|
105
|
+
GL_FUNC_STATIC_2(LineStipple,GLvoid, GLint,GLushort)
|
106
|
+
GL_FUNC_STATIC_1(LineWidth,GLvoid, GLfloat)
|
107
|
+
GL_FUNC_STATIC_1(ListBase,GLvoid, GLuint)
|
108
|
+
GL_FUNC_STATIC_0(LoadIdentity,GLvoid)
|
109
|
+
GL_FUNC_STATIC_1(LoadName,GLvoid, GLuint)
|
110
|
+
GL_FUNC_STATIC_1(LogicOp,GLvoid, GLenum)
|
111
|
+
GL_FUNC_STATIC_3(MapGrid1d,GLvoid, GLint,GLdouble,GLdouble)
|
112
|
+
GL_FUNC_STATIC_3(MapGrid1f,GLvoid, GLint,GLfloat,GLfloat)
|
113
|
+
GL_FUNC_STATIC_6(MapGrid2d,GLvoid, GLint,GLdouble,GLdouble,GLint,GLdouble,GLdouble)
|
114
|
+
GL_FUNC_STATIC_6(MapGrid2f,GLvoid, GLint,GLfloat,GLfloat,GLint,GLfloat,GLfloat)
|
115
|
+
GL_FUNC_STATIC_3(Materialf,GLvoid, GLenum,GLenum,GLfloat)
|
116
|
+
GL_FUNC_STATIC_3(Materiali,GLvoid, GLenum,GLenum,GLint)
|
117
|
+
GL_FUNC_STATIC_1(MatrixMode,GLvoid, GLenum)
|
118
|
+
GL_FUNC_STATIC_2(NewList,GLvoid, GLuint,GLenum)
|
119
|
+
GL_FUNC_STATIC_3(Normal3b,GLvoid, GLbyte,GLbyte,GLbyte)
|
120
|
+
GL_FUNC_STATIC_3(Normal3d,GLvoid, GLdouble,GLdouble,GLdouble)
|
121
|
+
GL_FUNC_STATIC_3(Normal3f,GLvoid, GLfloat,GLfloat,GLfloat)
|
122
|
+
GL_FUNC_STATIC_3(Normal3i,GLvoid, GLint,GLint,GLint)
|
123
|
+
GL_FUNC_STATIC_3(Normal3s,GLvoid, GLshort,GLshort,GLshort)
|
124
|
+
GL_FUNC_STATIC_6(Ortho,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble)
|
125
|
+
GL_FUNC_STATIC_1(PassThrough,GLvoid, GLfloat)
|
126
|
+
GL_FUNC_STATIC_2(PixelStoref,GLvoid, GLenum,GLfloat)
|
127
|
+
GL_FUNC_STATIC_2(PixelStorei,GLvoid, GLenum,GLint)
|
128
|
+
GL_FUNC_STATIC_2(PixelTransferf,GLvoid, GLenum,GLfloat)
|
129
|
+
GL_FUNC_STATIC_2(PixelTransferi,GLvoid, GLenum,GLint)
|
130
|
+
GL_FUNC_STATIC_2(PixelZoom,GLvoid, GLfloat,GLfloat)
|
131
|
+
GL_FUNC_STATIC_1(PointSize,GLvoid, GLfloat)
|
132
|
+
GL_FUNC_STATIC_2(PolygonMode,GLvoid, GLenum,GLenum)
|
133
|
+
GL_FUNC_STATIC_2(PolygonOffset,GLvoid, GLfloat,GLfloat)
|
134
|
+
GL_FUNC_STATIC_0(PopAttrib,GLvoid)
|
135
|
+
GL_FUNC_STATIC_0(PopClientAttrib,GLvoid)
|
136
|
+
GL_FUNC_STATIC_0(PopMatrix,GLvoid)
|
137
|
+
GL_FUNC_STATIC_0(PopName,GLvoid)
|
138
|
+
GL_FUNC_STATIC_1(PushAttrib,GLvoid, GLbitfield)
|
139
|
+
GL_FUNC_STATIC_1(PushClientAttrib,GLvoid, GLbitfield)
|
140
|
+
GL_FUNC_STATIC_0(PushMatrix,GLvoid)
|
141
|
+
GL_FUNC_STATIC_1(PushName,GLvoid, GLuint)
|
142
|
+
GL_FUNC_STATIC_2(RasterPos2d,GLvoid, GLdouble,GLdouble)
|
143
|
+
GL_FUNC_STATIC_2(RasterPos2f,GLvoid, GLfloat,GLfloat)
|
144
|
+
GL_FUNC_STATIC_2(RasterPos2i,GLvoid, GLint,GLint)
|
145
|
+
GL_FUNC_STATIC_2(RasterPos2s,GLvoid, GLshort,GLshort)
|
146
|
+
GL_FUNC_STATIC_3(RasterPos3d,GLvoid, GLdouble,GLdouble,GLdouble)
|
147
|
+
GL_FUNC_STATIC_3(RasterPos3f,GLvoid, GLfloat,GLfloat,GLfloat)
|
148
|
+
GL_FUNC_STATIC_3(RasterPos3i,GLvoid, GLint,GLint,GLint)
|
149
|
+
GL_FUNC_STATIC_3(RasterPos3s,GLvoid, GLshort,GLshort,GLshort)
|
150
|
+
GL_FUNC_STATIC_4(RasterPos4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
|
151
|
+
GL_FUNC_STATIC_4(RasterPos4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
|
152
|
+
GL_FUNC_STATIC_4(RasterPos4i,GLvoid, GLint,GLint,GLint,GLint)
|
153
|
+
GL_FUNC_STATIC_4(RasterPos4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
|
154
|
+
GL_FUNC_STATIC_1(ReadBuffer,GLvoid, GLenum)
|
155
|
+
GL_FUNC_STATIC_4(Rectd,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
|
156
|
+
GL_FUNC_STATIC_4(Rectf,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
|
157
|
+
GL_FUNC_STATIC_4(Recti,GLvoid, GLint,GLint,GLint,GLint)
|
158
|
+
GL_FUNC_STATIC_4(Rects,GLvoid, GLshort,GLshort,GLshort,GLshort)
|
159
|
+
GL_FUNC_STATIC_1(RenderMode,GLint, GLenum)
|
160
|
+
GL_FUNC_STATIC_4(Rotated,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
|
161
|
+
GL_FUNC_STATIC_4(Rotatef,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
|
162
|
+
GL_FUNC_STATIC_3(Scaled,GLvoid, GLdouble,GLdouble,GLdouble)
|
163
|
+
GL_FUNC_STATIC_3(Scalef,GLvoid, GLfloat,GLfloat,GLfloat)
|
164
|
+
GL_FUNC_STATIC_4(Scissor,GLvoid, GLint,GLint,GLint,GLint)
|
165
|
+
GL_FUNC_STATIC_1(ShadeModel,GLvoid, GLenum)
|
166
|
+
GL_FUNC_STATIC_3(StencilFunc,GLvoid, GLenum,GLint,GLuint)
|
167
|
+
GL_FUNC_STATIC_1(StencilMask,GLvoid, GLuint)
|
168
|
+
GL_FUNC_STATIC_3(StencilOp,GLvoid, GLenum,GLenum,GLenum)
|
169
|
+
GL_FUNC_STATIC_1(TexCoord1d,GLvoid, GLdouble)
|
170
|
+
GL_FUNC_STATIC_1(TexCoord1f,GLvoid, GLfloat)
|
171
|
+
GL_FUNC_STATIC_1(TexCoord1i,GLvoid, GLint)
|
172
|
+
GL_FUNC_STATIC_1(TexCoord1s,GLvoid, GLshort)
|
173
|
+
GL_FUNC_STATIC_2(TexCoord2d,GLvoid, GLdouble,GLdouble)
|
174
|
+
GL_FUNC_STATIC_2(TexCoord2f,GLvoid, GLfloat,GLfloat)
|
175
|
+
GL_FUNC_STATIC_2(TexCoord2i,GLvoid, GLint,GLint)
|
176
|
+
GL_FUNC_STATIC_2(TexCoord2s,GLvoid, GLshort,GLshort)
|
177
|
+
GL_FUNC_STATIC_3(TexCoord3d,GLvoid, GLdouble,GLdouble,GLdouble)
|
178
|
+
GL_FUNC_STATIC_3(TexCoord3f,GLvoid, GLfloat,GLfloat,GLfloat)
|
179
|
+
GL_FUNC_STATIC_3(TexCoord3i,GLvoid, GLint,GLint,GLint)
|
180
|
+
GL_FUNC_STATIC_3(TexCoord3s,GLvoid, GLshort,GLshort,GLshort)
|
181
|
+
GL_FUNC_STATIC_4(TexCoord4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
|
182
|
+
GL_FUNC_STATIC_4(TexCoord4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
|
183
|
+
GL_FUNC_STATIC_4(TexCoord4i,GLvoid, GLint,GLint,GLint,GLint)
|
184
|
+
GL_FUNC_STATIC_4(TexCoord4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
|
185
|
+
GL_FUNC_STATIC_3(TexEnvf,GLvoid, GLenum,GLenum,GLfloat)
|
186
|
+
GL_FUNC_STATIC_3(TexEnvi,GLvoid, GLenum,GLenum,GLint)
|
187
|
+
GL_FUNC_STATIC_3(TexGend,GLvoid, GLenum,GLenum,GLdouble)
|
188
|
+
GL_FUNC_STATIC_3(TexGenf,GLvoid, GLenum,GLenum,GLfloat)
|
189
|
+
GL_FUNC_STATIC_3(TexGeni,GLvoid, GLenum,GLenum,GLint)
|
190
|
+
GL_FUNC_STATIC_3(TexParameterf,GLvoid, GLenum,GLenum,GLfloat)
|
191
|
+
GL_FUNC_STATIC_3(TexParameteri,GLvoid, GLenum,GLenum,GLint)
|
192
|
+
GL_FUNC_STATIC_3(Translated,GLvoid, GLdouble,GLdouble,GLdouble)
|
193
|
+
GL_FUNC_STATIC_3(Translatef,GLvoid, GLfloat,GLfloat,GLfloat)
|
194
|
+
GL_FUNC_STATIC_2(Vertex2d,GLvoid, GLdouble,GLdouble)
|
195
|
+
GL_FUNC_STATIC_2(Vertex2f,GLvoid, GLfloat,GLfloat)
|
196
|
+
GL_FUNC_STATIC_2(Vertex2i,GLvoid, GLint,GLint)
|
197
|
+
GL_FUNC_STATIC_2(Vertex2s,GLvoid, GLshort,GLshort)
|
198
|
+
GL_FUNC_STATIC_3(Vertex3d,GLvoid, GLdouble,GLdouble,GLdouble)
|
199
|
+
GL_FUNC_STATIC_3(Vertex3f,GLvoid, GLfloat,GLfloat,GLfloat)
|
200
|
+
GL_FUNC_STATIC_3(Vertex3i,GLvoid, GLint,GLint,GLint)
|
201
|
+
GL_FUNC_STATIC_3(Vertex3s,GLvoid, GLshort,GLshort,GLshort)
|
202
|
+
GL_FUNC_STATIC_4(Vertex4d,GLvoid, GLdouble,GLdouble,GLdouble,GLdouble)
|
203
|
+
GL_FUNC_STATIC_4(Vertex4f,GLvoid, GLfloat,GLfloat,GLfloat,GLfloat)
|
204
|
+
GL_FUNC_STATIC_4(Vertex4i,GLvoid, GLint,GLint,GLint,GLint)
|
205
|
+
GL_FUNC_STATIC_4(Vertex4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
|
206
|
+
GL_FUNC_STATIC_4(Viewport,GLvoid, GLuint,GLuint,GLuint,GLuint)
|
207
|
+
|
208
|
+
VALUE inside_begin_end = Qfalse;
|
209
|
+
|
210
|
+
static VALUE
|
211
|
+
gl_Begin(obj,arg1)
|
212
|
+
VALUE obj,arg1;
|
213
|
+
{
|
214
|
+
glBegin(CONV_GLenum(arg1));
|
215
|
+
inside_begin_end = Qtrue;
|
216
|
+
return Qnil;
|
217
|
+
}
|
218
|
+
|
219
|
+
static VALUE
|
220
|
+
gl_End(obj)
|
221
|
+
VALUE obj;
|
222
|
+
{
|
223
|
+
inside_begin_end = Qfalse;
|
224
|
+
glEnd();
|
225
|
+
CHECK_GLERROR
|
226
|
+
return Qnil;
|
227
|
+
}
|
228
|
+
|
229
|
+
static VALUE
|
230
|
+
gl_CallLists(obj,arg1,arg2)
|
231
|
+
VALUE obj,arg1,arg2;
|
232
|
+
{
|
233
|
+
GLsizei n;
|
234
|
+
GLenum type;
|
235
|
+
VALUE lists;
|
236
|
+
type = CONV_GLenum(arg1);
|
237
|
+
lists = pack_array_or_pass_string(type,arg2);
|
238
|
+
n = (GLsizei)RSTRING_LENINT(lists) / gltype_glformat_unit_size(type,1);
|
239
|
+
glCallLists(n, type, RSTRING_PTR(lists));
|
240
|
+
CHECK_GLERROR
|
241
|
+
return Qnil;
|
242
|
+
}
|
243
|
+
|
244
|
+
static VALUE
|
245
|
+
gl_Bitmap(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
246
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
247
|
+
{
|
248
|
+
GLsizei width;
|
249
|
+
GLsizei height;
|
250
|
+
GLfloat xorig;
|
251
|
+
GLfloat yorig;
|
252
|
+
GLfloat xmove;
|
253
|
+
GLfloat ymove;
|
254
|
+
width = (GLsizei)NUM2UINT(arg1);
|
255
|
+
height = (GLsizei)NUM2UINT(arg2);
|
256
|
+
xorig = (GLfloat)NUM2DBL(arg3);
|
257
|
+
yorig = (GLfloat)NUM2DBL(arg4);
|
258
|
+
xmove = (GLfloat)NUM2DBL(arg5);
|
259
|
+
ymove = (GLfloat)NUM2DBL(arg6);
|
260
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
261
|
+
glBitmap(width, height, xorig, yorig, xmove, ymove, (GLubyte *)NUM2LONG(arg7));
|
262
|
+
} else {
|
263
|
+
VALUE data;
|
264
|
+
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
|
265
|
+
|
266
|
+
if ((RSTRING_LEN(data)*8) < (width * height))
|
267
|
+
rb_raise(rb_eArgError, "string length:%li", RSTRING_LEN(data));
|
268
|
+
|
269
|
+
glBitmap(width, height, xorig, yorig, xmove, ymove, (const GLubyte *)RSTRING_PTR(data));
|
270
|
+
}
|
271
|
+
CHECK_GLERROR
|
272
|
+
return Qnil;
|
273
|
+
}
|
274
|
+
|
275
|
+
static VALUE
|
276
|
+
gl_EdgeFlagv(obj,arg1)
|
277
|
+
VALUE obj,arg1;
|
278
|
+
{
|
279
|
+
GLboolean flag[1] = { GL_FALSE };
|
280
|
+
Check_Type(arg1,T_ARRAY);
|
281
|
+
ary2cboolean(arg1,flag,1);
|
282
|
+
glEdgeFlagv(flag);
|
283
|
+
CHECK_GLERROR
|
284
|
+
return Qnil;
|
285
|
+
}
|
286
|
+
|
287
|
+
static VALUE
|
288
|
+
gl_Indexdv(obj,arg1)
|
289
|
+
VALUE obj,arg1;
|
290
|
+
{
|
291
|
+
GLdouble c[1] = {0.0};
|
292
|
+
Check_Type(arg1,T_ARRAY);
|
293
|
+
ary2cdbl(arg1,c,1);
|
294
|
+
glIndexdv(c);
|
295
|
+
CHECK_GLERROR
|
296
|
+
return Qnil;
|
297
|
+
}
|
298
|
+
|
299
|
+
static VALUE
|
300
|
+
gl_Indexfv(obj,arg1)
|
301
|
+
VALUE obj,arg1;
|
302
|
+
{
|
303
|
+
GLfloat c[1] = { (GLfloat)0.0 };
|
304
|
+
Check_Type(arg1,T_ARRAY);
|
305
|
+
ary2cflt(arg1,c,1);
|
306
|
+
glIndexfv(c);
|
307
|
+
CHECK_GLERROR
|
308
|
+
return Qnil;
|
309
|
+
}
|
310
|
+
|
311
|
+
static VALUE
|
312
|
+
gl_Indexiv(obj,arg1)
|
313
|
+
VALUE obj,arg1;
|
314
|
+
{
|
315
|
+
GLint c[1] = {0};
|
316
|
+
Check_Type(arg1,T_ARRAY);
|
317
|
+
ary2cint(arg1,c,1);
|
318
|
+
glIndexiv(c);
|
319
|
+
CHECK_GLERROR
|
320
|
+
return Qnil;
|
321
|
+
}
|
322
|
+
|
323
|
+
static VALUE
|
324
|
+
gl_Indexsv(obj,arg1)
|
325
|
+
VALUE obj,arg1;
|
326
|
+
{
|
327
|
+
GLshort c[1] = {0};
|
328
|
+
Check_Type(arg1,T_ARRAY);
|
329
|
+
ary2cshort(arg1,c,1);
|
330
|
+
glIndexsv(c);
|
331
|
+
CHECK_GLERROR
|
332
|
+
return Qnil;
|
333
|
+
}
|
334
|
+
|
335
|
+
static VALUE
|
336
|
+
gl_ClipPlane(obj,arg1,arg2)
|
337
|
+
VALUE obj,arg1,arg2;
|
338
|
+
{
|
339
|
+
GLenum plane;
|
340
|
+
GLdouble equation[4];
|
341
|
+
plane = (GLenum)NUM2INT(arg1);
|
342
|
+
Check_Type(arg2,T_ARRAY);
|
343
|
+
ary2cdbl(arg2, equation, 4);
|
344
|
+
glClipPlane(plane,equation);
|
345
|
+
CHECK_GLERROR
|
346
|
+
return Qnil;
|
347
|
+
}
|
348
|
+
|
349
|
+
static VALUE
|
350
|
+
gl_Fogfv(obj,arg1,arg2)
|
351
|
+
VALUE obj,arg1,arg2;
|
352
|
+
{
|
353
|
+
GLenum pname;
|
354
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
355
|
+
pname = (GLenum)NUM2INT(arg1);
|
356
|
+
Check_Type(arg2,T_ARRAY);
|
357
|
+
ary2cflt(arg2,params,4);
|
358
|
+
glFogfv(pname,params);
|
359
|
+
CHECK_GLERROR
|
360
|
+
return Qnil;
|
361
|
+
}
|
362
|
+
|
363
|
+
static VALUE
|
364
|
+
gl_Fogiv(obj,arg1,arg2)
|
365
|
+
VALUE obj,arg1,arg2;
|
366
|
+
{
|
367
|
+
GLenum pname;
|
368
|
+
GLint params[4] = {0,0,0,0};
|
369
|
+
pname = (GLenum)NUM2INT(arg1);
|
370
|
+
Check_Type(arg2,T_ARRAY);
|
371
|
+
ary2cint(arg2,params,4);
|
372
|
+
glFogiv(pname,params);
|
373
|
+
CHECK_GLERROR
|
374
|
+
return Qnil;
|
375
|
+
}
|
376
|
+
|
377
|
+
static VALUE
|
378
|
+
gl_Lightfv(obj,arg1,arg2,arg3)
|
379
|
+
VALUE obj,arg1,arg2,arg3;
|
380
|
+
{
|
381
|
+
GLenum light;
|
382
|
+
GLenum pname;
|
383
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
384
|
+
light = (GLenum)NUM2INT(arg1);
|
385
|
+
pname = (GLenum)NUM2INT(arg2);
|
386
|
+
Check_Type(arg3,T_ARRAY);
|
387
|
+
ary2cflt(arg3,params,4);
|
388
|
+
glLightfv(light,pname,params);
|
389
|
+
CHECK_GLERROR
|
390
|
+
return Qnil;
|
391
|
+
}
|
392
|
+
|
393
|
+
static VALUE
|
394
|
+
gl_Lightiv(obj,arg1,arg2,arg3)
|
395
|
+
VALUE obj,arg1,arg2,arg3;
|
396
|
+
{
|
397
|
+
GLenum light;
|
398
|
+
GLenum pname;
|
399
|
+
GLint params[4]={0,0,0,0};
|
400
|
+
light = (GLenum)NUM2INT(arg1);
|
401
|
+
pname = (GLenum)NUM2INT(arg2);
|
402
|
+
Check_Type(arg3,T_ARRAY);
|
403
|
+
ary2cint(arg3,params,4);
|
404
|
+
glLightiv(light,pname,params);
|
405
|
+
CHECK_GLERROR
|
406
|
+
return Qnil;
|
407
|
+
}
|
408
|
+
|
409
|
+
static VALUE
|
410
|
+
gl_LightModelfv(obj,arg1,arg2)
|
411
|
+
VALUE obj,arg1,arg2;
|
412
|
+
{
|
413
|
+
GLenum pname;
|
414
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
415
|
+
pname = (GLenum)NUM2INT(arg1);
|
416
|
+
Check_Type(arg2,T_ARRAY);
|
417
|
+
ary2cflt(arg2,params,4);
|
418
|
+
glLightModelfv(pname,params);
|
419
|
+
CHECK_GLERROR
|
420
|
+
return Qnil;
|
421
|
+
}
|
422
|
+
|
423
|
+
static VALUE
|
424
|
+
gl_LightModeliv(obj,arg1,arg2)
|
425
|
+
VALUE obj,arg1,arg2;
|
426
|
+
{
|
427
|
+
GLenum pname;
|
428
|
+
GLint params[4] = {0,0,0,0};
|
429
|
+
pname = (GLenum)NUM2INT(arg1);
|
430
|
+
Check_Type(arg2,T_ARRAY);
|
431
|
+
ary2cint(arg2,params,4);
|
432
|
+
glLightModeliv(pname,params);
|
433
|
+
CHECK_GLERROR
|
434
|
+
return Qnil;
|
435
|
+
}
|
436
|
+
|
437
|
+
|
438
|
+
static VALUE
|
439
|
+
gl_Materialfv(obj,arg1,arg2,arg3)
|
440
|
+
VALUE obj,arg1,arg2,arg3;
|
441
|
+
{
|
442
|
+
GLenum face;
|
443
|
+
GLenum pname;
|
444
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
445
|
+
face = (GLenum)NUM2INT(arg1);
|
446
|
+
pname = (GLenum)NUM2INT(arg2);
|
447
|
+
Check_Type(arg3,T_ARRAY);
|
448
|
+
ary2cflt(arg3,params,4);
|
449
|
+
glMaterialfv(face,pname,params);
|
450
|
+
CHECK_GLERROR
|
451
|
+
return Qnil;
|
452
|
+
}
|
453
|
+
|
454
|
+
static VALUE
|
455
|
+
gl_Materialiv(obj,arg1,arg2,arg3)
|
456
|
+
VALUE obj,arg1,arg2,arg3;
|
457
|
+
{
|
458
|
+
GLenum face;
|
459
|
+
GLenum pname;
|
460
|
+
GLint params[4] = {0,0,0,0};
|
461
|
+
face = (GLenum)NUM2INT(arg1);
|
462
|
+
pname = (GLenum)NUM2INT(arg2);
|
463
|
+
Check_Type(arg3,T_ARRAY);
|
464
|
+
ary2cint(arg3,params,4);
|
465
|
+
glMaterialiv(face,pname,params);
|
466
|
+
CHECK_GLERROR
|
467
|
+
return Qnil;
|
468
|
+
}
|
469
|
+
|
470
|
+
static VALUE
|
471
|
+
gl_PolygonStipple(obj,arg1)
|
472
|
+
VALUE obj,arg1;
|
473
|
+
{
|
474
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
475
|
+
glPolygonStipple((GLubyte *)NUM2LONG(arg1));
|
476
|
+
} else {
|
477
|
+
VALUE data;
|
478
|
+
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg1);
|
479
|
+
if (RSTRING_LEN(data) < 128)
|
480
|
+
rb_raise(rb_eArgError, "string length:%li", RSTRING_LEN(data));
|
481
|
+
|
482
|
+
glPolygonStipple((GLubyte *)RSTRING_PTR(data));
|
483
|
+
}
|
484
|
+
CHECK_GLERROR
|
485
|
+
return Qnil;
|
486
|
+
}
|
487
|
+
|
488
|
+
|
489
|
+
static VALUE
|
490
|
+
gl_TexParameterfv(obj,arg1,arg2,arg3)
|
491
|
+
VALUE obj,arg1,arg2,arg3;
|
492
|
+
{
|
493
|
+
GLenum target;
|
494
|
+
GLenum pname;
|
495
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
496
|
+
target = (GLenum)NUM2INT(arg1);
|
497
|
+
pname = (GLenum)NUM2INT(arg2);
|
498
|
+
Check_Type(arg3,T_ARRAY);
|
499
|
+
ary2cflt(arg3,params,4);
|
500
|
+
glTexParameterfv(target,pname,params);
|
501
|
+
CHECK_GLERROR
|
502
|
+
return Qnil;
|
503
|
+
}
|
504
|
+
|
505
|
+
static VALUE
|
506
|
+
gl_TexParameteriv(obj,arg1,arg2,arg3)
|
507
|
+
VALUE obj,arg1,arg2,arg3;
|
508
|
+
{
|
509
|
+
GLenum target;
|
510
|
+
GLenum pname;
|
511
|
+
GLint params[4] = {0,0,0,0};
|
512
|
+
target = (GLenum)NUM2INT(arg1);
|
513
|
+
pname = (GLenum)NUM2INT(arg2);
|
514
|
+
Check_Type(arg3,T_ARRAY);
|
515
|
+
ary2cint(arg3,params,4);
|
516
|
+
glTexParameteriv(target,pname,params);
|
517
|
+
CHECK_GLERROR
|
518
|
+
return Qnil;
|
519
|
+
}
|
520
|
+
|
521
|
+
static VALUE
|
522
|
+
gl_TexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
|
523
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
524
|
+
{
|
525
|
+
GLenum target;
|
526
|
+
GLint level;
|
527
|
+
GLint components;
|
528
|
+
GLsizei width;
|
529
|
+
GLint border;
|
530
|
+
GLenum format;
|
531
|
+
GLenum type;
|
532
|
+
const char *pixels;
|
533
|
+
target = (GLenum)NUM2INT(arg1);
|
534
|
+
level = (GLint)NUM2INT(arg2);
|
535
|
+
components = (GLint)NUM2INT(arg3);
|
536
|
+
width = (GLsizei)NUM2UINT(arg4);
|
537
|
+
border = (GLint)NUM2INT(arg5);
|
538
|
+
format = (GLenum)NUM2INT(arg6);
|
539
|
+
type = (GLenum)NUM2INT(arg7);
|
540
|
+
|
541
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
542
|
+
glTexImage1D(target,level,components,width,border,format,type,(GLvoid *)NUM2LONG(arg8));
|
543
|
+
CHECK_GLERROR
|
544
|
+
return Qnil;
|
545
|
+
}
|
546
|
+
|
547
|
+
if (target == GL_PROXY_TEXTURE_1D || NIL_P(arg8)) { /* proxy texture, no data read */
|
548
|
+
pixels = NULL;
|
549
|
+
} else {
|
550
|
+
VALUE data;
|
551
|
+
data = pack_array_or_pass_string(type,arg8);
|
552
|
+
CheckDataSize(type,format,width,data);
|
553
|
+
pixels = RSTRING_PTR(data);
|
554
|
+
}
|
555
|
+
glTexImage1D(target,level,components,width,border,format,type,pixels);
|
556
|
+
CHECK_GLERROR
|
557
|
+
return Qnil;
|
558
|
+
}
|
559
|
+
|
560
|
+
static VALUE
|
561
|
+
gl_TexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
562
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
563
|
+
{
|
564
|
+
GLenum target;
|
565
|
+
GLint level;
|
566
|
+
GLint components;
|
567
|
+
GLsizei width;
|
568
|
+
GLsizei height;
|
569
|
+
GLint border;
|
570
|
+
GLenum format;
|
571
|
+
GLenum type;
|
572
|
+
const char *pixels;
|
573
|
+
target = (GLenum)NUM2INT(arg1);
|
574
|
+
level = (GLint)NUM2INT(arg2);
|
575
|
+
components = (GLint)NUM2INT(arg3);
|
576
|
+
width = (GLsizei)NUM2UINT(arg4);
|
577
|
+
height = (GLsizei)NUM2UINT(arg5);
|
578
|
+
border = (GLint)NUM2INT(arg6);
|
579
|
+
format = (GLenum)NUM2INT(arg7);
|
580
|
+
type = (GLenum)NUM2INT(arg8);
|
581
|
+
|
582
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
583
|
+
glTexImage2D(target,level,components,width,height,border,format,type,(GLvoid *)NUM2LONG(arg9));
|
584
|
+
CHECK_GLERROR
|
585
|
+
return Qnil;
|
586
|
+
}
|
587
|
+
|
588
|
+
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 */
|
589
|
+
pixels = NULL;
|
590
|
+
} else {
|
591
|
+
VALUE data;
|
592
|
+
data = pack_array_or_pass_string(type,arg9);
|
593
|
+
CheckDataSize(type,format,width*height,data);
|
594
|
+
pixels = RSTRING_PTR(data);
|
595
|
+
}
|
596
|
+
glTexImage2D(target,level,components,width,height,border,format,type,pixels);
|
597
|
+
CHECK_GLERROR
|
598
|
+
return Qnil;
|
599
|
+
}
|
600
|
+
|
601
|
+
static VALUE
|
602
|
+
gl_TexEnvfv(obj,arg1,arg2,arg3)
|
603
|
+
VALUE obj,arg1,arg2,arg3;
|
604
|
+
{
|
605
|
+
GLenum target;
|
606
|
+
GLenum pname;
|
607
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
608
|
+
target = (GLenum)NUM2INT(arg1);
|
609
|
+
pname = (GLenum)NUM2INT(arg2);
|
610
|
+
Check_Type(arg3,T_ARRAY);
|
611
|
+
ary2cflt(arg3,params,4);
|
612
|
+
glTexEnvfv(target,pname,params);
|
613
|
+
CHECK_GLERROR
|
614
|
+
return Qnil;
|
615
|
+
}
|
616
|
+
|
617
|
+
static VALUE
|
618
|
+
gl_TexEnviv(obj,arg1,arg2,arg3)
|
619
|
+
VALUE obj,arg1,arg2,arg3;
|
620
|
+
{
|
621
|
+
GLenum target;
|
622
|
+
GLenum pname;
|
623
|
+
GLint params[4] = {0,0,0,0};
|
624
|
+
target = (GLenum)NUM2INT(arg1);
|
625
|
+
pname = (GLenum)NUM2INT(arg2);
|
626
|
+
Check_Type(arg3,T_ARRAY);
|
627
|
+
ary2cint(arg3,params,4);
|
628
|
+
glTexEnviv(target,pname,params);
|
629
|
+
CHECK_GLERROR
|
630
|
+
return Qnil;
|
631
|
+
}
|
632
|
+
|
633
|
+
|
634
|
+
static VALUE
|
635
|
+
gl_TexGendv(obj,arg1,arg2,arg3)
|
636
|
+
VALUE obj,arg1,arg2,arg3;
|
637
|
+
{
|
638
|
+
GLenum coord;
|
639
|
+
GLenum pname;
|
640
|
+
GLdouble params[4] = {0.0,0.0,0.0,0.0};
|
641
|
+
coord = (GLenum)NUM2INT(arg1);
|
642
|
+
pname = (GLenum)NUM2INT(arg2);
|
643
|
+
Check_Type(arg3,T_ARRAY);
|
644
|
+
ary2cdbl(arg3,params,4);
|
645
|
+
glTexGendv(coord,pname,params);
|
646
|
+
CHECK_GLERROR
|
647
|
+
return Qnil;
|
648
|
+
}
|
649
|
+
|
650
|
+
|
651
|
+
static VALUE
|
652
|
+
gl_TexGenfv(obj,arg1,arg2,arg3)
|
653
|
+
VALUE obj,arg1,arg2,arg3;
|
654
|
+
{
|
655
|
+
GLenum coord;
|
656
|
+
GLenum pname;
|
657
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
658
|
+
coord = (GLenum)NUM2INT(arg1);
|
659
|
+
pname = (GLenum)NUM2INT(arg2);
|
660
|
+
Check_Type(arg3,T_ARRAY);
|
661
|
+
ary2cflt(arg3,params,4);
|
662
|
+
glTexGenfv(coord,pname,params);
|
663
|
+
CHECK_GLERROR
|
664
|
+
return Qnil;
|
665
|
+
}
|
666
|
+
|
667
|
+
|
668
|
+
static VALUE
|
669
|
+
gl_TexGeniv(obj,arg1,arg2,arg3)
|
670
|
+
VALUE obj,arg1,arg2,arg3;
|
671
|
+
{
|
672
|
+
GLenum coord;
|
673
|
+
GLenum pname;
|
674
|
+
GLint params[4] = {0,0,0,0};
|
675
|
+
coord = (GLenum)NUM2INT(arg1);
|
676
|
+
pname = (GLenum)NUM2INT(arg2);
|
677
|
+
Check_Type(arg3,T_ARRAY);
|
678
|
+
ary2cint(arg3,params,4);
|
679
|
+
glTexGeniv(coord,pname,params);
|
680
|
+
CHECK_GLERROR
|
681
|
+
return Qnil;
|
682
|
+
}
|
683
|
+
static VALUE g_current_feed_buffer;
|
684
|
+
static VALUE
|
685
|
+
gl_FeedbackBuffer(obj,arg1,arg2)
|
686
|
+
VALUE obj,arg1,arg2;
|
687
|
+
{
|
688
|
+
GLsizei size;
|
689
|
+
GLenum type;
|
690
|
+
size = (GLsizei)NUM2UINT(arg1);
|
691
|
+
type = (GLenum)NUM2INT(arg2);
|
692
|
+
g_current_feed_buffer = allocate_buffer_with_string(sizeof(GLfloat)*size);
|
693
|
+
rb_str_freeze(g_current_feed_buffer);
|
694
|
+
glFeedbackBuffer(size, type, (GLfloat*)RSTRING_PTR(g_current_feed_buffer));
|
695
|
+
CHECK_GLERROR
|
696
|
+
return g_current_feed_buffer;
|
697
|
+
}
|
698
|
+
|
699
|
+
static VALUE g_current_sel_buffer;
|
700
|
+
static VALUE
|
701
|
+
gl_SelectBuffer(obj,arg1)
|
702
|
+
VALUE obj,arg1;
|
703
|
+
{
|
704
|
+
GLsizei size;
|
705
|
+
size = (GLsizei)NUM2UINT(arg1);
|
706
|
+
g_current_sel_buffer = allocate_buffer_with_string(sizeof(GLuint)*size);
|
707
|
+
rb_str_freeze(g_current_sel_buffer);
|
708
|
+
glSelectBuffer(size, (GLuint*)RSTRING_PTR(g_current_sel_buffer));
|
709
|
+
CHECK_GLERROR
|
710
|
+
return g_current_sel_buffer;
|
711
|
+
}
|
712
|
+
|
713
|
+
|
714
|
+
static VALUE
|
715
|
+
gl_Map1d(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
716
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
717
|
+
{
|
718
|
+
GLenum target;
|
719
|
+
GLdouble u1;
|
720
|
+
GLdouble u2;
|
721
|
+
GLint stride;
|
722
|
+
GLint order;
|
723
|
+
GLdouble *points;
|
724
|
+
|
725
|
+
VALUE work_ary;
|
726
|
+
|
727
|
+
target = (GLenum)NUM2INT(arg1);
|
728
|
+
u1 = (GLdouble)NUM2DBL(arg2);
|
729
|
+
u2 = (GLdouble)NUM2DBL(arg3);
|
730
|
+
stride = (GLint)NUM2INT(arg4);
|
731
|
+
order = (GLint)NUM2INT(arg5);
|
732
|
+
points = ALLOC_N(GLdouble, order*stride);
|
733
|
+
work_ary = rb_funcall(arg6,rb_intern("flatten"),0);
|
734
|
+
ary2cdbl(work_ary, points, order*stride);
|
735
|
+
glMap1d(target, u1, u2, stride, order, points);
|
736
|
+
xfree(points);
|
737
|
+
CHECK_GLERROR
|
738
|
+
return Qnil;
|
739
|
+
}
|
740
|
+
|
741
|
+
static VALUE
|
742
|
+
gl_Map1f(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
743
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
744
|
+
{
|
745
|
+
GLenum target;
|
746
|
+
GLfloat u1;
|
747
|
+
GLfloat u2;
|
748
|
+
GLint stride;
|
749
|
+
GLint order;
|
750
|
+
GLfloat *points;
|
751
|
+
|
752
|
+
VALUE work_ary;
|
753
|
+
|
754
|
+
target = (GLenum)NUM2INT(arg1);
|
755
|
+
u1 = (GLfloat)NUM2DBL(arg2);
|
756
|
+
u2 = (GLfloat)NUM2DBL(arg3);
|
757
|
+
stride = (GLint)NUM2INT(arg4);
|
758
|
+
order = (GLint)NUM2INT(arg5);
|
759
|
+
points = ALLOC_N(GLfloat, order*stride);
|
760
|
+
work_ary = rb_funcall(arg6,rb_intern("flatten"),0);
|
761
|
+
ary2cflt(work_ary, points, order*stride);
|
762
|
+
glMap1f(target, u1, u2, stride, order, points);
|
763
|
+
xfree(points);
|
764
|
+
CHECK_GLERROR
|
765
|
+
return Qnil;
|
766
|
+
}
|
767
|
+
|
768
|
+
static VALUE
|
769
|
+
gl_Map2d(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
|
770
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
771
|
+
{
|
772
|
+
GLenum target;
|
773
|
+
GLdouble u1;
|
774
|
+
GLdouble u2;
|
775
|
+
GLint ustride;
|
776
|
+
GLint uorder;
|
777
|
+
GLdouble v1;
|
778
|
+
GLdouble v2;
|
779
|
+
GLint vstride;
|
780
|
+
GLint vorder;
|
781
|
+
GLdouble *points;
|
782
|
+
|
783
|
+
VALUE work_ary;
|
784
|
+
|
785
|
+
target = (GLenum)NUM2INT(arg1);
|
786
|
+
u1 = (GLdouble)NUM2INT(arg2);
|
787
|
+
u2 = (GLdouble)NUM2INT(arg3);
|
788
|
+
ustride = (GLint)NUM2INT(arg4);
|
789
|
+
uorder = (GLint)NUM2INT(arg5);
|
790
|
+
v1 = (GLdouble)NUM2INT(arg6);
|
791
|
+
v2 = (GLdouble)NUM2INT(arg7);
|
792
|
+
vstride = (GLint)NUM2INT(arg8);
|
793
|
+
vorder = (GLint)NUM2INT(arg9);
|
794
|
+
points = ALLOC_N(GLdouble, MAX(ustride*uorder, vstride*vorder));
|
795
|
+
work_ary = rb_funcall(arg10,rb_intern("flatten"),0);
|
796
|
+
ary2cdbl(work_ary, points, MAX(ustride*uorder, vstride*vorder));
|
797
|
+
glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
|
798
|
+
xfree(points);
|
799
|
+
CHECK_GLERROR
|
800
|
+
return Qnil;
|
801
|
+
}
|
802
|
+
|
803
|
+
static VALUE
|
804
|
+
gl_Map2f(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
|
805
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
806
|
+
{
|
807
|
+
GLenum target;
|
808
|
+
GLfloat u1;
|
809
|
+
GLfloat u2;
|
810
|
+
GLint ustride;
|
811
|
+
GLint uorder;
|
812
|
+
GLfloat v1;
|
813
|
+
GLfloat v2;
|
814
|
+
GLint vstride;
|
815
|
+
GLint vorder;
|
816
|
+
GLfloat *points;
|
817
|
+
|
818
|
+
VALUE work_ary;
|
819
|
+
|
820
|
+
target = (GLenum)NUM2INT(arg1);
|
821
|
+
u1 = (GLfloat)NUM2INT(arg2);
|
822
|
+
u2 = (GLfloat)NUM2INT(arg3);
|
823
|
+
ustride = (GLint)NUM2INT(arg4);
|
824
|
+
uorder = (GLint)NUM2INT(arg5);
|
825
|
+
v1 = (GLfloat)NUM2INT(arg6);
|
826
|
+
v2 = (GLfloat)NUM2INT(arg7);
|
827
|
+
vstride = (GLint)NUM2INT(arg8);
|
828
|
+
vorder = (GLint)NUM2INT(arg9);
|
829
|
+
points = ALLOC_N(GLfloat, MAX(ustride*uorder, vstride*vorder));
|
830
|
+
work_ary = rb_funcall(arg10,rb_intern("flatten"),0);
|
831
|
+
ary2cflt(work_ary, points, MAX(ustride*uorder, vstride*vorder));
|
832
|
+
glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
|
833
|
+
xfree(points);
|
834
|
+
CHECK_GLERROR
|
835
|
+
return Qnil;
|
836
|
+
}
|
837
|
+
|
838
|
+
static VALUE
|
839
|
+
gl_EvalCoord1dv(obj,arg1)
|
840
|
+
VALUE obj,arg1;
|
841
|
+
{
|
842
|
+
GLdouble params[1] = {0.0};
|
843
|
+
Check_Type(arg1,T_ARRAY);
|
844
|
+
ary2cdbl(arg1,params,1);
|
845
|
+
glEvalCoord1dv(params);
|
846
|
+
CHECK_GLERROR
|
847
|
+
return Qnil;
|
848
|
+
}
|
849
|
+
|
850
|
+
static VALUE
|
851
|
+
gl_EvalCoord1fv(obj,arg1)
|
852
|
+
VALUE obj,arg1;
|
853
|
+
{
|
854
|
+
GLfloat params[1] = {(GLfloat)0.0};
|
855
|
+
Check_Type(arg1,T_ARRAY);
|
856
|
+
ary2cflt(arg1,params,1);
|
857
|
+
glEvalCoord1fv(params);
|
858
|
+
CHECK_GLERROR
|
859
|
+
return Qnil;
|
860
|
+
}
|
861
|
+
|
862
|
+
static VALUE
|
863
|
+
gl_EvalCoord2dv(obj,arg1)
|
864
|
+
VALUE obj,arg1;
|
865
|
+
{
|
866
|
+
GLdouble params[2] = {0.0,0.0};
|
867
|
+
Check_Type(arg1,T_ARRAY);
|
868
|
+
ary2cdbl(arg1,params,2);
|
869
|
+
glEvalCoord2dv(params);
|
870
|
+
CHECK_GLERROR
|
871
|
+
return Qnil;
|
872
|
+
}
|
873
|
+
|
874
|
+
static VALUE
|
875
|
+
gl_EvalCoord2fv(obj,arg1)
|
876
|
+
VALUE obj,arg1;
|
877
|
+
{
|
878
|
+
GLfloat params[2] = {(GLfloat)0.0,(GLfloat)0.0};
|
879
|
+
Check_Type(arg1,T_ARRAY);
|
880
|
+
ary2cflt(arg1,params,2);
|
881
|
+
glEvalCoord2fv(params);
|
882
|
+
CHECK_GLERROR
|
883
|
+
return Qnil;
|
884
|
+
}
|
885
|
+
|
886
|
+
|
887
|
+
#define GLPIXELMAP_FUNC(_type_,_vartype_,_convert_) \
|
888
|
+
static VALUE \
|
889
|
+
gl_PixelMap##_type_##v(argc,argv,obj) \
|
890
|
+
int argc; \
|
891
|
+
VALUE *argv; \
|
892
|
+
VALUE obj; \
|
893
|
+
{ \
|
894
|
+
GLenum map; \
|
895
|
+
_vartype_ *values; \
|
896
|
+
GLsizei size; \
|
897
|
+
VALUE args[4]; \
|
898
|
+
switch(rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2])) { \
|
899
|
+
default: \
|
900
|
+
case 2: \
|
901
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
|
902
|
+
rb_raise(rb_eArgError, "Pixel unpack buffer bound, but offset argument missing"); \
|
903
|
+
map = (GLenum)NUM2INT(args[0]); \
|
904
|
+
Check_Type(args[1],T_ARRAY); \
|
905
|
+
size = (int)RARRAY_LENINT(args[1]); \
|
906
|
+
values = ALLOC_N(_vartype_,size); \
|
907
|
+
_convert_(args[1],values,size); \
|
908
|
+
glPixelMap##_type_##v(map,size,values); \
|
909
|
+
xfree(values); \
|
910
|
+
break; \
|
911
|
+
case 3: \
|
912
|
+
if (!CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
|
913
|
+
rb_raise(rb_eArgError, "Pixel unpack buffer not bound"); \
|
914
|
+
map = (GLenum)NUM2INT(args[0]); \
|
915
|
+
size = (GLsizei)NUM2INT(args[1]); \
|
916
|
+
glPixelMap##_type_##v(map,size,(GLvoid *)NUM2LONG(args[2])); \
|
917
|
+
break; \
|
918
|
+
} \
|
919
|
+
CHECK_GLERROR \
|
920
|
+
return Qnil; \
|
921
|
+
}
|
922
|
+
|
923
|
+
GLPIXELMAP_FUNC(f,GLfloat,ary2cflt)
|
924
|
+
GLPIXELMAP_FUNC(ui,GLuint,ary2cuint)
|
925
|
+
GLPIXELMAP_FUNC(us,GLushort,ary2cushort)
|
926
|
+
#undef GLPIXELMAP_FUNC
|
927
|
+
|
928
|
+
|
929
|
+
static VALUE
|
930
|
+
gl_ReadPixels(argc,argv,obj)
|
931
|
+
int argc;
|
932
|
+
VALUE *argv;
|
933
|
+
VALUE obj;
|
934
|
+
{
|
935
|
+
GLint x;
|
936
|
+
GLint y;
|
937
|
+
GLsizei width;
|
938
|
+
GLsizei height;
|
939
|
+
int format;
|
940
|
+
int type;
|
941
|
+
VALUE pixels;
|
942
|
+
VALUE args[7];
|
943
|
+
int numargs;
|
944
|
+
numargs = rb_scan_args(argc, argv, "61", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6]);
|
945
|
+
x = (GLint)NUM2INT(args[0]);
|
946
|
+
y = (GLint)NUM2INT(args[1]);
|
947
|
+
width = (GLsizei)NUM2UINT(args[2]);
|
948
|
+
height = (GLsizei)NUM2UINT(args[3]);
|
949
|
+
format = NUM2INT(args[4]);
|
950
|
+
type = NUM2INT(args[5]);
|
951
|
+
|
952
|
+
switch(numargs) {
|
953
|
+
default:
|
954
|
+
case 6:
|
955
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
956
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
957
|
+
pixels = allocate_buffer_with_string(GetDataSize(type,format,width*height));
|
958
|
+
FORCE_PIXEL_STORE_MODE
|
959
|
+
glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING_PTR(pixels));
|
960
|
+
RESTORE_PIXEL_STORE_MODE
|
961
|
+
CHECK_GLERROR
|
962
|
+
return pixels;
|
963
|
+
break;
|
964
|
+
case 7:
|
965
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
966
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
967
|
+
FORCE_PIXEL_STORE_MODE
|
968
|
+
glReadPixels(x,y,width,height,format,type,(GLvoid*)NUM2LONG(args[6]));
|
969
|
+
RESTORE_PIXEL_STORE_MODE
|
970
|
+
CHECK_GLERROR
|
971
|
+
return Qnil;
|
972
|
+
break;
|
973
|
+
}
|
974
|
+
}
|
975
|
+
|
976
|
+
static VALUE
|
977
|
+
gl_DrawPixels(obj,arg1,arg2,arg3,arg4,arg5)
|
978
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
979
|
+
{
|
980
|
+
GLsizei width;
|
981
|
+
GLsizei height;
|
982
|
+
GLenum format;
|
983
|
+
GLenum type;
|
984
|
+
const char *pixels;
|
985
|
+
width = (GLsizei)NUM2UINT(arg1);
|
986
|
+
height = (GLsizei)NUM2UINT(arg2);
|
987
|
+
format = (GLenum)NUM2INT(arg3);
|
988
|
+
type = (GLenum)NUM2INT(arg4);
|
989
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
990
|
+
glDrawPixels(width,height,format,type,(GLvoid *)NUM2LONG(arg5));
|
991
|
+
} else {
|
992
|
+
VALUE data;
|
993
|
+
data = pack_array_or_pass_string(type,arg5);
|
994
|
+
CheckDataSize(type,format,width*height,data);
|
995
|
+
pixels = RSTRING_PTR(data);
|
996
|
+
glDrawPixels(width,height,format,type,pixels);
|
997
|
+
}
|
998
|
+
CHECK_GLERROR
|
999
|
+
return Qnil;
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
static VALUE
|
1003
|
+
gl_GetClipPlane(obj,arg1)
|
1004
|
+
VALUE obj,arg1;
|
1005
|
+
{
|
1006
|
+
GLenum plane;
|
1007
|
+
GLdouble equation[4] = {0.0,0.0,0.0,0.0};
|
1008
|
+
VALUE retary;
|
1009
|
+
int i;
|
1010
|
+
plane = (GLenum)NUM2INT(arg1);
|
1011
|
+
glGetClipPlane(plane,equation);
|
1012
|
+
retary = rb_ary_new2(4);
|
1013
|
+
for(i=0;i<4;i++)
|
1014
|
+
rb_ary_push(retary, rb_float_new(equation[i]));
|
1015
|
+
CHECK_GLERROR
|
1016
|
+
return retary;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
#define GLGET_FUNC(_name_,_type_,_conv_) \
|
1020
|
+
static VALUE \
|
1021
|
+
gl_Get##_name_##v(obj,arg1) \
|
1022
|
+
VALUE obj,arg1; \
|
1023
|
+
{ \
|
1024
|
+
GLenum pname; \
|
1025
|
+
int nitems; \
|
1026
|
+
VALUE ary, ary2; \
|
1027
|
+
int i,j; \
|
1028
|
+
_type_ items[64]; \
|
1029
|
+
pname = NUM2INT(arg1); \
|
1030
|
+
switch(pname) { \
|
1031
|
+
case GL_ACCUM_CLEAR_VALUE: \
|
1032
|
+
case GL_BLEND_COLOR: \
|
1033
|
+
case GL_COLOR_CLEAR_VALUE: \
|
1034
|
+
case GL_COLOR_WRITEMASK: \
|
1035
|
+
case GL_CURRENT_COLOR: \
|
1036
|
+
case GL_CURRENT_RASTER_COLOR: \
|
1037
|
+
case GL_CURRENT_RASTER_POSITION: \
|
1038
|
+
case GL_CURRENT_RASTER_SECONDARY_COLOR: \
|
1039
|
+
case GL_CURRENT_RASTER_TEXTURE_COORDS: \
|
1040
|
+
case GL_CURRENT_TEXTURE_COORDS: \
|
1041
|
+
case GL_FOG_COLOR: \
|
1042
|
+
case GL_LIGHT_MODEL_AMBIENT: \
|
1043
|
+
case GL_MAP2_GRID_DOMAIN: \
|
1044
|
+
case GL_CURRENT_SECONDARY_COLOR: \
|
1045
|
+
case GL_SCISSOR_BOX: \
|
1046
|
+
case GL_TEXTURE_ENV_COLOR: \
|
1047
|
+
case GL_VIEWPORT: \
|
1048
|
+
case GL_REFERENCE_PLANE_EQUATION_SGIX: \
|
1049
|
+
case GL_FOG_OFFSET_VALUE_SGIX: \
|
1050
|
+
case GL_TEXTURE_ENV_BIAS_SGIX: \
|
1051
|
+
case GL_CULL_VERTEX_OBJECT_POSITION_EXT: \
|
1052
|
+
case GL_CULL_VERTEX_EYE_POSITION_EXT: \
|
1053
|
+
case GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX: \
|
1054
|
+
case GL_CONSTANT_COLOR0_NV: \
|
1055
|
+
case GL_CONSTANT_COLOR1_NV: \
|
1056
|
+
case GL_TEXTURE_COLOR_WRITEMASK_SGIS: \
|
1057
|
+
case GL_FLOAT_CLEAR_COLOR_VALUE_NV: \
|
1058
|
+
case GL_RGBA_SIGNED_COMPONENTS_EXT: \
|
1059
|
+
nitems = 4; \
|
1060
|
+
break; \
|
1061
|
+
case GL_CURRENT_NORMAL: \
|
1062
|
+
case GL_POINT_DISTANCE_ATTENUATION: \
|
1063
|
+
case GL_SPRITE_AXIS_SGIX: \
|
1064
|
+
case GL_SPRITE_TRANSLATION_SGIX: \
|
1065
|
+
case GL_CURRENT_RASTER_NORMAL_SGIX: \
|
1066
|
+
case GL_CURRENT_TANGENT_EXT: \
|
1067
|
+
case GL_CURRENT_BINORMAL_EXT: \
|
1068
|
+
nitems = 3; \
|
1069
|
+
break; \
|
1070
|
+
case GL_DEPTH_RANGE: \
|
1071
|
+
case GL_LINE_WIDTH_RANGE: \
|
1072
|
+
case GL_MAP1_GRID_DOMAIN: \
|
1073
|
+
case GL_MAP2_GRID_SEGMENTS: \
|
1074
|
+
case GL_MAX_VIEWPORT_DIMS: \
|
1075
|
+
case GL_POINT_SIZE_RANGE: \
|
1076
|
+
case GL_POLYGON_MODE: \
|
1077
|
+
case GL_ALIASED_LINE_WIDTH_RANGE: \
|
1078
|
+
case GL_ALIASED_POINT_SIZE_RANGE: \
|
1079
|
+
case GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX: \
|
1080
|
+
case GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX: \
|
1081
|
+
case GL_FOG_FUNC_SGIS: \
|
1082
|
+
case GL_DEPTH_BOUNDS_EXT: \
|
1083
|
+
nitems = 2; \
|
1084
|
+
break; \
|
1085
|
+
case GL_MODELVIEW_MATRIX: \
|
1086
|
+
case GL_PROJECTION_MATRIX: \
|
1087
|
+
case GL_TEXTURE_MATRIX: \
|
1088
|
+
case GL_COLOR_MATRIX: \
|
1089
|
+
case GL_TRANSPOSE_MODELVIEW_MATRIX: \
|
1090
|
+
case GL_TRANSPOSE_PROJECTION_MATRIX: \
|
1091
|
+
case GL_TRANSPOSE_TEXTURE_MATRIX: \
|
1092
|
+
case GL_TRANSPOSE_COLOR_MATRIX: \
|
1093
|
+
case GL_TRANSPOSE_CURRENT_MATRIX_ARB: \
|
1094
|
+
case GL_MODELVIEW0_ARB: \
|
1095
|
+
case GL_MODELVIEW1_ARB: \
|
1096
|
+
case GL_MODELVIEW2_ARB: \
|
1097
|
+
case GL_MODELVIEW3_ARB: \
|
1098
|
+
case GL_MODELVIEW4_ARB: \
|
1099
|
+
case GL_MODELVIEW5_ARB: \
|
1100
|
+
case GL_MODELVIEW6_ARB: \
|
1101
|
+
case GL_MODELVIEW7_ARB: \
|
1102
|
+
case GL_MODELVIEW8_ARB: \
|
1103
|
+
case GL_MODELVIEW9_ARB: \
|
1104
|
+
case GL_MODELVIEW10_ARB: \
|
1105
|
+
case GL_MODELVIEW11_ARB: \
|
1106
|
+
case GL_MODELVIEW12_ARB: \
|
1107
|
+
case GL_MODELVIEW13_ARB: \
|
1108
|
+
case GL_MODELVIEW14_ARB: \
|
1109
|
+
case GL_MODELVIEW15_ARB: \
|
1110
|
+
case GL_MODELVIEW16_ARB: \
|
1111
|
+
case GL_MODELVIEW17_ARB: \
|
1112
|
+
case GL_MODELVIEW18_ARB: \
|
1113
|
+
case GL_MODELVIEW19_ARB: \
|
1114
|
+
case GL_MODELVIEW20_ARB: \
|
1115
|
+
case GL_MODELVIEW21_ARB: \
|
1116
|
+
case GL_MODELVIEW22_ARB: \
|
1117
|
+
case GL_MODELVIEW23_ARB: \
|
1118
|
+
case GL_MODELVIEW24_ARB: \
|
1119
|
+
case GL_MODELVIEW25_ARB: \
|
1120
|
+
case GL_MODELVIEW26_ARB: \
|
1121
|
+
case GL_MODELVIEW27_ARB: \
|
1122
|
+
case GL_MODELVIEW28_ARB: \
|
1123
|
+
case GL_MODELVIEW29_ARB: \
|
1124
|
+
case GL_MODELVIEW30_ARB: \
|
1125
|
+
case GL_MODELVIEW31_ARB: \
|
1126
|
+
case GL_MATRIX_PALETTE_ARB: \
|
1127
|
+
case GL_PIXEL_TRANSFORM_2D_MATRIX_EXT: \
|
1128
|
+
case GL_MODELVIEW1_MATRIX_EXT: \
|
1129
|
+
case GL_CURRENT_MATRIX_NV: \
|
1130
|
+
glGet##_name_##v(pname, items); \
|
1131
|
+
ary = rb_ary_new2(4); \
|
1132
|
+
for (i = 0; i < 4; i++) { \
|
1133
|
+
ary2 = rb_ary_new2(4); \
|
1134
|
+
rb_ary_push(ary, ary2); \
|
1135
|
+
for (j = 0; j < 4; j++) \
|
1136
|
+
rb_ary_push(ary2, _conv_(items[i*4+j])); \
|
1137
|
+
} \
|
1138
|
+
CHECK_GLERROR \
|
1139
|
+
return ary; \
|
1140
|
+
case GL_POLYGON_STIPPLE: \
|
1141
|
+
glGet##_name_##v(pname, items); \
|
1142
|
+
CHECK_GLERROR \
|
1143
|
+
return rb_str_new((const char*)items, 32); \
|
1144
|
+
case GL_COMPRESSED_TEXTURE_FORMATS: \
|
1145
|
+
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nitems); \
|
1146
|
+
CHECK_GLERROR \
|
1147
|
+
if (nitems<=0||nitems>64) \
|
1148
|
+
return INT2NUM(0); \
|
1149
|
+
break; \
|
1150
|
+
default: /* size=1 */ \
|
1151
|
+
glGet##_name_##v(pname, items); \
|
1152
|
+
CHECK_GLERROR \
|
1153
|
+
return _conv_(items[0]); \
|
1154
|
+
} \
|
1155
|
+
glGet##_name_##v(pname, items); \
|
1156
|
+
ary = rb_ary_new2(nitems); \
|
1157
|
+
for (i = 0; i < nitems; i++) \
|
1158
|
+
rb_ary_push(ary, _conv_(items[i])); \
|
1159
|
+
CHECK_GLERROR \
|
1160
|
+
return ary; \
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
GLGET_FUNC(Double,GLdouble,rb_float_new)
|
1164
|
+
GLGET_FUNC(Float,GLfloat,rb_float_new)
|
1165
|
+
GLGET_FUNC(Integer,GLint,INT2NUM)
|
1166
|
+
GLGET_FUNC(Boolean,GLboolean,GLBOOL2RUBY)
|
1167
|
+
|
1168
|
+
#undef GLGET_FUNC
|
1169
|
+
|
1170
|
+
|
1171
|
+
static VALUE
|
1172
|
+
gl_GetLightfv(obj,arg1,arg2)
|
1173
|
+
VALUE obj,arg1,arg2;
|
1174
|
+
{
|
1175
|
+
GLenum light;
|
1176
|
+
GLenum pname;
|
1177
|
+
GLsizei size;
|
1178
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
1179
|
+
light = (GLenum)NUM2INT(arg1);
|
1180
|
+
pname = (GLenum)NUM2INT(arg2);
|
1181
|
+
switch(pname) {
|
1182
|
+
case GL_AMBIENT:
|
1183
|
+
case GL_DIFFUSE:
|
1184
|
+
case GL_SPECULAR:
|
1185
|
+
case GL_POSITION:
|
1186
|
+
size = 4;
|
1187
|
+
break;
|
1188
|
+
case GL_SPOT_DIRECTION:
|
1189
|
+
size = 3;
|
1190
|
+
break;
|
1191
|
+
case GL_CONSTANT_ATTENUATION:
|
1192
|
+
case GL_LINEAR_ATTENUATION:
|
1193
|
+
case GL_QUADRATIC_ATTENUATION:
|
1194
|
+
case GL_SPOT_EXPONENT:
|
1195
|
+
case GL_SPOT_CUTOFF:
|
1196
|
+
size = 1;
|
1197
|
+
break;
|
1198
|
+
default:
|
1199
|
+
rb_raise(rb_eArgError, "unknown pname:%d",pname);
|
1200
|
+
break; /* not reached */
|
1201
|
+
}
|
1202
|
+
glGetLightfv(light,pname,params);
|
1203
|
+
RET_ARRAY_OR_SINGLE(size,rb_float_new,params)
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
static VALUE
|
1207
|
+
gl_GetLightiv(obj,arg1,arg2)
|
1208
|
+
VALUE obj,arg1,arg2;
|
1209
|
+
{
|
1210
|
+
GLenum light;
|
1211
|
+
GLenum pname;
|
1212
|
+
GLsizei size;
|
1213
|
+
GLint params[4] = {0,0,0,0};
|
1214
|
+
light = (GLenum)NUM2INT(arg1);
|
1215
|
+
pname = (GLenum)NUM2INT(arg2);
|
1216
|
+
switch(pname) {
|
1217
|
+
case GL_AMBIENT:
|
1218
|
+
case GL_DIFFUSE:
|
1219
|
+
case GL_SPECULAR:
|
1220
|
+
case GL_POSITION:
|
1221
|
+
size = 4;
|
1222
|
+
break;
|
1223
|
+
case GL_SPOT_DIRECTION:
|
1224
|
+
size = 3;
|
1225
|
+
break;
|
1226
|
+
case GL_CONSTANT_ATTENUATION:
|
1227
|
+
case GL_LINEAR_ATTENUATION:
|
1228
|
+
case GL_QUADRATIC_ATTENUATION:
|
1229
|
+
case GL_SPOT_EXPONENT:
|
1230
|
+
case GL_SPOT_CUTOFF:
|
1231
|
+
size = 1;
|
1232
|
+
break;
|
1233
|
+
default:
|
1234
|
+
rb_raise(rb_eArgError, "unknown pname:%d",pname);
|
1235
|
+
break; /* not reached */
|
1236
|
+
}
|
1237
|
+
glGetLightiv(light,pname,params);
|
1238
|
+
RET_ARRAY_OR_SINGLE(size,INT2NUM,params)
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
#define GETMAP_FUNC(_name_,_type_) \
|
1242
|
+
static VALUE \
|
1243
|
+
gl_##_name_(obj,arg1,arg2) \
|
1244
|
+
VALUE obj,arg1,arg2; \
|
1245
|
+
{ \
|
1246
|
+
GLenum target; \
|
1247
|
+
GLenum query; \
|
1248
|
+
int dims; \
|
1249
|
+
int pointsize; \
|
1250
|
+
int size=0; \
|
1251
|
+
_type_ *points; \
|
1252
|
+
GLint order[2] = {0,0}; /* for GL_COEFF, [order] or [uorder,vorder] (MAP1/MAP2) */ \
|
1253
|
+
target = (GLenum)NUM2INT(arg1); \
|
1254
|
+
query = (GLenum)NUM2INT(arg2); \
|
1255
|
+
switch(target) { \
|
1256
|
+
case GL_MAP1_INDEX: \
|
1257
|
+
case GL_MAP1_TEXTURE_COORD_1: dims=1; pointsize=1; break; \
|
1258
|
+
case GL_MAP1_TEXTURE_COORD_2: dims=1; pointsize=2; break; \
|
1259
|
+
case GL_MAP1_VERTEX_3: \
|
1260
|
+
case GL_MAP1_NORMAL: \
|
1261
|
+
case GL_MAP1_TEXTURE_COORD_3: dims=1; pointsize=3; break; \
|
1262
|
+
case GL_MAP1_COLOR_4: \
|
1263
|
+
case GL_MAP1_TEXTURE_COORD_4: \
|
1264
|
+
case GL_MAP1_VERTEX_4: dims=1; pointsize=4; break; \
|
1265
|
+
case GL_MAP2_INDEX: \
|
1266
|
+
case GL_MAP2_TEXTURE_COORD_1: dims=2; pointsize=1; break; \
|
1267
|
+
case GL_MAP2_TEXTURE_COORD_2: dims=2; pointsize=2; break; \
|
1268
|
+
case GL_MAP2_VERTEX_3: \
|
1269
|
+
case GL_MAP2_NORMAL: \
|
1270
|
+
case GL_MAP2_TEXTURE_COORD_3: dims=2; pointsize=3; break; \
|
1271
|
+
case GL_MAP2_COLOR_4: \
|
1272
|
+
case GL_MAP2_TEXTURE_COORD_4: \
|
1273
|
+
case GL_MAP2_VERTEX_4: dims=2; pointsize=4; break; \
|
1274
|
+
default: \
|
1275
|
+
rb_raise(rb_eArgError, "unknown target:%d",target); \
|
1276
|
+
break; /* not reached */ \
|
1277
|
+
} \
|
1278
|
+
switch(query) { \
|
1279
|
+
case GL_ORDER: size = dims; break; \
|
1280
|
+
case GL_DOMAIN: size = dims*2; break; \
|
1281
|
+
case GL_COEFF: \
|
1282
|
+
glGetMapiv(target,GL_ORDER,order); \
|
1283
|
+
CHECK_GLERROR \
|
1284
|
+
if (dims==1) \
|
1285
|
+
size = order[0] * pointsize; \
|
1286
|
+
else \
|
1287
|
+
size = (order[0]*order[1]) * pointsize; \
|
1288
|
+
break; \
|
1289
|
+
default: \
|
1290
|
+
rb_raise(rb_eArgError, "unknown target:%d",target); \
|
1291
|
+
break; /* not reached */ \
|
1292
|
+
} \
|
1293
|
+
points = ALLOC_N(_type_,size); \
|
1294
|
+
gl##_name_(target,query,points); \
|
1295
|
+
\
|
1296
|
+
RET_ARRAY_OR_SINGLE_FREE(size,RETCONV_##_type_,points) \
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
GETMAP_FUNC(GetMapdv,GLdouble)
|
1300
|
+
GETMAP_FUNC(GetMapfv,GLfloat)
|
1301
|
+
GETMAP_FUNC(GetMapiv,GLint)
|
1302
|
+
#undef GETMAP_FUNC
|
1303
|
+
|
1304
|
+
static VALUE
|
1305
|
+
gl_GetMaterialfv(obj,arg1,arg2)
|
1306
|
+
VALUE obj,arg1,arg2;
|
1307
|
+
{
|
1308
|
+
GLenum face;
|
1309
|
+
GLenum pname;
|
1310
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
1311
|
+
int size;
|
1312
|
+
face = (GLenum)NUM2INT(arg1);
|
1313
|
+
pname = (GLenum)NUM2INT(arg2);
|
1314
|
+
switch(pname) {
|
1315
|
+
case GL_AMBIENT:
|
1316
|
+
case GL_DIFFUSE:
|
1317
|
+
case GL_SPECULAR:
|
1318
|
+
case GL_EMISSION:
|
1319
|
+
size = 4;
|
1320
|
+
break;
|
1321
|
+
case GL_COLOR_INDEXES:
|
1322
|
+
size = 3;
|
1323
|
+
break;
|
1324
|
+
case GL_SHININESS:
|
1325
|
+
size = 1;
|
1326
|
+
break;
|
1327
|
+
default:
|
1328
|
+
rb_raise(rb_eArgError, "unknown pname:%d",pname);
|
1329
|
+
break; /* not reached */
|
1330
|
+
}
|
1331
|
+
glGetMaterialfv(face,pname,params);
|
1332
|
+
RET_ARRAY_OR_SINGLE(size,rb_float_new,params)
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
static VALUE
|
1336
|
+
gl_GetMaterialiv(obj,arg1,arg2)
|
1337
|
+
VALUE obj,arg1,arg2;
|
1338
|
+
{
|
1339
|
+
GLenum face;
|
1340
|
+
GLenum pname;
|
1341
|
+
GLint params[4] = {0,0,0,0};
|
1342
|
+
int size;
|
1343
|
+
face = (GLenum)NUM2INT(arg1);
|
1344
|
+
pname = (GLenum)NUM2INT(arg2);
|
1345
|
+
switch(pname) {
|
1346
|
+
case GL_AMBIENT:
|
1347
|
+
case GL_DIFFUSE:
|
1348
|
+
case GL_SPECULAR:
|
1349
|
+
case GL_EMISSION:
|
1350
|
+
size = 4;
|
1351
|
+
break;
|
1352
|
+
case GL_COLOR_INDEXES:
|
1353
|
+
size = 3;
|
1354
|
+
break;
|
1355
|
+
case GL_SHININESS:
|
1356
|
+
size = 1;
|
1357
|
+
break;
|
1358
|
+
default:
|
1359
|
+
rb_raise(rb_eArgError, "unknown pname:%d",pname);
|
1360
|
+
break; /* not reached */
|
1361
|
+
}
|
1362
|
+
glGetMaterialiv(face,pname,params);
|
1363
|
+
RET_ARRAY_OR_SINGLE(size,INT2NUM,params)
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
#define GLGETPIXELMAP_FUNC(_type_,_vartype_,_convert_) \
|
1367
|
+
static VALUE \
|
1368
|
+
gl_GetPixelMap##_type_##v(argc,argv,obj) \
|
1369
|
+
int argc; \
|
1370
|
+
VALUE *argv; \
|
1371
|
+
VALUE obj; \
|
1372
|
+
{ \
|
1373
|
+
GLenum map; \
|
1374
|
+
GLenum map_size; \
|
1375
|
+
GLint size = 0; \
|
1376
|
+
_vartype_ *values; \
|
1377
|
+
VALUE args[2]; \
|
1378
|
+
switch (rb_scan_args(argc, argv, "11", &args[0], &args[1])) { \
|
1379
|
+
default: \
|
1380
|
+
case 1: \
|
1381
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING)) \
|
1382
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing"); \
|
1383
|
+
\
|
1384
|
+
map = (GLenum)NUM2INT(args[0]); \
|
1385
|
+
switch(map) { \
|
1386
|
+
case GL_PIXEL_MAP_I_TO_I: map_size=GL_PIXEL_MAP_I_TO_I_SIZE; break; \
|
1387
|
+
case GL_PIXEL_MAP_S_TO_S: map_size=GL_PIXEL_MAP_S_TO_S_SIZE; break; \
|
1388
|
+
case GL_PIXEL_MAP_I_TO_R: map_size=GL_PIXEL_MAP_I_TO_R_SIZE; break; \
|
1389
|
+
case GL_PIXEL_MAP_I_TO_G: map_size=GL_PIXEL_MAP_I_TO_G_SIZE; break; \
|
1390
|
+
case GL_PIXEL_MAP_I_TO_B: map_size=GL_PIXEL_MAP_I_TO_B_SIZE; break; \
|
1391
|
+
case GL_PIXEL_MAP_I_TO_A: map_size=GL_PIXEL_MAP_I_TO_A_SIZE; break; \
|
1392
|
+
case GL_PIXEL_MAP_R_TO_R: map_size=GL_PIXEL_MAP_R_TO_R_SIZE; break; \
|
1393
|
+
case GL_PIXEL_MAP_G_TO_G: map_size=GL_PIXEL_MAP_G_TO_G_SIZE; break; \
|
1394
|
+
case GL_PIXEL_MAP_B_TO_B: map_size=GL_PIXEL_MAP_B_TO_B_SIZE; break; \
|
1395
|
+
case GL_PIXEL_MAP_A_TO_A: map_size=GL_PIXEL_MAP_A_TO_A_SIZE; break; \
|
1396
|
+
default: \
|
1397
|
+
rb_raise(rb_eArgError, "unknown map:%d",map); \
|
1398
|
+
break; \
|
1399
|
+
} \
|
1400
|
+
glGetIntegerv(map_size,&size); \
|
1401
|
+
CHECK_GLERROR \
|
1402
|
+
values = ALLOC_N(_vartype_,size); \
|
1403
|
+
glGetPixelMap##_type_##v(map,values); \
|
1404
|
+
RET_ARRAY_OR_SINGLE_FREE(size,_convert_,values) \
|
1405
|
+
break; \
|
1406
|
+
case 2: \
|
1407
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING)) \
|
1408
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound"); \
|
1409
|
+
\
|
1410
|
+
map = (GLenum)NUM2INT(args[0]); \
|
1411
|
+
glGetPixelMap##_type_##v(map,(GLvoid*)NUM2LONG(args[1])); \
|
1412
|
+
CHECK_GLERROR \
|
1413
|
+
return Qnil; \
|
1414
|
+
} \
|
1415
|
+
}
|
1416
|
+
|
1417
|
+
GLGETPIXELMAP_FUNC(f,GLfloat,rb_float_new)
|
1418
|
+
GLGETPIXELMAP_FUNC(ui,GLuint,INT2NUM)
|
1419
|
+
GLGETPIXELMAP_FUNC(us,GLushort,INT2NUM)
|
1420
|
+
#undef GLGETPIXELMAP_FUNC
|
1421
|
+
|
1422
|
+
static VALUE
|
1423
|
+
gl_GetPolygonStipple(argc,argv,obj)
|
1424
|
+
int argc;
|
1425
|
+
VALUE *argv;
|
1426
|
+
VALUE obj;
|
1427
|
+
{
|
1428
|
+
VALUE args[1];
|
1429
|
+
GLubyte mask[128];
|
1430
|
+
switch(rb_scan_args(argc, argv, "01", &args[0])) {
|
1431
|
+
default:
|
1432
|
+
case 0:
|
1433
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
1434
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
1435
|
+
memset(mask, 0x0, sizeof(GLubyte)*128);
|
1436
|
+
FORCE_PIXEL_STORE_MODE
|
1437
|
+
glGetPolygonStipple(mask);
|
1438
|
+
RESTORE_PIXEL_STORE_MODE
|
1439
|
+
CHECK_GLERROR
|
1440
|
+
return rb_str_new((const char*)mask, 128);
|
1441
|
+
case 1:
|
1442
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
1443
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
1444
|
+
glGetPolygonStipple((GLvoid *)NUM2LONG(args[0]));
|
1445
|
+
CHECK_GLERROR
|
1446
|
+
return Qnil;
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
static VALUE
|
1451
|
+
gl_GetString(obj,arg1)
|
1452
|
+
VALUE obj,arg1;
|
1453
|
+
{
|
1454
|
+
GLenum name;
|
1455
|
+
const GLubyte *ret;
|
1456
|
+
name = (GLenum)NUM2INT(arg1);
|
1457
|
+
ret = glGetString(name);
|
1458
|
+
CHECK_GLERROR
|
1459
|
+
return rb_str_new2((const char*)ret);
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
#define GETTEXENVFUNC(_name_,_type_) \
|
1463
|
+
static VALUE \
|
1464
|
+
gl_##_name_(obj,arg1,arg2) \
|
1465
|
+
VALUE obj,arg1,arg2; \
|
1466
|
+
{ \
|
1467
|
+
GLenum target; \
|
1468
|
+
GLenum pname; \
|
1469
|
+
_type_ params[4] = {(_type_)0.0, (_type_)0.0, (_type_)0.0, (_type_)0.0}; \
|
1470
|
+
int size; \
|
1471
|
+
target = (GLenum)NUM2INT(arg1); \
|
1472
|
+
pname = (GLenum)NUM2INT(arg2); \
|
1473
|
+
switch(pname) { \
|
1474
|
+
case GL_TEXTURE_ENV_COLOR: \
|
1475
|
+
case GL_TEXTURE_ENV_BIAS_SGIX: \
|
1476
|
+
case GL_CULL_MODES_NV: \
|
1477
|
+
case GL_OFFSET_TEXTURE_MATRIX_NV: \
|
1478
|
+
size = 4; \
|
1479
|
+
break; \
|
1480
|
+
case GL_CONST_EYE_NV: \
|
1481
|
+
size = 3; \
|
1482
|
+
break; \
|
1483
|
+
default: \
|
1484
|
+
size = 1; \
|
1485
|
+
break; \
|
1486
|
+
} \
|
1487
|
+
gl##_name_(target,pname,params); \
|
1488
|
+
RET_ARRAY_OR_SINGLE(size,RETCONV_##_type_,params) \
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
GETTEXENVFUNC(GetTexEnvfv,GLfloat)
|
1492
|
+
GETTEXENVFUNC(GetTexEnviv,GLint)
|
1493
|
+
#undef GETTEXENVFUNC
|
1494
|
+
|
1495
|
+
#define GETTEXGENFUNC(_name_,_type_) \
|
1496
|
+
static VALUE \
|
1497
|
+
gl_##_name_(obj,arg1,arg2) \
|
1498
|
+
VALUE obj,arg1,arg2; \
|
1499
|
+
{ \
|
1500
|
+
GLenum coord; \
|
1501
|
+
GLenum pname; \
|
1502
|
+
_type_ params[4] = {(_type_)0.0, (_type_)0.0, (_type_)0.0, (_type_)0.0}; \
|
1503
|
+
int size; \
|
1504
|
+
coord = (GLenum)NUM2INT(arg1); \
|
1505
|
+
pname = (GLenum)NUM2INT(arg2); \
|
1506
|
+
switch(pname) { \
|
1507
|
+
case GL_OBJECT_PLANE: \
|
1508
|
+
case GL_EYE_PLANE: \
|
1509
|
+
size = 4; \
|
1510
|
+
break; \
|
1511
|
+
default: \
|
1512
|
+
size = 1; \
|
1513
|
+
break; \
|
1514
|
+
} \
|
1515
|
+
gl##_name_(coord,pname,params); \
|
1516
|
+
RET_ARRAY_OR_SINGLE(size,RETCONV_##_type_,params) \
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
GETTEXGENFUNC(GetTexGendv,GLdouble)
|
1520
|
+
GETTEXGENFUNC(GetTexGenfv,GLfloat)
|
1521
|
+
GETTEXGENFUNC(GetTexGeniv,GLint)
|
1522
|
+
#undef GETTEXGENFUNC
|
1523
|
+
|
1524
|
+
static VALUE
|
1525
|
+
gl_GetTexImage(argc,argv,obj)
|
1526
|
+
int argc;
|
1527
|
+
VALUE *argv;
|
1528
|
+
VALUE obj;
|
1529
|
+
{
|
1530
|
+
GLenum tex;
|
1531
|
+
GLint lod;
|
1532
|
+
GLenum format;
|
1533
|
+
GLenum type;
|
1534
|
+
GLint width = 0;
|
1535
|
+
GLint height = 0;
|
1536
|
+
GLint depth = 0;
|
1537
|
+
GLint size4d = 0;
|
1538
|
+
GLint size;
|
1539
|
+
VALUE pixels;
|
1540
|
+
VALUE args[5];
|
1541
|
+
int numargs;
|
1542
|
+
numargs = rb_scan_args(argc, argv, "41", &args[0], &args[1], &args[2], &args[3], &args[4]);
|
1543
|
+
tex = (GLenum)NUM2INT(args[0]);
|
1544
|
+
lod = (GLint)NUM2INT(args[1]);
|
1545
|
+
format = (GLenum)NUM2INT(args[2]);
|
1546
|
+
type = (GLenum)NUM2INT(args[3]);
|
1547
|
+
switch(numargs) {
|
1548
|
+
default:
|
1549
|
+
case 4:
|
1550
|
+
if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
1551
|
+
rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
|
1552
|
+
|
1553
|
+
size = 1;
|
1554
|
+
switch(tex) {
|
1555
|
+
case GL_TEXTURE_4D_SGIS:
|
1556
|
+
glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_4DSIZE_SGIS,&size4d);
|
1557
|
+
size *= size4d;
|
1558
|
+
/* fall through */
|
1559
|
+
case GL_TEXTURE_3D:
|
1560
|
+
case GL_TEXTURE_1D_STACK_MESAX:
|
1561
|
+
case GL_TEXTURE_2D_STACK_MESAX:
|
1562
|
+
glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_DEPTH,&depth);
|
1563
|
+
size *= depth;
|
1564
|
+
/* fall through */
|
1565
|
+
case GL_TEXTURE_2D:
|
1566
|
+
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
1567
|
+
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
1568
|
+
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
1569
|
+
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
1570
|
+
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
1571
|
+
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
1572
|
+
case GL_TEXTURE_RECTANGLE_ARB:
|
1573
|
+
case GL_DETAIL_TEXTURE_2D_SGIS:
|
1574
|
+
glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_HEIGHT,&height);
|
1575
|
+
size *= height;
|
1576
|
+
/* fall through */
|
1577
|
+
case GL_TEXTURE_1D:
|
1578
|
+
glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_WIDTH,&width);
|
1579
|
+
size *= width;
|
1580
|
+
break;
|
1581
|
+
default:
|
1582
|
+
rb_raise(rb_eArgError, "Target type not supported");
|
1583
|
+
}
|
1584
|
+
CHECK_GLERROR
|
1585
|
+
pixels = allocate_buffer_with_string(GetDataSize(type,format,size));
|
1586
|
+
|
1587
|
+
FORCE_PIXEL_STORE_MODE
|
1588
|
+
glGetTexImage(tex,lod,format,type,(GLvoid*)RSTRING_PTR(pixels));
|
1589
|
+
RESTORE_PIXEL_STORE_MODE
|
1590
|
+
CHECK_GLERROR
|
1591
|
+
return pixels;
|
1592
|
+
break;
|
1593
|
+
case 5:
|
1594
|
+
if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
|
1595
|
+
rb_raise(rb_eArgError, "Pixel pack buffer not bound");
|
1596
|
+
|
1597
|
+
FORCE_PIXEL_STORE_MODE
|
1598
|
+
glGetTexImage(tex,lod,format,type,(GLvoid*)NUM2LONG(args[4]));
|
1599
|
+
RESTORE_PIXEL_STORE_MODE
|
1600
|
+
CHECK_GLERROR
|
1601
|
+
return Qnil;
|
1602
|
+
}
|
1603
|
+
}
|
1604
|
+
|
1605
|
+
static VALUE
|
1606
|
+
gl_GetTexParameterfv(obj,arg1,arg2)
|
1607
|
+
VALUE obj,arg1,arg2;
|
1608
|
+
{
|
1609
|
+
GLenum target;
|
1610
|
+
GLenum pname;
|
1611
|
+
GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
|
1612
|
+
int size;
|
1613
|
+
target = (GLenum)NUM2INT(arg1);
|
1614
|
+
pname = (GLenum)NUM2INT(arg2);
|
1615
|
+
switch(pname) {
|
1616
|
+
case GL_TEXTURE_BORDER_COLOR:
|
1617
|
+
case GL_TEXTURE_BORDER_VALUES_NV:
|
1618
|
+
case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
|
1619
|
+
case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
|
1620
|
+
size = 4;
|
1621
|
+
break;
|
1622
|
+
default:
|
1623
|
+
size = 1;
|
1624
|
+
break;
|
1625
|
+
}
|
1626
|
+
glGetTexParameterfv(target,pname,params);
|
1627
|
+
RET_ARRAY_OR_SINGLE(size,RETCONV_GLfloat,params)
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
static VALUE
|
1631
|
+
gl_GetTexParameteriv(obj,arg1,arg2)
|
1632
|
+
VALUE obj,arg1,arg2;
|
1633
|
+
{
|
1634
|
+
GLenum target;
|
1635
|
+
GLenum pname;
|
1636
|
+
GLint params[4] = {0,0,0,0};
|
1637
|
+
int size;
|
1638
|
+
target = (GLenum)NUM2INT(arg1);
|
1639
|
+
pname = (GLenum)NUM2INT(arg2);
|
1640
|
+
switch(pname) {
|
1641
|
+
case GL_TEXTURE_BORDER_COLOR:
|
1642
|
+
case GL_TEXTURE_BORDER_VALUES_NV:
|
1643
|
+
case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
|
1644
|
+
case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
|
1645
|
+
size = 4;
|
1646
|
+
break;
|
1647
|
+
default:
|
1648
|
+
size = 1;
|
1649
|
+
break;
|
1650
|
+
}
|
1651
|
+
glGetTexParameteriv(target,pname,params);
|
1652
|
+
RET_ARRAY_OR_SINGLE_BOOL(size,cond_GLBOOL2RUBY,pname,params)
|
1653
|
+
}
|
1654
|
+
|
1655
|
+
static VALUE
|
1656
|
+
gl_GetTexLevelParameterfv(obj,arg1,arg2,arg3)
|
1657
|
+
VALUE obj,arg1,arg2,arg3;
|
1658
|
+
{
|
1659
|
+
GLenum target;
|
1660
|
+
GLint level;
|
1661
|
+
GLenum pname;
|
1662
|
+
GLfloat params = (GLfloat)0.0;
|
1663
|
+
target = (GLenum)NUM2INT(arg1);
|
1664
|
+
level = (GLint)NUM2INT(arg2);
|
1665
|
+
pname = (GLenum)NUM2INT(arg3);
|
1666
|
+
glGetTexLevelParameterfv(target,level,pname,¶ms);
|
1667
|
+
CHECK_GLERROR
|
1668
|
+
return RETCONV_GLfloat(params);
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
static VALUE
|
1672
|
+
gl_GetTexLevelParameteriv(obj,arg1,arg2,arg3)
|
1673
|
+
VALUE obj,arg1,arg2,arg3;
|
1674
|
+
{
|
1675
|
+
GLenum target;
|
1676
|
+
GLint level;
|
1677
|
+
GLenum pname;
|
1678
|
+
GLint params = 0;
|
1679
|
+
target = (GLenum)NUM2INT(arg1);
|
1680
|
+
level = (GLint)NUM2INT(arg2);
|
1681
|
+
pname = (GLenum)NUM2INT(arg3);
|
1682
|
+
glGetTexLevelParameteriv(target,level,pname,¶ms);
|
1683
|
+
CHECK_GLERROR
|
1684
|
+
return cond_GLBOOL2RUBY(pname,params);
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
|
1688
|
+
static VALUE
|
1689
|
+
gl_LoadMatrixf(obj,arg1)
|
1690
|
+
VALUE obj,arg1;
|
1691
|
+
{
|
1692
|
+
GLfloat m[4*4];
|
1693
|
+
ary2cmatfloat(arg1, m, 4, 4);
|
1694
|
+
glLoadMatrixf(m);
|
1695
|
+
CHECK_GLERROR
|
1696
|
+
return Qnil;
|
1697
|
+
}
|
1698
|
+
|
1699
|
+
static VALUE
|
1700
|
+
gl_LoadMatrixd(obj,arg1)
|
1701
|
+
VALUE obj,arg1;
|
1702
|
+
{
|
1703
|
+
GLdouble m[4*4];
|
1704
|
+
ary2cmatdouble(arg1, m, 4, 4);
|
1705
|
+
glLoadMatrixd(m);
|
1706
|
+
CHECK_GLERROR
|
1707
|
+
return Qnil;
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
static VALUE
|
1711
|
+
gl_MultMatrixf(obj,arg1)
|
1712
|
+
VALUE obj,arg1;
|
1713
|
+
{
|
1714
|
+
GLfloat m[4*4];
|
1715
|
+
ary2cmatfloat(arg1, m, 4, 4);
|
1716
|
+
glMultMatrixf(m);
|
1717
|
+
CHECK_GLERROR
|
1718
|
+
return Qnil;
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
static VALUE
|
1722
|
+
gl_MultMatrixd(obj,arg1)
|
1723
|
+
VALUE obj,arg1;
|
1724
|
+
{
|
1725
|
+
GLdouble m[4*4];
|
1726
|
+
ary2cmatdouble(arg1, m, 4, 4);
|
1727
|
+
glMultMatrixd(m);
|
1728
|
+
CHECK_GLERROR
|
1729
|
+
return Qnil;
|
1730
|
+
}
|
1731
|
+
|
1732
|
+
|
1733
|
+
static VALUE g_Vertex_ptr;
|
1734
|
+
static VALUE g_Normal_ptr;
|
1735
|
+
static VALUE g_Color_ptr;
|
1736
|
+
static VALUE g_Index_ptr;
|
1737
|
+
static VALUE g_TexCoord_ptr;
|
1738
|
+
static VALUE g_EdgeFlag_ptr;
|
1739
|
+
VALUE g_FogCoord_ptr; /* OpenGL 1.4 */
|
1740
|
+
VALUE g_SecondaryColor_ptr; /* OpenGL 1.4 */
|
1741
|
+
#define POINTER_FUNC(_func_) \
|
1742
|
+
static VALUE \
|
1743
|
+
gl_##_func_##Pointer(obj, arg1, arg2, arg3, arg4) \
|
1744
|
+
VALUE obj, arg1, arg2, arg3, arg4; \
|
1745
|
+
{ \
|
1746
|
+
GLint size; \
|
1747
|
+
GLenum type; \
|
1748
|
+
GLsizei stride; \
|
1749
|
+
size = (GLint)NUM2INT(arg1); \
|
1750
|
+
type = (GLenum)NUM2INT(arg2); \
|
1751
|
+
stride = (GLsizei)NUM2UINT(arg3); \
|
1752
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) { \
|
1753
|
+
g_##_func_##_ptr = arg4; \
|
1754
|
+
gl##_func_##Pointer(size, type, stride, (const GLvoid*)NUM2LONG(arg4)); \
|
1755
|
+
} else { \
|
1756
|
+
VALUE data; \
|
1757
|
+
data = pack_array_or_pass_string(type,arg4); \
|
1758
|
+
rb_str_freeze(data); \
|
1759
|
+
g_##_func_##_ptr = data; \
|
1760
|
+
gl##_func_##Pointer(size, type, stride, (const GLvoid*)RSTRING_PTR(data)); \
|
1761
|
+
} \
|
1762
|
+
CHECK_GLERROR \
|
1763
|
+
return Qnil; \
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
POINTER_FUNC(Vertex)
|
1767
|
+
POINTER_FUNC(Color)
|
1768
|
+
POINTER_FUNC(TexCoord)
|
1769
|
+
|
1770
|
+
#undef POINTER_FUNC
|
1771
|
+
|
1772
|
+
static VALUE
|
1773
|
+
gl_DrawElements(obj,arg1,arg2,arg3,arg4)
|
1774
|
+
VALUE obj,arg1,arg2,arg3,arg4;
|
1775
|
+
{
|
1776
|
+
GLenum mode;
|
1777
|
+
GLsizei count;
|
1778
|
+
GLenum type;
|
1779
|
+
mode = (GLenum)NUM2INT(arg1);
|
1780
|
+
count = (GLsizei)NUM2UINT(arg2);
|
1781
|
+
type = (GLenum)NUM2INT(arg3);
|
1782
|
+
if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
|
1783
|
+
glDrawElements(mode, count, type, (const GLvoid*)NUM2LONG(arg4));
|
1784
|
+
} else {
|
1785
|
+
VALUE data;
|
1786
|
+
data = pack_array_or_pass_string(type,arg4);
|
1787
|
+
glDrawElements(mode, count, type, (const GLvoid*)RSTRING_PTR(data));
|
1788
|
+
}
|
1789
|
+
CHECK_GLERROR
|
1790
|
+
return Qnil;
|
1791
|
+
}
|
1792
|
+
|
1793
|
+
static VALUE
|
1794
|
+
gl_EdgeFlagPointer(obj,arg1,arg2)
|
1795
|
+
VALUE obj,arg1,arg2;
|
1796
|
+
{
|
1797
|
+
GLsizei stride;
|
1798
|
+
stride = (GLsizei)NUM2UINT(arg1);
|
1799
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
1800
|
+
g_EdgeFlag_ptr = arg2;
|
1801
|
+
glEdgeFlagPointer(stride, (const GLvoid*) NUM2LONG(arg2));
|
1802
|
+
} else {
|
1803
|
+
VALUE data;
|
1804
|
+
data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg2);
|
1805
|
+
rb_str_freeze(data);
|
1806
|
+
g_EdgeFlag_ptr = data;
|
1807
|
+
glEdgeFlagPointer(stride, (const GLvoid*)RSTRING_PTR(data));
|
1808
|
+
}
|
1809
|
+
CHECK_GLERROR
|
1810
|
+
return Qnil;
|
1811
|
+
}
|
1812
|
+
|
1813
|
+
static VALUE
|
1814
|
+
gl_GetPointerv(obj,arg1)
|
1815
|
+
VALUE obj,arg1;
|
1816
|
+
{
|
1817
|
+
GLenum pname;
|
1818
|
+
pname = (GLenum)NUM2INT(arg1);
|
1819
|
+
switch (pname) {
|
1820
|
+
case GL_VERTEX_ARRAY_POINTER:
|
1821
|
+
return g_Vertex_ptr;
|
1822
|
+
case GL_NORMAL_ARRAY_POINTER:
|
1823
|
+
return g_Normal_ptr;
|
1824
|
+
case GL_COLOR_ARRAY_POINTER:
|
1825
|
+
return g_Color_ptr;
|
1826
|
+
case GL_INDEX_ARRAY_POINTER:
|
1827
|
+
return g_Index_ptr;
|
1828
|
+
case GL_TEXTURE_COORD_ARRAY_POINTER:
|
1829
|
+
return g_TexCoord_ptr;
|
1830
|
+
case GL_EDGE_FLAG_ARRAY_POINTER:
|
1831
|
+
return g_EdgeFlag_ptr;
|
1832
|
+
case GL_FOG_COORD_ARRAY_POINTER:
|
1833
|
+
return g_FogCoord_ptr;
|
1834
|
+
case GL_SECONDARY_COLOR_ARRAY_POINTER:
|
1835
|
+
return g_SecondaryColor_ptr;
|
1836
|
+
case GL_FEEDBACK_BUFFER_POINTER:
|
1837
|
+
return g_current_feed_buffer;
|
1838
|
+
case GL_SELECTION_BUFFER_POINTER:
|
1839
|
+
return g_current_sel_buffer;
|
1840
|
+
default:
|
1841
|
+
rb_raise(rb_eArgError, "Invalid pname %d",pname);
|
1842
|
+
break; /* not reached */
|
1843
|
+
}
|
1844
|
+
return Qnil;
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
static VALUE
|
1848
|
+
gl_IndexPointer(obj,arg1,arg2,arg3)
|
1849
|
+
VALUE obj,arg1,arg2,arg3;
|
1850
|
+
{
|
1851
|
+
GLenum type;
|
1852
|
+
GLsizei stride;
|
1853
|
+
type = (GLenum)NUM2INT(arg1);
|
1854
|
+
stride = (GLsizei)NUM2UINT(arg2);
|
1855
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
1856
|
+
g_Index_ptr = arg3;
|
1857
|
+
glIndexPointer(type, stride, (const GLvoid*)NUM2LONG(arg3));
|
1858
|
+
} else {
|
1859
|
+
VALUE data;
|
1860
|
+
data = pack_array_or_pass_string(type,arg3);
|
1861
|
+
g_Index_ptr = data;
|
1862
|
+
glIndexPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
|
1863
|
+
}
|
1864
|
+
CHECK_GLERROR
|
1865
|
+
return Qnil;
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
static VALUE
|
1869
|
+
gl_InterleavedArrays(obj,arg1,arg2,arg3)
|
1870
|
+
VALUE obj,arg1,arg2,arg3;
|
1871
|
+
{
|
1872
|
+
GLenum format;
|
1873
|
+
GLsizei stride;
|
1874
|
+
VALUE data;
|
1875
|
+
format = (GLenum)NUM2INT(arg1);
|
1876
|
+
stride = (GLsizei)NUM2UINT(arg2);
|
1877
|
+
/* FIXME: add support for GL_C4UB_V2F,GL_C4UB_V3F, GL_T2F_C4UB_V3 */
|
1878
|
+
data = pack_array_or_pass_string(GL_FLOAT,arg3);
|
1879
|
+
rb_str_freeze(data);
|
1880
|
+
glInterleavedArrays(format, stride, (const GLvoid*)RSTRING_PTR(data));
|
1881
|
+
CHECK_GLERROR
|
1882
|
+
return Qnil;
|
1883
|
+
}
|
1884
|
+
|
1885
|
+
static VALUE
|
1886
|
+
gl_NormalPointer(obj,arg1,arg2,arg3)
|
1887
|
+
VALUE obj,arg1,arg2,arg3;
|
1888
|
+
{
|
1889
|
+
GLenum type;
|
1890
|
+
GLsizei stride;
|
1891
|
+
type = (GLenum)NUM2INT(arg1);
|
1892
|
+
stride = (GLsizei)NUM2UINT(arg2);
|
1893
|
+
if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
|
1894
|
+
g_Normal_ptr = arg3;
|
1895
|
+
glNormalPointer(type, stride, (const GLvoid*)NUM2LONG(arg3));
|
1896
|
+
} else {
|
1897
|
+
VALUE data;
|
1898
|
+
data = pack_array_or_pass_string(type,arg3);
|
1899
|
+
rb_str_freeze(data);
|
1900
|
+
g_Normal_ptr = data;
|
1901
|
+
glNormalPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
|
1902
|
+
}
|
1903
|
+
CHECK_GLERROR
|
1904
|
+
return Qnil;
|
1905
|
+
}
|
1906
|
+
|
1907
|
+
|
1908
|
+
static VALUE
|
1909
|
+
gl_TexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
1910
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
1911
|
+
{
|
1912
|
+
GLenum target;
|
1913
|
+
GLint level;
|
1914
|
+
GLint xoffset;
|
1915
|
+
GLsizei width;
|
1916
|
+
GLenum format;
|
1917
|
+
GLenum type;
|
1918
|
+
VALUE data;
|
1919
|
+
target = (GLenum)NUM2INT(arg1);
|
1920
|
+
level = (GLint)NUM2INT(arg2);
|
1921
|
+
xoffset = (GLint)NUM2INT(arg3);
|
1922
|
+
width = (GLsizei)NUM2UINT(arg4);
|
1923
|
+
format = (GLenum)NUM2INT(arg5);
|
1924
|
+
type = (GLenum)NUM2INT(arg6);
|
1925
|
+
|
1926
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
1927
|
+
glTexSubImage1D(target,level,xoffset,width,format,type,(GLvoid *)NUM2LONG(arg7));
|
1928
|
+
CHECK_GLERROR
|
1929
|
+
return Qnil;
|
1930
|
+
}
|
1931
|
+
|
1932
|
+
data = pack_array_or_pass_string(type,arg7);
|
1933
|
+
CheckDataSize(type,format,width,data);
|
1934
|
+
|
1935
|
+
glTexSubImage1D(target,level,xoffset,width,format,type,RSTRING_PTR(data));
|
1936
|
+
CHECK_GLERROR
|
1937
|
+
return Qnil;
|
1938
|
+
}
|
1939
|
+
|
1940
|
+
static VALUE
|
1941
|
+
gl_TexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
1942
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
1943
|
+
{
|
1944
|
+
GLenum target;
|
1945
|
+
GLint level;
|
1946
|
+
GLint xoffset;
|
1947
|
+
GLint yoffset;
|
1948
|
+
GLsizei width;
|
1949
|
+
GLsizei height;
|
1950
|
+
GLenum format;
|
1951
|
+
GLenum type;
|
1952
|
+
VALUE data;
|
1953
|
+
target = (GLenum)NUM2INT(arg1);
|
1954
|
+
level = (GLint)NUM2INT(arg2);
|
1955
|
+
xoffset = (GLint)NUM2INT(arg3);
|
1956
|
+
yoffset = (GLint)NUM2INT(arg4);
|
1957
|
+
width = (GLsizei)NUM2UINT(arg5);
|
1958
|
+
height = (GLsizei)NUM2UINT(arg6);
|
1959
|
+
format = (GLenum)NUM2INT(arg7);
|
1960
|
+
type = (GLenum)NUM2INT(arg8);
|
1961
|
+
|
1962
|
+
if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
|
1963
|
+
glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,(GLvoid *)NUM2LONG(arg9));
|
1964
|
+
CHECK_GLERROR
|
1965
|
+
return Qnil;
|
1966
|
+
}
|
1967
|
+
|
1968
|
+
data = pack_array_or_pass_string(type,arg9);
|
1969
|
+
CheckDataSize(type,format,width*height,data);
|
1970
|
+
|
1971
|
+
glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,RSTRING_PTR(data));
|
1972
|
+
CHECK_GLERROR
|
1973
|
+
return Qnil;
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
static VALUE
|
1977
|
+
gl_AreTexturesResident(obj,arg1)
|
1978
|
+
VALUE obj,arg1;
|
1979
|
+
{
|
1980
|
+
GLuint *textures;
|
1981
|
+
GLboolean *residences;
|
1982
|
+
GLsizei size;
|
1983
|
+
GLboolean r;
|
1984
|
+
VALUE retary;
|
1985
|
+
VALUE ary;
|
1986
|
+
int i;
|
1987
|
+
ary = rb_Array(arg1);
|
1988
|
+
size = (int)RARRAY_LENINT(ary);
|
1989
|
+
textures = ALLOC_N(GLuint,size);
|
1990
|
+
residences = ALLOC_N(GLboolean,size);
|
1991
|
+
ary2cuint(ary,textures,size);
|
1992
|
+
r = glAreTexturesResident(size,textures,residences);
|
1993
|
+
retary = rb_ary_new2(size);
|
1994
|
+
if (r==GL_TRUE) { /* all are resident */
|
1995
|
+
for(i=0;i<size;i++)
|
1996
|
+
rb_ary_push(retary, GLBOOL2RUBY(GL_TRUE));
|
1997
|
+
} else {
|
1998
|
+
for(i=0;i<size;i++)
|
1999
|
+
rb_ary_push(retary, GLBOOL2RUBY(residences[i]));
|
2000
|
+
}
|
2001
|
+
xfree(textures);
|
2002
|
+
xfree(residences);
|
2003
|
+
CHECK_GLERROR
|
2004
|
+
return retary;
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
GL_FUNC_GENOBJECTS(GenTextures)
|
2008
|
+
GL_FUNC_DELETEOBJECTS(DeleteTextures)
|
2009
|
+
|
2010
|
+
static VALUE
|
2011
|
+
gl_PrioritizeTextures(obj,arg1,arg2)
|
2012
|
+
VALUE obj,arg1,arg2;
|
2013
|
+
{
|
2014
|
+
GLuint *textures;
|
2015
|
+
GLclampf *priorities;
|
2016
|
+
GLsizei size;
|
2017
|
+
Check_Type(arg1,T_ARRAY);
|
2018
|
+
Check_Type(arg2,T_ARRAY);
|
2019
|
+
if ((size = (GLsizei)RARRAY_LENINT(arg1)) != (GLsizei)RARRAY_LENINT(arg2))
|
2020
|
+
rb_raise(rb_eArgError, "passed arrays must have the same length");
|
2021
|
+
textures = ALLOC_N(GLuint,size);
|
2022
|
+
priorities = ALLOC_N(GLclampf,size);
|
2023
|
+
ary2cuint(arg1,textures,size);
|
2024
|
+
ary2cflt(arg2,priorities,size);
|
2025
|
+
glPrioritizeTextures(size,textures,priorities);
|
2026
|
+
xfree(textures);
|
2027
|
+
xfree(priorities);
|
2028
|
+
CHECK_GLERROR
|
2029
|
+
return Qnil;
|
2030
|
+
}
|
2031
|
+
|
2032
|
+
static VALUE
|
2033
|
+
gl_Indexubv(obj,arg1)
|
2034
|
+
VALUE obj,arg1;
|
2035
|
+
{
|
2036
|
+
GLubyte c[1] = {0};
|
2037
|
+
Check_Type(arg1,T_ARRAY);
|
2038
|
+
ary2cubyte(arg1,c,1);
|
2039
|
+
glIndexubv(c);
|
2040
|
+
CHECK_GLERROR
|
2041
|
+
return Qnil;
|
2042
|
+
}
|
2043
|
+
|
2044
|
+
|
2045
|
+
/* additional functions */
|
2046
|
+
|
2047
|
+
#define GLCOLOR_VFUNC(_type_) \
|
2048
|
+
static VALUE \
|
2049
|
+
gl_Color##_type_##v(argc,argv,obj) \
|
2050
|
+
int argc; \
|
2051
|
+
VALUE *argv; \
|
2052
|
+
VALUE obj; \
|
2053
|
+
{ \
|
2054
|
+
int num; \
|
2055
|
+
VALUE ary, args[4]; \
|
2056
|
+
switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
|
2057
|
+
case 1: \
|
2058
|
+
if (TYPE(args[0]) == T_ARRAY) { \
|
2059
|
+
ary = args[0]; \
|
2060
|
+
switch (RARRAY_LEN(ary)) { \
|
2061
|
+
case 3: \
|
2062
|
+
gl_Color3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
|
2063
|
+
break; \
|
2064
|
+
case 4: \
|
2065
|
+
gl_Color4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
|
2066
|
+
break; \
|
2067
|
+
default: \
|
2068
|
+
rb_raise(rb_eArgError, "array length:%li", RARRAY_LEN(ary)); \
|
2069
|
+
} \
|
2070
|
+
} \
|
2071
|
+
else \
|
2072
|
+
Check_Type(args[0],T_ARRAY); /* force exception */ \
|
2073
|
+
break; \
|
2074
|
+
case 3: \
|
2075
|
+
gl_Color3##_type_(obj,args[0], args[1], args[2]); \
|
2076
|
+
break; \
|
2077
|
+
case 4: \
|
2078
|
+
gl_Color4##_type_(obj,args[0], args[1], args[2], args[3]); \
|
2079
|
+
break; \
|
2080
|
+
default: \
|
2081
|
+
rb_raise(rb_eArgError, "arg length:%d", num); \
|
2082
|
+
} \
|
2083
|
+
return Qnil; \
|
2084
|
+
}
|
2085
|
+
|
2086
|
+
GLCOLOR_VFUNC(b)
|
2087
|
+
GLCOLOR_VFUNC(d)
|
2088
|
+
GLCOLOR_VFUNC(f)
|
2089
|
+
GLCOLOR_VFUNC(i)
|
2090
|
+
GLCOLOR_VFUNC(s)
|
2091
|
+
GLCOLOR_VFUNC(ub)
|
2092
|
+
GLCOLOR_VFUNC(ui)
|
2093
|
+
GLCOLOR_VFUNC(us)
|
2094
|
+
#undef GLCOLOR_VFUNC
|
2095
|
+
|
2096
|
+
#define GLNORMAL_VFUNC(_type_) \
|
2097
|
+
static VALUE \
|
2098
|
+
gl_Normal##_type_##v(argc,argv,obj) \
|
2099
|
+
int argc; \
|
2100
|
+
VALUE *argv; \
|
2101
|
+
VALUE obj; \
|
2102
|
+
{ \
|
2103
|
+
int num; \
|
2104
|
+
VALUE ary, args[3]; \
|
2105
|
+
switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \
|
2106
|
+
case 1: \
|
2107
|
+
if (TYPE(args[0]) == T_ARRAY) { \
|
2108
|
+
ary = args[0]; \
|
2109
|
+
switch (RARRAY_LEN(ary)) { \
|
2110
|
+
case 3: \
|
2111
|
+
gl_Normal3##_type_(obj,RARRAY_PTR(ary)[0], RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
|
2112
|
+
break; \
|
2113
|
+
default: \
|
2114
|
+
rb_raise(rb_eArgError, "array length:%li", RARRAY_LEN(ary)); \
|
2115
|
+
} \
|
2116
|
+
} \
|
2117
|
+
else \
|
2118
|
+
Check_Type(args[0],T_ARRAY); /* force exception */ \
|
2119
|
+
break; \
|
2120
|
+
case 3: \
|
2121
|
+
gl_Normal3##_type_(obj,args[0], args[1], args[2]); \
|
2122
|
+
break; \
|
2123
|
+
default: \
|
2124
|
+
rb_raise(rb_eArgError, "arg length:%d",num); \
|
2125
|
+
} \
|
2126
|
+
return Qnil; \
|
2127
|
+
}
|
2128
|
+
|
2129
|
+
GLNORMAL_VFUNC(b)
|
2130
|
+
GLNORMAL_VFUNC(d)
|
2131
|
+
GLNORMAL_VFUNC(f)
|
2132
|
+
GLNORMAL_VFUNC(i)
|
2133
|
+
GLNORMAL_VFUNC(s)
|
2134
|
+
#undef GLNORMAL_VFUNC
|
2135
|
+
|
2136
|
+
#define GLRASTERPOS_VFUNC(_type_) \
|
2137
|
+
static VALUE \
|
2138
|
+
gl_RasterPos##_type_##v(argc,argv,obj) \
|
2139
|
+
int argc; \
|
2140
|
+
VALUE *argv; \
|
2141
|
+
VALUE obj; \
|
2142
|
+
{ \
|
2143
|
+
int num; \
|
2144
|
+
VALUE ary, args[4]; \
|
2145
|
+
switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
|
2146
|
+
case 1: \
|
2147
|
+
if (TYPE(args[0]) == T_ARRAY) { \
|
2148
|
+
ary = args[0]; \
|
2149
|
+
switch (RARRAY_LEN(ary)) { \
|
2150
|
+
case 2: \
|
2151
|
+
gl_RasterPos2##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
|
2152
|
+
break; \
|
2153
|
+
case 3: \
|
2154
|
+
gl_RasterPos3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
|
2155
|
+
break; \
|
2156
|
+
case 4: \
|
2157
|
+
gl_RasterPos4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
|
2158
|
+
break; \
|
2159
|
+
default: \
|
2160
|
+
rb_raise(rb_eArgError, "array length:%d", num); \
|
2161
|
+
} \
|
2162
|
+
} \
|
2163
|
+
else \
|
2164
|
+
Check_Type(args[0],T_ARRAY); /* force exception */ \
|
2165
|
+
break; \
|
2166
|
+
case 2: \
|
2167
|
+
gl_RasterPos2##_type_(obj,args[0], args[1]); \
|
2168
|
+
break; \
|
2169
|
+
case 3: \
|
2170
|
+
gl_RasterPos3##_type_(obj,args[0], args[1], args[2]); \
|
2171
|
+
break; \
|
2172
|
+
case 4: \
|
2173
|
+
gl_RasterPos4##_type_(obj,args[0], args[1], args[2], args[3]); \
|
2174
|
+
break; \
|
2175
|
+
default: \
|
2176
|
+
rb_raise(rb_eArgError, "too many arguments"); \
|
2177
|
+
} \
|
2178
|
+
return Qnil; \
|
2179
|
+
}
|
2180
|
+
|
2181
|
+
GLRASTERPOS_VFUNC(d)
|
2182
|
+
GLRASTERPOS_VFUNC(f)
|
2183
|
+
GLRASTERPOS_VFUNC(i)
|
2184
|
+
GLRASTERPOS_VFUNC(s)
|
2185
|
+
#undef GLRASTERPOS_VFUNC
|
2186
|
+
|
2187
|
+
#define GLRECT_VFUNC(_type_) \
|
2188
|
+
static VALUE \
|
2189
|
+
gl_Rect##_type_##v(argc,argv,obj) \
|
2190
|
+
int argc; \
|
2191
|
+
VALUE *argv; \
|
2192
|
+
VALUE obj; \
|
2193
|
+
{ \
|
2194
|
+
int num; \
|
2195
|
+
VALUE ary, ary2, args[4]; \
|
2196
|
+
switch (num = rb_scan_args(argc, argv, "22", &args[0], &args[1], &args[2], &args[3])) { \
|
2197
|
+
case 2: \
|
2198
|
+
if (TYPE(args[0]) == T_ARRAY && TYPE(args[1]) == T_ARRAY) { \
|
2199
|
+
ary = args[0]; \
|
2200
|
+
ary2 = args[1]; \
|
2201
|
+
switch (RARRAY_LEN(ary)) { \
|
2202
|
+
case 2: \
|
2203
|
+
gl_Rect##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary2)[0],RARRAY_PTR(ary2)[1]); \
|
2204
|
+
break; \
|
2205
|
+
default: \
|
2206
|
+
rb_raise(rb_eArgError, "array length:%li", RARRAY_LEN(ary)); \
|
2207
|
+
} \
|
2208
|
+
} \
|
2209
|
+
else \
|
2210
|
+
Check_Type(args[0],T_ARRAY); /* force exception */ \
|
2211
|
+
break; \
|
2212
|
+
case 4: \
|
2213
|
+
gl_Rect##_type_(obj,args[0], args[1], args[2], args[3]); \
|
2214
|
+
break; \
|
2215
|
+
default: \
|
2216
|
+
rb_raise(rb_eArgError, "arg length:%d", num); \
|
2217
|
+
} \
|
2218
|
+
return Qnil; \
|
2219
|
+
}
|
2220
|
+
|
2221
|
+
GLRECT_VFUNC(d)
|
2222
|
+
GLRECT_VFUNC(f)
|
2223
|
+
GLRECT_VFUNC(i)
|
2224
|
+
GLRECT_VFUNC(s)
|
2225
|
+
#undef GLRECT_VFUNC
|
2226
|
+
|
2227
|
+
#define GLTEXCOORD_VFUNC(_type_) \
|
2228
|
+
static VALUE \
|
2229
|
+
gl_TexCoord##_type_##v(argc,argv,obj) \
|
2230
|
+
int argc; \
|
2231
|
+
VALUE *argv; \
|
2232
|
+
VALUE obj; \
|
2233
|
+
{ \
|
2234
|
+
int num; \
|
2235
|
+
VALUE ary, args[4]; \
|
2236
|
+
switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
|
2237
|
+
case 1: \
|
2238
|
+
if (TYPE(args[0]) == T_ARRAY) { \
|
2239
|
+
ary = args[0]; \
|
2240
|
+
switch (RARRAY_LEN(ary)) { \
|
2241
|
+
case 1: \
|
2242
|
+
gl_TexCoord1##_type_(obj,RARRAY_PTR(ary)[0]); \
|
2243
|
+
break; \
|
2244
|
+
case 2: \
|
2245
|
+
gl_TexCoord2##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
|
2246
|
+
break; \
|
2247
|
+
case 3: \
|
2248
|
+
gl_TexCoord3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
|
2249
|
+
break; \
|
2250
|
+
case 4: \
|
2251
|
+
gl_TexCoord4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
|
2252
|
+
break; \
|
2253
|
+
default: \
|
2254
|
+
rb_raise(rb_eArgError, "array length:%d", num); \
|
2255
|
+
} \
|
2256
|
+
} \
|
2257
|
+
else \
|
2258
|
+
gl_TexCoord1##_type_(obj,args[0]); \
|
2259
|
+
break; \
|
2260
|
+
case 2: \
|
2261
|
+
gl_TexCoord2##_type_(obj,args[0], args[1]); \
|
2262
|
+
break; \
|
2263
|
+
case 3: \
|
2264
|
+
gl_TexCoord3##_type_(obj,args[0], args[1], args[2]); \
|
2265
|
+
break; \
|
2266
|
+
case 4: \
|
2267
|
+
gl_TexCoord4##_type_(obj,args[0], args[1], args[2], args[3]); \
|
2268
|
+
break; \
|
2269
|
+
default: \
|
2270
|
+
rb_raise(rb_eArgError, "too many arguments"); \
|
2271
|
+
break; \
|
2272
|
+
} \
|
2273
|
+
return Qnil; \
|
2274
|
+
}
|
2275
|
+
|
2276
|
+
GLTEXCOORD_VFUNC(d)
|
2277
|
+
GLTEXCOORD_VFUNC(f)
|
2278
|
+
GLTEXCOORD_VFUNC(i)
|
2279
|
+
GLTEXCOORD_VFUNC(s)
|
2280
|
+
#undef GLTEXCOORD_VFUNC
|
2281
|
+
|
2282
|
+
#define GLVERTEX_VFUNC(_type_) \
|
2283
|
+
static VALUE \
|
2284
|
+
gl_Vertex##_type_##v(argc,argv,obj) \
|
2285
|
+
int argc; \
|
2286
|
+
VALUE *argv; \
|
2287
|
+
VALUE obj; \
|
2288
|
+
{ \
|
2289
|
+
VALUE ary, args[4]; \
|
2290
|
+
switch (rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
|
2291
|
+
case 1: \
|
2292
|
+
if (TYPE(args[0]) == T_ARRAY) { \
|
2293
|
+
ary = args[0]; \
|
2294
|
+
switch (RARRAY_LEN(ary)) { \
|
2295
|
+
case 2: \
|
2296
|
+
gl_Vertex2##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
|
2297
|
+
break; \
|
2298
|
+
case 3: \
|
2299
|
+
gl_Vertex3##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
|
2300
|
+
break; \
|
2301
|
+
case 4: \
|
2302
|
+
gl_Vertex4##_type_(obj,RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
|
2303
|
+
break; \
|
2304
|
+
default: \
|
2305
|
+
rb_raise(rb_eRuntimeError, "glVertex vertex num error!:%li", RARRAY_LEN(ary)); \
|
2306
|
+
} \
|
2307
|
+
} \
|
2308
|
+
else \
|
2309
|
+
Check_Type(args[0],T_ARRAY); /* force exception */ \
|
2310
|
+
break; \
|
2311
|
+
case 2: \
|
2312
|
+
gl_Vertex2##_type_(obj,args[0], args[1]); \
|
2313
|
+
break; \
|
2314
|
+
case 3: \
|
2315
|
+
gl_Vertex3##_type_(obj,args[0], args[1], args[2]); \
|
2316
|
+
break; \
|
2317
|
+
case 4: \
|
2318
|
+
gl_Vertex4##_type_(obj,args[0], args[1], args[2], args[3]); \
|
2319
|
+
break; \
|
2320
|
+
default: \
|
2321
|
+
rb_raise(rb_eArgError, "too many arguments"); \
|
2322
|
+
break; \
|
2323
|
+
} \
|
2324
|
+
return Qnil; \
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
GLVERTEX_VFUNC(d)
|
2328
|
+
GLVERTEX_VFUNC(f)
|
2329
|
+
GLVERTEX_VFUNC(i)
|
2330
|
+
GLVERTEX_VFUNC(s)
|
2331
|
+
#undef GLVERTEX_VFUNC
|
2332
|
+
|
2333
|
+
/* */
|
2334
|
+
|
2335
|
+
static VALUE
|
2336
|
+
gl_LightModel(obj,arg1,arg2)
|
2337
|
+
VALUE obj,arg1,arg2;
|
2338
|
+
{
|
2339
|
+
if (TYPE(arg2) == T_ARRAY)
|
2340
|
+
gl_LightModelfv(obj,arg1,arg2);
|
2341
|
+
else
|
2342
|
+
gl_LightModelf(obj,arg1,arg2);
|
2343
|
+
|
2344
|
+
return Qnil;
|
2345
|
+
}
|
2346
|
+
|
2347
|
+
static VALUE
|
2348
|
+
gl_Material(obj,arg1,arg2,arg3)
|
2349
|
+
VALUE obj,arg1,arg2,arg3;
|
2350
|
+
{
|
2351
|
+
if (TYPE(arg3) == T_ARRAY)
|
2352
|
+
gl_Materialfv(obj,arg1,arg2,arg3);
|
2353
|
+
else
|
2354
|
+
gl_Materialf(obj,arg1,arg2,arg3);
|
2355
|
+
|
2356
|
+
return Qnil;
|
2357
|
+
}
|
2358
|
+
|
2359
|
+
static VALUE
|
2360
|
+
gl_Fog(obj,arg1,arg2)
|
2361
|
+
VALUE obj,arg1,arg2;
|
2362
|
+
{
|
2363
|
+
if (TYPE(arg2) == T_ARRAY)
|
2364
|
+
gl_Fogfv(obj,arg1,arg2);
|
2365
|
+
else
|
2366
|
+
gl_Fogf(obj,arg1,arg2);
|
2367
|
+
|
2368
|
+
return Qnil;
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
static VALUE
|
2372
|
+
gl_Light(obj,arg1,arg2,arg3)
|
2373
|
+
VALUE obj,arg1,arg2,arg3;
|
2374
|
+
{
|
2375
|
+
if (TYPE(arg3) == T_ARRAY)
|
2376
|
+
gl_Lightfv(obj,arg1,arg2,arg3);
|
2377
|
+
else
|
2378
|
+
gl_Lightf(obj,arg1,arg2,arg3);
|
2379
|
+
|
2380
|
+
return Qnil;
|
2381
|
+
}
|
2382
|
+
|
2383
|
+
static VALUE
|
2384
|
+
gl_TexParameter(obj,arg1,arg2,arg3)
|
2385
|
+
VALUE obj,arg1,arg2,arg3;
|
2386
|
+
{
|
2387
|
+
if (TYPE(arg3) == T_ARRAY)
|
2388
|
+
gl_TexParameterfv(obj,arg1,arg2,arg3);
|
2389
|
+
else
|
2390
|
+
gl_TexParameterf(obj,arg1,arg2,arg3);
|
2391
|
+
|
2392
|
+
return Qnil;
|
2393
|
+
}
|
2394
|
+
|
2395
|
+
static VALUE
|
2396
|
+
gl_TexEnv(obj,arg1,arg2,arg3)
|
2397
|
+
VALUE obj,arg1,arg2,arg3;
|
2398
|
+
{
|
2399
|
+
if (TYPE(arg3) == T_ARRAY)
|
2400
|
+
gl_TexEnvfv(obj,arg1,arg2,arg3);
|
2401
|
+
else
|
2402
|
+
gl_TexEnvf(obj,arg1,arg2,arg3);
|
2403
|
+
|
2404
|
+
return Qnil;
|
2405
|
+
}
|
2406
|
+
|
2407
|
+
static VALUE
|
2408
|
+
gl_TexGen(obj,arg1,arg2,arg3)
|
2409
|
+
VALUE obj,arg1,arg2,arg3;
|
2410
|
+
{
|
2411
|
+
if (TYPE(arg3) == T_ARRAY)
|
2412
|
+
gl_TexGenfv(obj,arg1,arg2,arg3);
|
2413
|
+
else
|
2414
|
+
gl_TexGenf(obj,arg1,arg2,arg3);
|
2415
|
+
|
2416
|
+
return Qnil;
|
2417
|
+
}
|
2418
|
+
|
2419
|
+
/* init */
|
2420
|
+
void gl_init_functions_1_0__1_1(VALUE module)
|
2421
|
+
{
|
2422
|
+
g_FogCoord_ptr = 0; /* for use in gl-1.4.c */
|
2423
|
+
g_SecondaryColor_ptr = 0; /* for use in gl-1.4.c */
|
2424
|
+
|
2425
|
+
/* OpenGL 1.0 functions */
|
2426
|
+
rb_define_module_function(module, "glNewList", gl_NewList, 2);
|
2427
|
+
rb_define_module_function(module, "glEndList", gl_EndList, 0);
|
2428
|
+
rb_define_module_function(module, "glCallList", gl_CallList, 1);
|
2429
|
+
rb_define_module_function(module, "glCallLists", gl_CallLists, 2);
|
2430
|
+
rb_define_module_function(module, "glDeleteLists", gl_DeleteLists, 2);
|
2431
|
+
rb_define_module_function(module, "glGenLists", gl_GenLists, 1);
|
2432
|
+
rb_define_module_function(module, "glListBase", gl_ListBase, 1);
|
2433
|
+
rb_define_module_function(module, "glBegin", gl_Begin, 1);
|
2434
|
+
rb_define_module_function(module, "glBitmap", gl_Bitmap, 7);
|
2435
|
+
rb_define_module_function(module, "glColor3b", gl_Color3b, 3);
|
2436
|
+
rb_define_module_function(module, "glColor3d", gl_Color3d, 3);
|
2437
|
+
rb_define_module_function(module, "glColor3f", gl_Color3f, 3);
|
2438
|
+
rb_define_module_function(module, "glColor3i", gl_Color3i, 3);
|
2439
|
+
rb_define_module_function(module, "glColor3s", gl_Color3s, 3);
|
2440
|
+
rb_define_module_function(module, "glColor3ub", gl_Color3ub, 3);
|
2441
|
+
rb_define_module_function(module, "glColor3ui", gl_Color3ui, 3);
|
2442
|
+
rb_define_module_function(module, "glColor3us", gl_Color3us, 3);
|
2443
|
+
rb_define_module_function(module, "glColor4b", gl_Color4b, 4);
|
2444
|
+
rb_define_module_function(module, "glColor4d", gl_Color4d, 4);
|
2445
|
+
rb_define_module_function(module, "glColor4f", gl_Color4f, 4);
|
2446
|
+
rb_define_module_function(module, "glColor4i", gl_Color4i, 4);
|
2447
|
+
rb_define_module_function(module, "glColor4s", gl_Color4s, 4);
|
2448
|
+
rb_define_module_function(module, "glColor4ub", gl_Color4ub, 4);
|
2449
|
+
rb_define_module_function(module, "glColor4ui", gl_Color4ui, 4);
|
2450
|
+
rb_define_module_function(module, "glColor4us", gl_Color4us, 4);
|
2451
|
+
rb_define_module_function(module, "glEdgeFlag", gl_EdgeFlag, 1);
|
2452
|
+
rb_define_module_function(module, "glEdgeFlagv", gl_EdgeFlagv, 1);
|
2453
|
+
rb_define_module_function(module, "glEnd", gl_End, 0);
|
2454
|
+
rb_define_module_function(module, "glIndexd", gl_Indexd, 1);
|
2455
|
+
rb_define_module_function(module, "glIndexdv", gl_Indexdv, 1);
|
2456
|
+
rb_define_module_function(module, "glIndexf", gl_Indexf, 1);
|
2457
|
+
rb_define_module_function(module, "glIndexfv", gl_Indexfv, 1);
|
2458
|
+
rb_define_module_function(module, "glIndexi", gl_Indexi, 1);
|
2459
|
+
rb_define_module_function(module, "glIndexiv", gl_Indexiv, 1);
|
2460
|
+
rb_define_module_function(module, "glIndexs", gl_Indexs, 1);
|
2461
|
+
rb_define_module_function(module, "glIndexsv", gl_Indexsv, 1);
|
2462
|
+
rb_define_module_function(module, "glNormal3b", gl_Normal3b, 3);
|
2463
|
+
rb_define_module_function(module, "glNormal3d", gl_Normal3d, 3);
|
2464
|
+
rb_define_module_function(module, "glNormal3f", gl_Normal3f, 3);
|
2465
|
+
rb_define_module_function(module, "glNormal3i", gl_Normal3i, 3);
|
2466
|
+
rb_define_module_function(module, "glNormal3s", gl_Normal3s, 3);
|
2467
|
+
rb_define_module_function(module, "glRasterPos2d", gl_RasterPos2d, 2);
|
2468
|
+
rb_define_module_function(module, "glRasterPos2f", gl_RasterPos2f, 2);
|
2469
|
+
rb_define_module_function(module, "glRasterPos2i", gl_RasterPos2i, 2);
|
2470
|
+
rb_define_module_function(module, "glRasterPos2s", gl_RasterPos2s, 2);
|
2471
|
+
rb_define_module_function(module, "glRasterPos3d", gl_RasterPos3d, 3);
|
2472
|
+
rb_define_module_function(module, "glRasterPos3f", gl_RasterPos3f, 3);
|
2473
|
+
rb_define_module_function(module, "glRasterPos3i", gl_RasterPos3i, 3);
|
2474
|
+
rb_define_module_function(module, "glRasterPos3s", gl_RasterPos3s, 3);
|
2475
|
+
rb_define_module_function(module, "glRasterPos4d", gl_RasterPos4d, 4);
|
2476
|
+
rb_define_module_function(module, "glRasterPos4f", gl_RasterPos4f, 4);
|
2477
|
+
rb_define_module_function(module, "glRasterPos4i", gl_RasterPos4i, 4);
|
2478
|
+
rb_define_module_function(module, "glRasterPos4s", gl_RasterPos4s, 4);
|
2479
|
+
rb_define_module_function(module, "glRectd", gl_Rectd, 4);
|
2480
|
+
rb_define_module_function(module, "glRectf", gl_Rectf, 4);
|
2481
|
+
rb_define_module_function(module, "glRecti", gl_Recti, 4);
|
2482
|
+
rb_define_module_function(module, "glRects", gl_Rects, 4);
|
2483
|
+
rb_define_module_function(module, "glTexCoord1d", gl_TexCoord1d, 1);
|
2484
|
+
rb_define_module_function(module, "glTexCoord1f", gl_TexCoord1f, 1);
|
2485
|
+
rb_define_module_function(module, "glTexCoord1i", gl_TexCoord1i, 1);
|
2486
|
+
rb_define_module_function(module, "glTexCoord1s", gl_TexCoord1s, 1);
|
2487
|
+
rb_define_module_function(module, "glTexCoord2d", gl_TexCoord2d, 2);
|
2488
|
+
rb_define_module_function(module, "glTexCoord2f", gl_TexCoord2f, 2);
|
2489
|
+
rb_define_module_function(module, "glTexCoord2i", gl_TexCoord2i, 2);
|
2490
|
+
rb_define_module_function(module, "glTexCoord2s", gl_TexCoord2s, 2);
|
2491
|
+
rb_define_module_function(module, "glTexCoord3d", gl_TexCoord3d, 3);
|
2492
|
+
rb_define_module_function(module, "glTexCoord3f", gl_TexCoord3f, 3);
|
2493
|
+
rb_define_module_function(module, "glTexCoord3i", gl_TexCoord3i, 3);
|
2494
|
+
rb_define_module_function(module, "glTexCoord3s", gl_TexCoord3s, 3);
|
2495
|
+
rb_define_module_function(module, "glTexCoord4d", gl_TexCoord4d, 4);
|
2496
|
+
rb_define_module_function(module, "glTexCoord4f", gl_TexCoord4f, 4);
|
2497
|
+
rb_define_module_function(module, "glTexCoord4i", gl_TexCoord4i, 4);
|
2498
|
+
rb_define_module_function(module, "glTexCoord4s", gl_TexCoord4s, 4);
|
2499
|
+
rb_define_module_function(module, "glVertex2d", gl_Vertex2d, 2);
|
2500
|
+
rb_define_module_function(module, "glVertex2f", gl_Vertex2f, 2);
|
2501
|
+
rb_define_module_function(module, "glVertex2i", gl_Vertex2i, 2);
|
2502
|
+
rb_define_module_function(module, "glVertex2s", gl_Vertex2s, 2);
|
2503
|
+
rb_define_module_function(module, "glVertex3d", gl_Vertex3d, 3);
|
2504
|
+
rb_define_module_function(module, "glVertex3f", gl_Vertex3f, 3);
|
2505
|
+
rb_define_module_function(module, "glVertex3i", gl_Vertex3i, 3);
|
2506
|
+
rb_define_module_function(module, "glVertex3s", gl_Vertex3s, 3);
|
2507
|
+
rb_define_module_function(module, "glVertex4d", gl_Vertex4d, 4);
|
2508
|
+
rb_define_module_function(module, "glVertex4f", gl_Vertex4f, 4);
|
2509
|
+
rb_define_module_function(module, "glVertex4i", gl_Vertex4i, 4);
|
2510
|
+
rb_define_module_function(module, "glVertex4s", gl_Vertex4s, 4);
|
2511
|
+
rb_define_module_function(module, "glClipPlane", gl_ClipPlane, 2);
|
2512
|
+
rb_define_module_function(module, "glColorMaterial", gl_ColorMaterial, 2);
|
2513
|
+
rb_define_module_function(module, "glCullFace", gl_CullFace, 1);
|
2514
|
+
rb_define_module_function(module, "glFogf", gl_Fogf, 2);
|
2515
|
+
rb_define_module_function(module, "glFogfv", gl_Fogfv, 2);
|
2516
|
+
rb_define_module_function(module, "glFogi", gl_Fogi, 2);
|
2517
|
+
rb_define_module_function(module, "glFogiv", gl_Fogiv, 2);
|
2518
|
+
rb_define_module_function(module, "glFrontFace", gl_FrontFace, 1);
|
2519
|
+
rb_define_module_function(module, "glHint", gl_Hint, 2);
|
2520
|
+
rb_define_module_function(module, "glLightf", gl_Lightf, 3);
|
2521
|
+
rb_define_module_function(module, "glLightfv", gl_Lightfv, 3);
|
2522
|
+
rb_define_module_function(module, "glLighti", gl_Lighti, 3);
|
2523
|
+
rb_define_module_function(module, "glLightiv", gl_Lightiv, 3);
|
2524
|
+
rb_define_module_function(module, "glLightModelf", gl_LightModelf, 2);
|
2525
|
+
rb_define_module_function(module, "glLightModelfv", gl_LightModelfv, 2);
|
2526
|
+
rb_define_module_function(module, "glLightModeli", gl_LightModeli, 2);
|
2527
|
+
rb_define_module_function(module, "glLightModeliv", gl_LightModeliv, 2);
|
2528
|
+
rb_define_module_function(module, "glLineStipple", gl_LineStipple, 2);
|
2529
|
+
rb_define_module_function(module, "glLineWidth", gl_LineWidth, 1);
|
2530
|
+
rb_define_module_function(module, "glMaterialf", gl_Materialf, 3);
|
2531
|
+
rb_define_module_function(module, "glMaterialfv", gl_Materialfv, 3);
|
2532
|
+
rb_define_module_function(module, "glMateriali", gl_Materiali, 3);
|
2533
|
+
rb_define_module_function(module, "glMaterialiv", gl_Materialiv, 3);
|
2534
|
+
rb_define_module_function(module, "glPointSize", gl_PointSize, 1);
|
2535
|
+
rb_define_module_function(module, "glPolygonMode", gl_PolygonMode, 2);
|
2536
|
+
rb_define_module_function(module, "glPolygonStipple", gl_PolygonStipple, 1);
|
2537
|
+
rb_define_module_function(module, "glScissor", gl_Scissor, 4);
|
2538
|
+
rb_define_module_function(module, "glShadeModel", gl_ShadeModel, 1);
|
2539
|
+
rb_define_module_function(module, "glTexParameterf", gl_TexParameterf, 3);
|
2540
|
+
rb_define_module_function(module, "glTexParameterfv", gl_TexParameterfv, 3);
|
2541
|
+
rb_define_module_function(module, "glTexParameteri", gl_TexParameteri, 3);
|
2542
|
+
rb_define_module_function(module, "glTexParameteriv", gl_TexParameteriv, 3);
|
2543
|
+
rb_define_module_function(module, "glTexImage1D", gl_TexImage1D, 8);
|
2544
|
+
rb_define_module_function(module, "glTexImage2D", gl_TexImage2D, 9);
|
2545
|
+
rb_define_module_function(module, "glTexEnvf", gl_TexEnvf, 3);
|
2546
|
+
rb_define_module_function(module, "glTexEnvfv", gl_TexEnvfv, 3);
|
2547
|
+
rb_define_module_function(module, "glTexEnvi", gl_TexEnvi, 3);
|
2548
|
+
rb_define_module_function(module, "glTexEnviv", gl_TexEnviv, 3);
|
2549
|
+
rb_define_module_function(module, "glTexGend", gl_TexGend, 3);
|
2550
|
+
rb_define_module_function(module, "glTexGendv", gl_TexGendv, 3);
|
2551
|
+
rb_define_module_function(module, "glTexGenf", gl_TexGenf, 3);
|
2552
|
+
rb_define_module_function(module, "glTexGenfv", gl_TexGenfv, 3);
|
2553
|
+
rb_define_module_function(module, "glTexGeni", gl_TexGeni, 3);
|
2554
|
+
rb_define_module_function(module, "glTexGeniv", gl_TexGeniv, 3);
|
2555
|
+
rb_define_module_function(module, "glFeedbackBuffer", gl_FeedbackBuffer, 2);
|
2556
|
+
rb_define_module_function(module, "glSelectBuffer", gl_SelectBuffer, 1);
|
2557
|
+
rb_define_module_function(module, "glRenderMode", gl_RenderMode, 1);
|
2558
|
+
rb_define_module_function(module, "glInitNames", gl_InitNames, 0);
|
2559
|
+
rb_define_module_function(module, "glLoadName", gl_LoadName, 1);
|
2560
|
+
rb_define_module_function(module, "glPassThrough", gl_PassThrough, 1);
|
2561
|
+
rb_define_module_function(module, "glPopName", gl_PopName, 0);
|
2562
|
+
rb_define_module_function(module, "glPushName", gl_PushName, 1);
|
2563
|
+
rb_define_module_function(module, "glDrawBuffer", gl_DrawBuffer, 1);
|
2564
|
+
rb_define_module_function(module, "glClear", gl_Clear, 1);
|
2565
|
+
rb_define_module_function(module, "glClearAccum", gl_ClearAccum, 4);
|
2566
|
+
rb_define_module_function(module, "glClearIndex", gl_ClearIndex, 1);
|
2567
|
+
rb_define_module_function(module, "glClearColor", gl_ClearColor, 4);
|
2568
|
+
rb_define_module_function(module, "glClearStencil", gl_ClearStencil, 1);
|
2569
|
+
rb_define_module_function(module, "glClearDepth", gl_ClearDepth, 1);
|
2570
|
+
rb_define_module_function(module, "glStencilMask", gl_StencilMask, 1);
|
2571
|
+
rb_define_module_function(module, "glColorMask", gl_ColorMask, 4);
|
2572
|
+
rb_define_module_function(module, "glDepthMask", gl_DepthMask, 1);
|
2573
|
+
rb_define_module_function(module, "glIndexMask", gl_IndexMask, 1);
|
2574
|
+
rb_define_module_function(module, "glAccum", gl_Accum, 2);
|
2575
|
+
rb_define_module_function(module, "glDisable", gl_Disable, 1);
|
2576
|
+
rb_define_module_function(module, "glEnable", gl_Enable, 1);
|
2577
|
+
rb_define_module_function(module, "glFinish", gl_Finish, 0);
|
2578
|
+
rb_define_module_function(module, "glFlush", gl_Flush, 0);
|
2579
|
+
rb_define_module_function(module, "glPopAttrib", gl_PopAttrib, 0);
|
2580
|
+
rb_define_module_function(module, "glPushAttrib", gl_PushAttrib, 1);
|
2581
|
+
rb_define_module_function(module, "glMap1d", gl_Map1d, 6);
|
2582
|
+
rb_define_module_function(module, "glMap1f", gl_Map1f, 6);
|
2583
|
+
rb_define_module_function(module, "glMap2d", gl_Map2d, 10);
|
2584
|
+
rb_define_module_function(module, "glMap2f", gl_Map2f, 10);
|
2585
|
+
rb_define_module_function(module, "glMapGrid1d", gl_MapGrid1d, 3);
|
2586
|
+
rb_define_module_function(module, "glMapGrid1f", gl_MapGrid1f, 3);
|
2587
|
+
rb_define_module_function(module, "glMapGrid2d", gl_MapGrid2d, 6);
|
2588
|
+
rb_define_module_function(module, "glMapGrid2f", gl_MapGrid2f, 6);
|
2589
|
+
rb_define_module_function(module, "glEvalCoord1d", gl_EvalCoord1d, 1);
|
2590
|
+
rb_define_module_function(module, "glEvalCoord1dv", gl_EvalCoord1dv, 1);
|
2591
|
+
rb_define_module_function(module, "glEvalCoord1f", gl_EvalCoord1f, 1);
|
2592
|
+
rb_define_module_function(module, "glEvalCoord1fv", gl_EvalCoord1fv, 1);
|
2593
|
+
rb_define_module_function(module, "glEvalCoord2d", gl_EvalCoord2d, 2);
|
2594
|
+
rb_define_module_function(module, "glEvalCoord2dv", gl_EvalCoord2dv, 1);
|
2595
|
+
rb_define_module_function(module, "glEvalCoord2f", gl_EvalCoord2f, 2);
|
2596
|
+
rb_define_module_function(module, "glEvalCoord2fv", gl_EvalCoord2fv, 1);
|
2597
|
+
rb_define_module_function(module, "glEvalMesh1", gl_EvalMesh1, 3);
|
2598
|
+
rb_define_module_function(module, "glEvalPoint1", gl_EvalPoint1, 1);
|
2599
|
+
rb_define_module_function(module, "glEvalMesh2", gl_EvalMesh2, 5);
|
2600
|
+
rb_define_module_function(module, "glEvalPoint2", gl_EvalPoint2, 2);
|
2601
|
+
rb_define_module_function(module, "glAlphaFunc", gl_AlphaFunc, 2);
|
2602
|
+
rb_define_module_function(module, "glBlendFunc", gl_BlendFunc, 2);
|
2603
|
+
rb_define_module_function(module, "glLogicOp", gl_LogicOp, 1);
|
2604
|
+
rb_define_module_function(module, "glStencilFunc", gl_StencilFunc, 3);
|
2605
|
+
rb_define_module_function(module, "glStencilOp", gl_StencilOp, 3);
|
2606
|
+
rb_define_module_function(module, "glDepthFunc", gl_DepthFunc, 1);
|
2607
|
+
rb_define_module_function(module, "glPixelZoom", gl_PixelZoom, 2);
|
2608
|
+
rb_define_module_function(module, "glPixelTransferf", gl_PixelTransferf, 2);
|
2609
|
+
rb_define_module_function(module, "glPixelTransferi", gl_PixelTransferi, 2);
|
2610
|
+
rb_define_module_function(module, "glPixelStoref", gl_PixelStoref, 2);
|
2611
|
+
rb_define_module_function(module, "glPixelStorei", gl_PixelStorei, 2);
|
2612
|
+
rb_define_module_function(module, "glPixelMapfv", gl_PixelMapfv, -1);
|
2613
|
+
rb_define_module_function(module, "glPixelMapuiv", gl_PixelMapuiv, -1);
|
2614
|
+
rb_define_module_function(module, "glPixelMapusv", gl_PixelMapusv, -1);
|
2615
|
+
rb_define_module_function(module, "glReadBuffer", gl_ReadBuffer, 1);
|
2616
|
+
rb_define_module_function(module, "glCopyPixels", gl_CopyPixels, 5);
|
2617
|
+
rb_define_module_function(module, "glReadPixels", gl_ReadPixels, -1);
|
2618
|
+
rb_define_module_function(module, "glDrawPixels", gl_DrawPixels, 5);
|
2619
|
+
rb_define_module_function(module, "glGetBooleanv", gl_GetBooleanv, 1);
|
2620
|
+
rb_define_module_function(module, "glGetClipPlane", gl_GetClipPlane, 1);
|
2621
|
+
rb_define_module_function(module, "glGetDoublev", gl_GetDoublev, 1);
|
2622
|
+
rb_define_module_function(module, "glGetError", gl_GetError, 0);
|
2623
|
+
rb_define_module_function(module, "glGetFloatv", gl_GetFloatv, 1);
|
2624
|
+
rb_define_module_function(module, "glGetIntegerv", gl_GetIntegerv, 1);
|
2625
|
+
rb_define_module_function(module, "glGetLightfv", gl_GetLightfv, 2);
|
2626
|
+
rb_define_module_function(module, "glGetLightiv", gl_GetLightiv, 2);
|
2627
|
+
rb_define_module_function(module, "glGetMapdv", gl_GetMapdv, 2);
|
2628
|
+
rb_define_module_function(module, "glGetMapfv", gl_GetMapfv, 2);
|
2629
|
+
rb_define_module_function(module, "glGetMapiv", gl_GetMapiv, 2);
|
2630
|
+
rb_define_module_function(module, "glGetMaterialfv", gl_GetMaterialfv, 2);
|
2631
|
+
rb_define_module_function(module, "glGetMaterialiv", gl_GetMaterialiv, 2);
|
2632
|
+
rb_define_module_function(module, "glGetPixelMapfv", gl_GetPixelMapfv, -1);
|
2633
|
+
rb_define_module_function(module, "glGetPixelMapuiv", gl_GetPixelMapuiv, -1);
|
2634
|
+
rb_define_module_function(module, "glGetPixelMapusv", gl_GetPixelMapusv, -1);
|
2635
|
+
rb_define_module_function(module, "glGetPolygonStipple", gl_GetPolygonStipple, -1);
|
2636
|
+
rb_define_module_function(module, "glGetString", gl_GetString, 1);
|
2637
|
+
rb_define_module_function(module, "glGetTexEnvfv", gl_GetTexEnvfv, 2);
|
2638
|
+
rb_define_module_function(module, "glGetTexEnviv", gl_GetTexEnviv, 2);
|
2639
|
+
rb_define_module_function(module, "glGetTexGendv", gl_GetTexGendv, 2);
|
2640
|
+
rb_define_module_function(module, "glGetTexGenfv", gl_GetTexGenfv, 2);
|
2641
|
+
rb_define_module_function(module, "glGetTexGeniv", gl_GetTexGeniv, 2);
|
2642
|
+
rb_define_module_function(module, "glGetTexImage", gl_GetTexImage, -1);
|
2643
|
+
rb_define_module_function(module, "glGetTexParameterfv", gl_GetTexParameterfv, 2);
|
2644
|
+
rb_define_module_function(module, "glGetTexParameteriv", gl_GetTexParameteriv, 2);
|
2645
|
+
rb_define_module_function(module, "glGetTexLevelParameterfv", gl_GetTexLevelParameterfv, 3);
|
2646
|
+
rb_define_module_function(module, "glGetTexLevelParameteriv", gl_GetTexLevelParameteriv, 3);
|
2647
|
+
rb_define_module_function(module, "glIsEnabled", gl_IsEnabled, 1);
|
2648
|
+
rb_define_module_function(module, "glIsList", gl_IsList, 1);
|
2649
|
+
rb_define_module_function(module, "glDepthRange", gl_DepthRange, 2);
|
2650
|
+
rb_define_module_function(module, "glFrustum", gl_Frustum, 6);
|
2651
|
+
rb_define_module_function(module, "glLoadIdentity", gl_LoadIdentity, 0);
|
2652
|
+
rb_define_module_function(module, "glLoadMatrixf", gl_LoadMatrixf, 1);
|
2653
|
+
rb_define_module_function(module, "glLoadMatrixd", gl_LoadMatrixd, 1);
|
2654
|
+
rb_define_module_function(module, "glMatrixMode", gl_MatrixMode, 1);
|
2655
|
+
rb_define_module_function(module, "glMultMatrixf", gl_MultMatrixf, 1);
|
2656
|
+
rb_define_module_function(module, "glMultMatrixd", gl_MultMatrixd, 1);
|
2657
|
+
rb_define_module_function(module, "glOrtho", gl_Ortho, 6);
|
2658
|
+
rb_define_module_function(module, "glPopMatrix", gl_PopMatrix, 0);
|
2659
|
+
rb_define_module_function(module, "glPushMatrix", gl_PushMatrix, 0);
|
2660
|
+
rb_define_module_function(module, "glRotated", gl_Rotated, 4);
|
2661
|
+
rb_define_module_function(module, "glRotatef", gl_Rotatef, 4);
|
2662
|
+
rb_define_module_function(module, "glScaled", gl_Scaled, 3);
|
2663
|
+
rb_define_module_function(module, "glScalef", gl_Scalef, 3);
|
2664
|
+
rb_define_module_function(module, "glTranslated", gl_Translated, 3);
|
2665
|
+
rb_define_module_function(module, "glTranslatef", gl_Translatef, 3);
|
2666
|
+
rb_define_module_function(module, "glViewport", gl_Viewport, 4);
|
2667
|
+
|
2668
|
+
/* OpenGL 1.1 functions */
|
2669
|
+
rb_define_module_function(module, "glArrayElement", gl_ArrayElement, 1);
|
2670
|
+
rb_define_module_function(module, "glColorPointer", gl_ColorPointer, 4);
|
2671
|
+
rb_define_module_function(module, "glDisableClientState", gl_DisableClientState, 1);
|
2672
|
+
rb_define_module_function(module, "glDrawArrays", gl_DrawArrays, 3);
|
2673
|
+
rb_define_module_function(module, "glDrawElements", gl_DrawElements, 4);
|
2674
|
+
rb_define_module_function(module, "glEdgeFlagPointer", gl_EdgeFlagPointer, 2);
|
2675
|
+
rb_define_module_function(module, "glEnableClientState", gl_EnableClientState, 1);
|
2676
|
+
rb_define_module_function(module, "glGetPointerv", gl_GetPointerv, 1);
|
2677
|
+
rb_define_module_function(module, "glIndexPointer", gl_IndexPointer, 3);
|
2678
|
+
rb_define_module_function(module, "glInterleavedArrays", gl_InterleavedArrays, 3);
|
2679
|
+
rb_define_module_function(module, "glNormalPointer", gl_NormalPointer, 3);
|
2680
|
+
rb_define_module_function(module, "glTexCoordPointer", gl_TexCoordPointer, 4);
|
2681
|
+
rb_define_module_function(module, "glVertexPointer", gl_VertexPointer, 4);
|
2682
|
+
rb_define_module_function(module, "glPolygonOffset", gl_PolygonOffset, 2);
|
2683
|
+
rb_define_module_function(module, "glCopyTexImage1D", gl_CopyTexImage1D, 7);
|
2684
|
+
rb_define_module_function(module, "glCopyTexImage2D", gl_CopyTexImage2D, 8);
|
2685
|
+
rb_define_module_function(module, "glCopyTexSubImage1D", gl_CopyTexSubImage1D, 6);
|
2686
|
+
rb_define_module_function(module, "glCopyTexSubImage2D", gl_CopyTexSubImage2D, 8);
|
2687
|
+
rb_define_module_function(module, "glTexSubImage1D", gl_TexSubImage1D, 7);
|
2688
|
+
rb_define_module_function(module, "glTexSubImage2D", gl_TexSubImage2D, 9);
|
2689
|
+
rb_define_module_function(module, "glAreTexturesResident", gl_AreTexturesResident, 1);
|
2690
|
+
rb_define_module_function(module, "glBindTexture", gl_BindTexture, 2);
|
2691
|
+
rb_define_module_function(module, "glDeleteTextures", gl_DeleteTextures, 1);
|
2692
|
+
rb_define_module_function(module, "glGenTextures", gl_GenTextures, 1);
|
2693
|
+
rb_define_module_function(module, "glIsTexture", gl_IsTexture, 1);
|
2694
|
+
rb_define_module_function(module, "glPrioritizeTextures", gl_PrioritizeTextures, 2);
|
2695
|
+
rb_define_module_function(module, "glIndexub", gl_Indexub, 1);
|
2696
|
+
rb_define_module_function(module, "glIndexubv", gl_Indexubv, 1);
|
2697
|
+
rb_define_module_function(module, "glPopClientAttrib", gl_PopClientAttrib, 0);
|
2698
|
+
rb_define_module_function(module, "glPushClientAttrib", gl_PushClientAttrib, 1);
|
2699
|
+
|
2700
|
+
/* additional functions */
|
2701
|
+
rb_define_module_function(module, "glColor", gl_Colordv, -1);
|
2702
|
+
rb_define_module_function(module, "glColor3bv", gl_Colorbv, -1);
|
2703
|
+
rb_define_module_function(module, "glColor3dv", gl_Colordv, -1);
|
2704
|
+
rb_define_module_function(module, "glColor3fv", gl_Colorfv, -1);
|
2705
|
+
rb_define_module_function(module, "glColor3iv", gl_Coloriv, -1);
|
2706
|
+
rb_define_module_function(module, "glColor3sv", gl_Colorsv, -1);
|
2707
|
+
rb_define_module_function(module, "glColor3ubv", gl_Colorubv, -1);
|
2708
|
+
rb_define_module_function(module, "glColor3uiv", gl_Coloruiv, -1);
|
2709
|
+
rb_define_module_function(module, "glColor3usv", gl_Colorusv, -1);
|
2710
|
+
rb_define_module_function(module, "glColor4bv", gl_Colorbv, -1);
|
2711
|
+
rb_define_module_function(module, "glColor4dv", gl_Colordv, -1);
|
2712
|
+
rb_define_module_function(module, "glColor4fv", gl_Colorfv, -1);
|
2713
|
+
rb_define_module_function(module, "glColor4iv", gl_Coloriv, -1);
|
2714
|
+
rb_define_module_function(module, "glColor4sv", gl_Colorsv, -1);
|
2715
|
+
rb_define_module_function(module, "glColor4ubv", gl_Colorubv, -1);
|
2716
|
+
rb_define_module_function(module, "glColor4uiv", gl_Coloruiv, -1);
|
2717
|
+
rb_define_module_function(module, "glColor4usv", gl_Colorusv, -1);
|
2718
|
+
|
2719
|
+
rb_define_module_function(module, "glNormal", gl_Normaldv, -1);
|
2720
|
+
rb_define_module_function(module, "glNormal3bv", gl_Normalbv, -1);
|
2721
|
+
rb_define_module_function(module, "glNormal3dv", gl_Normaldv, -1);
|
2722
|
+
rb_define_module_function(module, "glNormal3fv", gl_Normalfv, -1);
|
2723
|
+
rb_define_module_function(module, "glNormal3iv", gl_Normaliv, -1);
|
2724
|
+
rb_define_module_function(module, "glNormal3sv", gl_Normalsv, -1);
|
2725
|
+
|
2726
|
+
rb_define_module_function(module, "glRasterPos", gl_RasterPosdv, -1);
|
2727
|
+
rb_define_module_function(module, "glRasterPos2dv", gl_RasterPosdv, -1);
|
2728
|
+
rb_define_module_function(module, "glRasterPos2fv", gl_RasterPosfv, -1);
|
2729
|
+
rb_define_module_function(module, "glRasterPos2iv", gl_RasterPosiv, -1);
|
2730
|
+
rb_define_module_function(module, "glRasterPos2sv", gl_RasterPossv, -1);
|
2731
|
+
rb_define_module_function(module, "glRasterPos3dv", gl_RasterPosdv, -1);
|
2732
|
+
rb_define_module_function(module, "glRasterPos3fv", gl_RasterPosfv, -1);
|
2733
|
+
rb_define_module_function(module, "glRasterPos3iv", gl_RasterPosiv, -1);
|
2734
|
+
rb_define_module_function(module, "glRasterPos3sv", gl_RasterPossv, -1);
|
2735
|
+
rb_define_module_function(module, "glRasterPos4dv", gl_RasterPosdv, -1);
|
2736
|
+
rb_define_module_function(module, "glRasterPos4fv", gl_RasterPosfv, -1);
|
2737
|
+
rb_define_module_function(module, "glRasterPos4iv", gl_RasterPosiv, -1);
|
2738
|
+
rb_define_module_function(module, "glRasterPos4sv", gl_RasterPossv, -1);
|
2739
|
+
|
2740
|
+
rb_define_module_function(module, "glRect", gl_Rectdv, -1);
|
2741
|
+
rb_define_module_function(module, "glRectdv", gl_Rectdv, -1);
|
2742
|
+
rb_define_module_function(module, "glRectfv", gl_Rectfv, -1);
|
2743
|
+
rb_define_module_function(module, "glRectiv", gl_Rectiv, -1);
|
2744
|
+
rb_define_module_function(module, "glRectsv", gl_Rectsv, -1);
|
2745
|
+
|
2746
|
+
rb_define_module_function(module, "glTexCoord", gl_TexCoorddv, -1);
|
2747
|
+
rb_define_module_function(module, "glTexCoord1dv", gl_TexCoorddv, -1);
|
2748
|
+
rb_define_module_function(module, "glTexCoord1fv", gl_TexCoordfv, -1);
|
2749
|
+
rb_define_module_function(module, "glTexCoord1iv", gl_TexCoordiv, -1);
|
2750
|
+
rb_define_module_function(module, "glTexCoord1sv", gl_TexCoordsv, -1);
|
2751
|
+
rb_define_module_function(module, "glTexCoord2dv", gl_TexCoorddv, -1);
|
2752
|
+
rb_define_module_function(module, "glTexCoord2fv", gl_TexCoordfv, -1);
|
2753
|
+
rb_define_module_function(module, "glTexCoord2iv", gl_TexCoordiv, -1);
|
2754
|
+
rb_define_module_function(module, "glTexCoord2sv", gl_TexCoordsv, -1);
|
2755
|
+
rb_define_module_function(module, "glTexCoord3dv", gl_TexCoorddv, -1);
|
2756
|
+
rb_define_module_function(module, "glTexCoord3fv", gl_TexCoordfv, -1);
|
2757
|
+
rb_define_module_function(module, "glTexCoord3iv", gl_TexCoordiv, -1);
|
2758
|
+
rb_define_module_function(module, "glTexCoord3sv", gl_TexCoordsv, -1);
|
2759
|
+
rb_define_module_function(module, "glTexCoord4dv", gl_TexCoorddv, -1);
|
2760
|
+
rb_define_module_function(module, "glTexCoord4fv", gl_TexCoordfv, -1);
|
2761
|
+
rb_define_module_function(module, "glTexCoord4iv", gl_TexCoordiv, -1);
|
2762
|
+
rb_define_module_function(module, "glTexCoord4sv", gl_TexCoordsv, -1);
|
2763
|
+
|
2764
|
+
rb_define_module_function(module, "glVertex", gl_Vertexdv, -1);
|
2765
|
+
rb_define_module_function(module, "glVertex2dv", gl_Vertexdv, -1);
|
2766
|
+
rb_define_module_function(module, "glVertex2fv", gl_Vertexfv, -1);
|
2767
|
+
rb_define_module_function(module, "glVertex2iv", gl_Vertexiv, -1);
|
2768
|
+
rb_define_module_function(module, "glVertex2sv", gl_Vertexsv, -1);
|
2769
|
+
rb_define_module_function(module, "glVertex3dv", gl_Vertexdv, -1);
|
2770
|
+
rb_define_module_function(module, "glVertex3fv", gl_Vertexfv, -1);
|
2771
|
+
rb_define_module_function(module, "glVertex3iv", gl_Vertexiv, -1);
|
2772
|
+
rb_define_module_function(module, "glVertex3sv", gl_Vertexsv, -1);
|
2773
|
+
rb_define_module_function(module, "glVertex4dv", gl_Vertexdv, -1);
|
2774
|
+
rb_define_module_function(module, "glVertex4fv", gl_Vertexfv, -1);
|
2775
|
+
rb_define_module_function(module, "glVertex4iv", gl_Vertexiv, -1);
|
2776
|
+
rb_define_module_function(module, "glVertex4sv", gl_Vertexsv, -1);
|
2777
|
+
|
2778
|
+
/* these simply calls normal or vector (*v) function depending on
|
2779
|
+
if array or single value is passed to them */
|
2780
|
+
rb_define_module_function(module, "glLightModel", gl_LightModel, 2);
|
2781
|
+
rb_define_module_function(module, "glMaterial", gl_Material, 3);
|
2782
|
+
rb_define_module_function(module, "glFog", gl_Fog, 2);
|
2783
|
+
rb_define_module_function(module, "glLight", gl_Light, 3);
|
2784
|
+
rb_define_module_function(module, "glTexParameter", gl_TexParameter, 3);
|
2785
|
+
rb_define_module_function(module, "glTexEnv", gl_TexEnv, 3);
|
2786
|
+
rb_define_module_function(module, "glTexGen", gl_TexGen, 3);
|
2787
|
+
|
2788
|
+
/* aliases */
|
2789
|
+
rb_define_module_function(module, "glMultMatrix", gl_MultMatrixd, 1);
|
2790
|
+
rb_define_module_function(module, "glLoadMatrix", gl_LoadMatrixd, 1);
|
2791
|
+
rb_define_module_function(module, "glRotate", gl_Rotated, 4);
|
2792
|
+
rb_define_module_function(module, "glScale", gl_Scaled, 3);
|
2793
|
+
rb_define_module_function(module, "glTranslate", gl_Translated, 3);
|
2794
|
+
|
2795
|
+
rb_define_module_function(module, "glPixelStore", gl_PixelStoref, 2);
|
2796
|
+
rb_define_module_function(module, "glPixelTransfer", gl_PixelTransferf, 2);
|
2797
|
+
rb_define_module_function(module, "glIndex", gl_Indexi, 1);
|
2798
|
+
rb_define_module_function(module, "glGetMaterial", gl_GetMaterialfv, 2);
|
2799
|
+
rb_define_module_function(module, "glGetDouble", gl_GetDoublev, 1);
|
2800
|
+
|
2801
|
+
rb_global_variable(&g_current_sel_buffer);
|
2802
|
+
rb_global_variable(&g_current_feed_buffer);
|
2803
|
+
rb_global_variable(&g_Vertex_ptr);
|
2804
|
+
rb_global_variable(&g_Normal_ptr);
|
2805
|
+
rb_global_variable(&g_Color_ptr);
|
2806
|
+
rb_global_variable(&g_Index_ptr);
|
2807
|
+
rb_global_variable(&g_TexCoord_ptr);
|
2808
|
+
rb_global_variable(&g_EdgeFlag_ptr);
|
2809
|
+
rb_global_variable(&g_FogCoord_ptr);
|
2810
|
+
rb_global_variable(&g_SecondaryColor_ptr);
|
2811
|
+
}
|