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