opengl 0.7.0.pre1-x86-mingw32 → 0.7.0.pre2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +29 -0
- data/.gitignore +5 -8
- data/History.rdoc +33 -0
- data/Manifest.txt +72 -57
- data/README.rdoc +72 -25
- data/Rakefile +60 -72
- data/Rakefile.cross +5 -2
- data/{doc → docs}/build_install.txt +0 -0
- data/{doc → docs}/extensions.txt.in +0 -0
- data/{doc → docs}/history.txt +0 -0
- data/{doc → docs}/requirements_and_design.txt +0 -0
- data/{doc → docs}/roadmap.txt +0 -0
- data/{doc → docs}/scientific_use.txt +0 -0
- data/{doc → docs}/supplies/page_template.html +0 -0
- data/{doc → docs}/thanks.txt +0 -0
- data/{doc → docs}/tutorial.txt +0 -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 +82 -83
- data/examples/NeHe/nehe_lesson03.rb +88 -88
- data/examples/NeHe/nehe_lesson04.rb +93 -96
- data/examples/NeHe/nehe_lesson05.rb +137 -144
- data/examples/NeHe/nehe_lesson06.rb +183 -0
- data/examples/NeHe/nehe_lesson07.rb +237 -0
- data/examples/NeHe/nehe_lesson08.rb +252 -0
- data/examples/NeHe/nehe_lesson09.rb +199 -0
- data/examples/NeHe/nehe_lesson11.rb +173 -0
- data/examples/NeHe/nehe_lesson12.rb +200 -0
- data/examples/NeHe/nehe_lesson16.rb +208 -0
- data/examples/NeHe/nehe_lesson19.rb +206 -0
- data/examples/NeHe/particle.png +0 -0
- data/examples/NeHe/star.png +0 -0
- data/examples/NeHe/tim.png +0 -0
- data/examples/RedBook/light.rb +154 -0
- data/examples/misc/OGLBench.rb +2 -2
- data/examples/misc/trislam.rb +2 -2
- data/ext/{common → opengl}/common.h +2 -11
- data/ext/{common → opengl}/conv.h +43 -31
- data/ext/{glut → opengl}/extconf.rb +14 -7
- data/ext/{common → opengl}/funcdef.h +155 -125
- data/ext/{gl → opengl}/gl-1.0-1.1.c +426 -162
- data/ext/{gl → opengl}/gl-1.2.c +70 -66
- data/ext/{gl → opengl}/gl-1.3.c +19 -19
- data/ext/{gl → opengl}/gl-1.4.c +23 -23
- data/ext/{gl → opengl}/gl-1.5.c +46 -47
- data/ext/{gl → opengl}/gl-2.0.c +66 -60
- data/ext/{gl → opengl}/gl-2.1.c +4 -4
- data/ext/{gl → opengl}/gl-enums.c +2 -1
- data/ext/{common → opengl}/gl-enums.h +0 -0
- data/ext/{gl → opengl}/gl-error.c +12 -4
- data/ext/{common → opengl}/gl-error.h +7 -2
- data/ext/{gl → opengl}/gl-ext-3dfx.c +1 -1
- data/ext/{gl → opengl}/gl-ext-arb.c +75 -70
- data/ext/{gl → opengl}/gl-ext-ati.c +3 -3
- data/ext/{gl → opengl}/gl-ext-ext.c +54 -54
- data/ext/{gl → opengl}/gl-ext-gremedy.c +3 -3
- data/ext/{gl → opengl}/gl-ext-nv.c +49 -48
- data/ext/{common → opengl}/gl-types.h +0 -0
- data/ext/{gl → opengl}/gl.c +8 -10
- data/ext/{glu → opengl}/glu-enums.c +1 -1
- data/ext/{common → opengl}/glu-enums.h +0 -0
- data/ext/{glu → opengl}/glu.c +7 -3
- data/ext/{glut → opengl}/glut.c +98 -48
- data/ext/opengl/opengl.c +11 -0
- data/lib/gl.rb +1 -0
- data/lib/glu.rb +1 -0
- data/lib/glut.rb +1 -0
- data/lib/opengl.rb +13 -14
- data/lib/opengl/opengl.so +0 -0
- data/lib/opengl/test_case.rb +87 -0
- data/test/{tc_misc.rb → test_gl.rb} +2 -14
- data/test/test_gl_10_11.rb +1363 -0
- data/test/test_gl_12.rb +182 -0
- data/test/{tc_func_13.rb → test_gl_13.rb} +14 -14
- data/test/test_gl_14.rb +221 -0
- data/test/test_gl_15.rb +260 -0
- data/test/test_gl_20.rb +430 -0
- data/test/test_gl_21.rb +553 -0
- data/test/test_gl_ext_arb.rb +526 -0
- data/test/{tc_ext_ati.rb → test_gl_ext_ati.rb} +11 -14
- data/test/test_gl_ext_ext.rb +608 -0
- data/test/{tc_ext_gremedy.rb → test_gl_ext_gremedy.rb} +6 -6
- data/test/test_gl_ext_nv.rb +352 -0
- data/test/test_glu.rb +309 -0
- metadata +159 -102
- data/History.txt +0 -36
- data/ext/gl/extconf.rb +0 -43
- data/ext/glu/extconf.rb +0 -51
- data/test/README +0 -10
- data/test/tc_common.rb +0 -98
- data/test/tc_ext_arb.rb +0 -467
- data/test/tc_ext_ext.rb +0 -551
- data/test/tc_ext_nv.rb +0 -357
- data/test/tc_func_10_11.rb +0 -1281
- data/test/tc_func_12.rb +0 -186
- data/test/tc_func_14.rb +0 -197
- data/test/tc_func_15.rb +0 -270
- data/test/tc_func_20.rb +0 -346
- data/test/tc_func_21.rb +0 -541
- data/test/tc_glu.rb +0 -310
- data/test/tc_include_gl.rb +0 -35
- data/test/tc_require_gl.rb +0 -34
@@ -0,0 +1,526 @@
|
|
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
|
+
require 'opengl/test_case'
|
17
|
+
|
18
|
+
class TestGlExtArb < OpenGL::TestCase
|
19
|
+
|
20
|
+
def test_gl_arb_transpose_matrix
|
21
|
+
supported? "GL_ARB_transpose_matrix"
|
22
|
+
m_a = [[1.0, 2.0, 3.0, 4.0],
|
23
|
+
[0.0, 2.0, 0.0, 0.0],
|
24
|
+
[0.0, 0.0, 2.0, 0.0],
|
25
|
+
[0.0, 0.0, 0.0, 2.0]]
|
26
|
+
|
27
|
+
m_b = [[1.0, 2.0, 3.0, 4.0],
|
28
|
+
[0.0, 3.0, 0.0, 0.0],
|
29
|
+
[0.0, 0.0, 3.0, 0.0],
|
30
|
+
[0.0, 0.0, 0.0, 3.0]]
|
31
|
+
|
32
|
+
glMatrixMode(GL_MODELVIEW)
|
33
|
+
glLoadTransposeMatrixfARB(m_a)
|
34
|
+
assert_equal m_a, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB)
|
35
|
+
|
36
|
+
glLoadTransposeMatrixdARB(m_b)
|
37
|
+
assert_equal m_b, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB)
|
38
|
+
|
39
|
+
glLoadIdentity()
|
40
|
+
glMultTransposeMatrixfARB(m_a)
|
41
|
+
assert_equal m_a, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB)
|
42
|
+
|
43
|
+
glLoadIdentity()
|
44
|
+
glMultTransposeMatrixdARB(m_b)
|
45
|
+
assert_equal m_b, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB)
|
46
|
+
|
47
|
+
# 2
|
48
|
+
m = Matrix.rows([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])
|
49
|
+
glMatrixMode(GL_MODELVIEW)
|
50
|
+
glLoadTransposeMatrixfARB(m)
|
51
|
+
assert_equal m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX)
|
52
|
+
glLoadIdentity()
|
53
|
+
glLoadTransposeMatrixdARB(m)
|
54
|
+
assert_equal m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX)
|
55
|
+
glLoadIdentity()
|
56
|
+
glMultTransposeMatrixfARB(m)
|
57
|
+
assert_equal m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX)
|
58
|
+
glLoadIdentity()
|
59
|
+
glMultTransposeMatrixdARB(m)
|
60
|
+
assert_equal m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX)
|
61
|
+
|
62
|
+
assert_raises ArgumentError do glLoadTransposeMatrixfARB([1, 2, 3, 4]) end
|
63
|
+
assert_raises ArgumentError do glLoadTransposeMatrixdARB([1, 2, 3, 4]) end
|
64
|
+
assert_raises ArgumentError do glMultTransposeMatrixfARB([1, 2, 3, 4]) end
|
65
|
+
assert_raises ArgumentError do glMultTransposeMatrixdARB([1, 2, 3, 4]) end
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_gl_arb_multisample
|
69
|
+
supported? "GL_ARB_multisample"
|
70
|
+
glSampleCoverageARB(0.5, GL_FALSE)
|
71
|
+
assert_equal 0.5, glGetFloatv(GL_SAMPLE_COVERAGE_VALUE_ARB)
|
72
|
+
assert_equal false, glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT_ARB)
|
73
|
+
glSampleCoverageARB(1.0, GL_TRUE)
|
74
|
+
assert_equal 1.0, glGetFloatv(GL_SAMPLE_COVERAGE_VALUE_ARB)
|
75
|
+
assert_equal true, glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT_ARB)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_gl_arb_color_buffer_float
|
79
|
+
supported? "GL_ARB_color_buffer_float"
|
80
|
+
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FIXED_ONLY_ARB)
|
81
|
+
assert_equal GL_FIXED_ONLY_ARB, glGetIntegerv(GL_CLAMP_VERTEX_COLOR_ARB)
|
82
|
+
|
83
|
+
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_TRUE)
|
84
|
+
assert_equal GL_TRUE, glGetBooleanv(GL_CLAMP_VERTEX_COLOR_ARB)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_gl_arb_vertex_program
|
88
|
+
supported? "GL_ARB_vertex_program"
|
89
|
+
|
90
|
+
assert_equal(glIsProgramARB(0), false)
|
91
|
+
programs = glGenProgramsARB(1)
|
92
|
+
assert_equal(programs.size, 1)
|
93
|
+
|
94
|
+
program = "!!ARBvp1.0\nTEMP vv;\nEND"
|
95
|
+
|
96
|
+
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, programs[0])
|
97
|
+
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, program)
|
98
|
+
assert_equal program, glGetProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_STRING_ARB)
|
99
|
+
assert_equal(glIsProgramARB(programs[0]), true)
|
100
|
+
|
101
|
+
assert_equal program.size, glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_LENGTH_ARB)
|
102
|
+
assert_equal programs[0], glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB)
|
103
|
+
|
104
|
+
glEnableVertexAttribArrayARB(1)
|
105
|
+
assert_equal GL_TRUE, glGetVertexAttribivARB(1, GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB)
|
106
|
+
glDisableVertexAttribArrayARB(1)
|
107
|
+
assert_equal GL_FALSE, glGetVertexAttribivARB(1, GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB)
|
108
|
+
|
109
|
+
glVertexAttribPointerARB(1, 2, GL_FLOAT, GL_FALSE, 0, [1, 1].pack("f*"))
|
110
|
+
assert_each_in_delta([1, 1], glGetVertexAttribPointervARB(1).unpack("f*"))
|
111
|
+
|
112
|
+
glProgramEnvParameter4dARB(GL_VERTEX_PROGRAM_ARB, 1, 1, 2, 3, 4)
|
113
|
+
assert_equal([1, 2, 3, 4], glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
114
|
+
glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, 1, 5, 6, 7, 8)
|
115
|
+
assert_equal([5, 6, 7, 8], glGetProgramEnvParameterfvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
116
|
+
glProgramEnvParameter4dvARB(GL_VERTEX_PROGRAM_ARB, 1, [1, 2, 3, 4])
|
117
|
+
assert_equal([1, 2, 3, 4], glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
118
|
+
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 1, [5, 6, 7, 8])
|
119
|
+
assert_equal([5, 6, 7, 8], glGetProgramEnvParameterfvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
120
|
+
|
121
|
+
glProgramLocalParameter4dARB(GL_VERTEX_PROGRAM_ARB, 1, 1, 2, 3, 4)
|
122
|
+
assert_equal([1, 2, 3, 4], glGetProgramLocalParameterdvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
123
|
+
glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 1, 5, 6, 7, 8)
|
124
|
+
assert_equal([5, 6, 7, 8], glGetProgramLocalParameterfvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
125
|
+
glProgramLocalParameter4dvARB(GL_VERTEX_PROGRAM_ARB, 1, [1, 2, 3, 4])
|
126
|
+
assert_equal([1, 2, 3, 4], glGetProgramLocalParameterdvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
127
|
+
glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 1, [5, 6, 7, 8])
|
128
|
+
assert_equal([5, 6, 7, 8], glGetProgramLocalParameterfvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
129
|
+
|
130
|
+
glVertexAttrib1dARB(1, 1)
|
131
|
+
assert_equal(glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0], 1)
|
132
|
+
glVertexAttrib1fARB(1, 2)
|
133
|
+
assert_equal(glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0], 2)
|
134
|
+
glVertexAttrib1sARB(1, 3)
|
135
|
+
assert_equal(glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0], 3)
|
136
|
+
glVertexAttrib1dvARB(1, [1])
|
137
|
+
assert_equal(glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0], 1)
|
138
|
+
glVertexAttrib1fvARB(1, [2])
|
139
|
+
assert_equal(glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0], 2)
|
140
|
+
glVertexAttrib1svARB(1, [3])
|
141
|
+
assert_equal(glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0], 3)
|
142
|
+
|
143
|
+
glVertexAttrib2dARB(1, 1, 2)
|
144
|
+
assert_equal([1, 2], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
145
|
+
glVertexAttrib2fARB(1, 2, 3)
|
146
|
+
assert_equal([2, 3], glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
147
|
+
glVertexAttrib2sARB(1, 3, 4)
|
148
|
+
assert_equal([3, 4], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
149
|
+
glVertexAttrib2dvARB(1, [1, 2])
|
150
|
+
assert_equal([1, 2], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
151
|
+
glVertexAttrib2fvARB(1, [2, 3])
|
152
|
+
assert_equal([2, 3], glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
153
|
+
glVertexAttrib2svARB(1, [3, 4])
|
154
|
+
assert_equal([3, 4], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
155
|
+
|
156
|
+
glVertexAttrib3dARB(1, 1, 2, 3)
|
157
|
+
assert_equal([1, 2, 3], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
158
|
+
glVertexAttrib3fARB(1, 2, 3, 4)
|
159
|
+
assert_equal([2, 3, 4], glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
160
|
+
glVertexAttrib3sARB(1, 3, 4, 5)
|
161
|
+
assert_equal([3, 4, 5], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
162
|
+
glVertexAttrib3dvARB(1, [1, 2, 3])
|
163
|
+
assert_equal([1, 2, 3], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
164
|
+
glVertexAttrib3fvARB(1, [2, 3, 4])
|
165
|
+
assert_equal([2, 3, 4], glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
166
|
+
glVertexAttrib3svARB(1, [3, 4, 5])
|
167
|
+
assert_equal([3, 4, 5], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
168
|
+
|
169
|
+
glVertexAttrib4dARB(1, 1, 2, 3, 4)
|
170
|
+
assert_equal([1, 2, 3, 4], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
171
|
+
glVertexAttrib4fARB(1, 2, 3, 4, 5)
|
172
|
+
assert_equal([2, 3, 4, 5], glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
173
|
+
glVertexAttrib4sARB(1, 3, 4, 5, 6)
|
174
|
+
assert_equal([3, 4, 5, 6], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
175
|
+
glVertexAttrib4dvARB(1, [1, 2, 3, 4])
|
176
|
+
assert_equal([1, 2, 3, 4], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
177
|
+
glVertexAttrib4fvARB(1, [2, 3, 4, 5])
|
178
|
+
assert_equal([2, 3, 4, 5], glGetVertexAttribfvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
179
|
+
glVertexAttrib4svARB(1, [3, 4, 5, 6])
|
180
|
+
assert_equal([3, 4, 5, 6], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
181
|
+
|
182
|
+
|
183
|
+
glVertexAttrib4bvARB(1, [1, 2, 3, 4])
|
184
|
+
assert_equal([1, 2, 3, 4], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
185
|
+
glVertexAttrib4ivARB(1, [2, 3, 4, 5])
|
186
|
+
assert_equal([2, 3, 4, 5], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
187
|
+
glVertexAttrib4ubvARB(1, [3, 4, 5, 6])
|
188
|
+
assert_equal([3, 4, 5, 6], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
189
|
+
glVertexAttrib4uivARB(1, [1, 2, 3, 4])
|
190
|
+
assert_equal([1, 2, 3, 4], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
191
|
+
glVertexAttrib4usvARB(1, [2, 3, 4, 5])
|
192
|
+
assert_equal([2, 3, 4, 5], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
193
|
+
|
194
|
+
glVertexAttrib4NbvARB(1, [0, 2**7-1, 0, 2**7-1])
|
195
|
+
assert_equal([0, 1, 0, 1], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
196
|
+
glVertexAttrib4NivARB(1, [2**31-1, 0, 2**31-1, 0])
|
197
|
+
assert_equal([1, 0, 1, 0], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
198
|
+
glVertexAttrib4NsvARB(1, [0, 2**15-1, 0, 2**15-1])
|
199
|
+
assert_equal([0, 1, 0, 1], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
200
|
+
|
201
|
+
glVertexAttrib4NubARB(1, 2**8-1, 0, 2**8-1, 0)
|
202
|
+
assert_equal([1, 0, 1, 0], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
203
|
+
|
204
|
+
glVertexAttrib4NubvARB(1, [0, 2**8-1, 0, 2**8-1])
|
205
|
+
assert_equal([0, 1, 0, 1], glGetVertexAttribdvARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
206
|
+
glVertexAttrib4NuivARB(1, [2**32-1, 0, 2**32-1, 0])
|
207
|
+
assert_equal([1, 0, 1, 0], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
208
|
+
glVertexAttrib4NusvARB(1, [0, 2**16-1, 0, 2**16-1])
|
209
|
+
assert_equal([0, 1, 0, 1], glGetVertexAttribivARB(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 4])
|
210
|
+
|
211
|
+
glDeleteProgramsARB(programs)
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_gl_arb_windowpos
|
215
|
+
supported? "GL_ARB_window_pos"
|
216
|
+
# 2
|
217
|
+
glWindowPos2dARB(1.0, 2.0)
|
218
|
+
assert_equal([1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
219
|
+
glWindowPos2dvARB([2.0, 1.0])
|
220
|
+
assert_equal([2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
221
|
+
glWindowPos2fARB(1.0, 2.0)
|
222
|
+
assert_equal([1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
223
|
+
glWindowPos2fvARB([2.0, 1.0])
|
224
|
+
assert_equal([2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
225
|
+
glWindowPos2iARB(1, 2)
|
226
|
+
assert_equal([1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
227
|
+
glWindowPos2ivARB([2, 1])
|
228
|
+
assert_equal([2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
229
|
+
glWindowPos2sARB(1, 2)
|
230
|
+
assert_equal([1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
231
|
+
glWindowPos2svARB([2, 1])
|
232
|
+
assert_equal([2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
233
|
+
|
234
|
+
# 3
|
235
|
+
glWindowPos3dARB(1.0, 2.0, 0.5)
|
236
|
+
assert_equal([1, 2, 0.5, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
237
|
+
glWindowPos3dvARB([3.0, 2.0, 1.0])
|
238
|
+
assert_equal([3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
239
|
+
glWindowPos3fARB(1.0, 2.0, 0.5)
|
240
|
+
assert_equal([1, 2, 0.5, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
241
|
+
glWindowPos3fvARB([3.0, 2.0, 1.0])
|
242
|
+
assert_equal([3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
243
|
+
glWindowPos3iARB(1, 2, 0)
|
244
|
+
assert_equal([1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
245
|
+
glWindowPos3ivARB([3, 2, 1])
|
246
|
+
assert_equal([3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
247
|
+
glWindowPos3sARB(1, 2, 0)
|
248
|
+
assert_equal([1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
249
|
+
glWindowPos3svARB([3, 2, 1])
|
250
|
+
assert_equal([3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION))
|
251
|
+
end
|
252
|
+
|
253
|
+
def test_gl_arb_pointparameter
|
254
|
+
supported? "GL_ARB_point_parameters"
|
255
|
+
glPointParameterfARB(GL_POINT_SIZE_MIN, 1.0)
|
256
|
+
assert_equal 1.0, glGetDoublev(GL_POINT_SIZE_MIN)
|
257
|
+
|
258
|
+
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION, [1, 0, 1])
|
259
|
+
assert_equal([1, 0, 1], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_gl_arb_occlusion_query
|
263
|
+
supported? "GL_ARB_occlusion_query"
|
264
|
+
|
265
|
+
queries = glGenQueriesARB(2)
|
266
|
+
assert_equal(queries.size, 2)
|
267
|
+
|
268
|
+
glBeginQueryARB(GL_SAMPLES_PASSED, queries[1])
|
269
|
+
assert_equal(glIsQueryARB(queries[1]), true)
|
270
|
+
|
271
|
+
glEndQueryARB(GL_SAMPLES_PASSED)
|
272
|
+
r = glGetQueryObjectivARB(queries[1], GL_QUERY_RESULT_AVAILABLE)
|
273
|
+
assert(r==GL_TRUE || r==GL_FALSE)
|
274
|
+
assert(glGetQueryObjectuivARB(queries[1], GL_QUERY_RESULT)>=0)
|
275
|
+
|
276
|
+
glDeleteQueriesARB(queries)
|
277
|
+
assert_equal(glIsQueryARB(queries[1]), false)
|
278
|
+
end
|
279
|
+
|
280
|
+
def test_gl_arb_shader_objects
|
281
|
+
supported? "GL_ARB_shader_objects"
|
282
|
+
|
283
|
+
vertex_shader_source = "void main() { gl_Position = ftransform();}\n"
|
284
|
+
|
285
|
+
program = glCreateProgramObjectARB()
|
286
|
+
|
287
|
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
288
|
+
|
289
|
+
glShaderSourceARB(vs, vertex_shader_source)
|
290
|
+
assert_equal vertex_shader_source, glGetShaderSourceARB(vs)
|
291
|
+
|
292
|
+
assert_equal GL_SHADER_OBJECT_ARB, glGetObjectParameterivARB(vs, GL_OBJECT_TYPE_ARB)
|
293
|
+
assert_equal GL_SHADER_OBJECT_ARB, glGetObjectParameterfvARB(vs, GL_OBJECT_TYPE_ARB)
|
294
|
+
assert_equal GL_VERTEX_SHADER, glGetObjectParameterfvARB(vs, GL_OBJECT_SUBTYPE_ARB)
|
295
|
+
glCompileShaderARB(vs)
|
296
|
+
assert_equal GL_TRUE, glGetObjectParameterivARB(vs, GL_OBJECT_COMPILE_STATUS_ARB)
|
297
|
+
|
298
|
+
vslog = glGetInfoLogARB(vs)
|
299
|
+
assert_equal(vslog.class, String)
|
300
|
+
|
301
|
+
glAttachObjectARB(program, vs)
|
302
|
+
assert_equal vs, glGetAttachedObjectsARB(program)
|
303
|
+
|
304
|
+
glLinkProgramARB(program)
|
305
|
+
assert glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB)
|
306
|
+
|
307
|
+
glValidateProgramARB(program)
|
308
|
+
assert glGetObjectParameterivARB(program, GL_OBJECT_VALIDATE_STATUS_ARB)
|
309
|
+
|
310
|
+
glUseProgramObjectARB(program)
|
311
|
+
assert_equal program, glGetIntegerv(GL_CURRENT_PROGRAM)
|
312
|
+
|
313
|
+
assert_equal program, glGetHandleARB(GL_PROGRAM_OBJECT_ARB)
|
314
|
+
|
315
|
+
glUseProgramObjectARB(0)
|
316
|
+
|
317
|
+
glDetachObjectARB(program, vs)
|
318
|
+
|
319
|
+
glDeleteObjectARB(vs)
|
320
|
+
glDeleteObjectARB(program)
|
321
|
+
end
|
322
|
+
|
323
|
+
def test_gl_arb_shader_objects_2
|
324
|
+
supported? "GL_ARB_shader_objects"
|
325
|
+
|
326
|
+
vertex_shader_source = <<-SHADER
|
327
|
+
attribute vec4 test;
|
328
|
+
uniform float testvec1;
|
329
|
+
uniform vec2 testvec2;
|
330
|
+
uniform vec3 testvec3;
|
331
|
+
uniform vec4 testvec4;
|
332
|
+
uniform int testivec1;
|
333
|
+
uniform ivec2 testivec2;
|
334
|
+
uniform ivec3 testivec3;
|
335
|
+
uniform ivec4 testivec4;
|
336
|
+
void main() {
|
337
|
+
testvec1;
|
338
|
+
test;
|
339
|
+
testvec2.x;
|
340
|
+
testvec3.x;
|
341
|
+
testivec1;
|
342
|
+
testivec2.x;
|
343
|
+
testivec3.x;
|
344
|
+
testivec4.x;
|
345
|
+
testvec4;
|
346
|
+
|
347
|
+
gl_Position = ftransform();
|
348
|
+
}
|
349
|
+
SHADER
|
350
|
+
|
351
|
+
program = glCreateProgramObjectARB()
|
352
|
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
353
|
+
glShaderSourceARB(vs, vertex_shader_source)
|
354
|
+
|
355
|
+
glCompileShaderARB(vs)
|
356
|
+
assert_equal GL_TRUE, glGetObjectParameterivARB(vs, GL_OBJECT_COMPILE_STATUS_ARB)
|
357
|
+
|
358
|
+
glAttachObjectARB(program, vs)
|
359
|
+
|
360
|
+
glLinkProgramARB(program)
|
361
|
+
assert_equal GL_TRUE, glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB)
|
362
|
+
|
363
|
+
glUseProgramObjectARB(program)
|
364
|
+
|
365
|
+
assert((tv1l = glGetUniformLocationARB(program, "testvec1"))>=0)
|
366
|
+
assert((tv2l = glGetUniformLocationARB(program, "testvec2"))>=0)
|
367
|
+
assert((tv3l = glGetUniformLocationARB(program, "testvec3"))>=0)
|
368
|
+
assert((tv4l = glGetUniformLocationARB(program, "testvec4"))>=0)
|
369
|
+
assert((tv1il = glGetUniformLocationARB(program, "testivec1"))>=0)
|
370
|
+
assert((tv2il = glGetUniformLocationARB(program, "testivec2"))>=0)
|
371
|
+
assert((tv3il = glGetUniformLocationARB(program, "testivec3"))>=0)
|
372
|
+
assert((tv4il = glGetUniformLocationARB(program, "testivec4"))>=0)
|
373
|
+
|
374
|
+
##
|
375
|
+
|
376
|
+
assert_equal([1, GL_INT, "testivec1"], glGetActiveUniformARB(program, tv1il))
|
377
|
+
|
378
|
+
## f
|
379
|
+
glUniform1fARB(tv1l, 2.0)
|
380
|
+
assert_equal 2.0, glGetUniformfvARB(program, tv1l)
|
381
|
+
glUniform2fARB(tv2l, 2.0, 2.0)
|
382
|
+
assert_equal([2.0, 2.0], glGetUniformfvARB(program, tv2l))
|
383
|
+
glUniform3fARB(tv3l, 2.0, 2.0, 2.0)
|
384
|
+
assert_equal([2.0, 2.0, 2.0], glGetUniformfvARB(program, tv3l))
|
385
|
+
glUniform4fARB(tv4l, 2.0, 2.0, 2.0, 2.0)
|
386
|
+
assert_equal([2.0, 2.0, 2.0, 2.0], glGetUniformfvARB(program, tv4l))
|
387
|
+
# i
|
388
|
+
glUniform1iARB(tv1il, 3)
|
389
|
+
assert_equal 3, glGetUniformivARB(program, tv1il)
|
390
|
+
glUniform2iARB(tv2il, 3, 3)
|
391
|
+
assert_equal([3, 3], glGetUniformivARB(program, tv2il))
|
392
|
+
glUniform3iARB(tv3il, 3, 3, 3)
|
393
|
+
assert_equal([3, 3, 3], glGetUniformivARB(program, tv3il))
|
394
|
+
glUniform4iARB(tv4il, 3, 3, 3, 3)
|
395
|
+
assert_equal([3, 3, 3, 3], glGetUniformivARB(program, tv4il))
|
396
|
+
# fv
|
397
|
+
glUniform1fvARB(tv1l, [3.0])
|
398
|
+
assert_equal 3.0, glGetUniformfvARB(program, tv1l)
|
399
|
+
glUniform2fvARB(tv2l, [3.0, 3.0])
|
400
|
+
assert_equal([3.0, 3.0], glGetUniformfvARB(program, tv2l))
|
401
|
+
glUniform3fvARB(tv3l, [3.0, 3.0, 3.0])
|
402
|
+
assert_equal([3.0, 3.0, 3.0], glGetUniformfvARB(program, tv3l))
|
403
|
+
glUniform4fvARB(tv4l, [3.0, 3.0, 3.0, 3.0])
|
404
|
+
assert_equal([3.0, 3.0, 3.0, 3.0], glGetUniformfvARB(program, tv4l))
|
405
|
+
# iv
|
406
|
+
glUniform1ivARB(tv1il, [2])
|
407
|
+
assert_equal 2, glGetUniformivARB(program, tv1il)
|
408
|
+
glUniform2ivARB(tv2il, [2, 2])
|
409
|
+
assert_equal([2, 2], glGetUniformivARB(program, tv2il))
|
410
|
+
glUniform3ivARB(tv3il, [2, 2, 2])
|
411
|
+
assert_equal([2, 2, 2], glGetUniformivARB(program, tv3il))
|
412
|
+
glUniform4ivARB(tv4il, [2, 2, 2, 2])
|
413
|
+
assert_equal([2, 2, 2, 2], glGetUniformivARB(program, tv4il))
|
414
|
+
|
415
|
+
glDeleteObjectARB(vs)
|
416
|
+
glDeleteObjectARB(program)
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_gl_arb_shader_objects_3
|
420
|
+
supported? "GL_ARB_shader_objects"
|
421
|
+
|
422
|
+
vertex_shader_source = "uniform mat2 testmat2; uniform mat3 testmat3; uniform mat4 testmat4; void main() { gl_Position = gl_Vertex * testmat4[0].x * testmat3[0].x * testmat2[0].x;}"
|
423
|
+
|
424
|
+
program = glCreateProgramObjectARB()
|
425
|
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
426
|
+
glShaderSourceARB(vs, vertex_shader_source)
|
427
|
+
|
428
|
+
glCompileShaderARB(vs)
|
429
|
+
assert_equal GL_TRUE, glGetObjectParameterivARB(vs, GL_OBJECT_COMPILE_STATUS_ARB)
|
430
|
+
|
431
|
+
glAttachObjectARB(program, vs)
|
432
|
+
|
433
|
+
glLinkProgramARB(program)
|
434
|
+
assert_equal GL_TRUE, glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB)
|
435
|
+
|
436
|
+
glUseProgramObjectARB(program)
|
437
|
+
|
438
|
+
refute_equal(-1, glGetUniformLocation(program, "testmat2"),
|
439
|
+
"testmat2 missing!")
|
440
|
+
refute_equal(-1, glGetUniformLocation(program, "testmat3"),
|
441
|
+
"testmat3 missing!")
|
442
|
+
refute_equal(-1, glGetUniformLocation(program, "testmat4"),
|
443
|
+
"testmat4 missing!")
|
444
|
+
|
445
|
+
uniforms = Hash.new do |_, k| raise "invalid uniform #{k}" end
|
446
|
+
(0...glGetProgramiv(program, GL_ACTIVE_UNIFORMS)).each do |i|
|
447
|
+
uniform = glGetActiveUniform program, i
|
448
|
+
uniforms[uniform.last] = i
|
449
|
+
end
|
450
|
+
|
451
|
+
glUniformMatrix2fvARB(uniforms['testmat2'], GL_TRUE, [0, 1, 1, 0])
|
452
|
+
assert_each_in_delta([0, 1, 1, 0],
|
453
|
+
glGetUniformfvARB(program, uniforms['testmat2']))
|
454
|
+
|
455
|
+
skip "glUniformMatrix3fvARB complains but I don't know why"
|
456
|
+
glUniformMatrix3fvARB(uniforms['testmat3'], GL_TRUE,
|
457
|
+
[0, 1, 0, 1, 0, 1, 0, 1, 0])
|
458
|
+
assert_each_in_delta([0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
|
459
|
+
glGetUniformfvARB(program, uniforms['testmat3']))
|
460
|
+
|
461
|
+
glUniformMatrix4fvARB(uniforms['testmat4'], GL_TRUE,
|
462
|
+
[0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0])
|
463
|
+
assert_each_in_delta([0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0],
|
464
|
+
glGetUniformfvARB(program, uniforms['testmat4']))
|
465
|
+
|
466
|
+
glDeleteObjectARB(vs)
|
467
|
+
glDeleteObjectARB(program)
|
468
|
+
end
|
469
|
+
|
470
|
+
def test_gl_arb_vertex_shader
|
471
|
+
supported? "GL_ARB_vertex_shader"
|
472
|
+
|
473
|
+
vertex_shader_source = <<-SHADER
|
474
|
+
attribute vec4 test;
|
475
|
+
|
476
|
+
uniform float testvec1;
|
477
|
+
uniform vec2 testvec2;
|
478
|
+
uniform vec3 testvec3;
|
479
|
+
uniform vec4 testvec4;
|
480
|
+
|
481
|
+
uniform int testivec1;
|
482
|
+
uniform ivec2 testivec2;
|
483
|
+
uniform ivec3 testivec3;
|
484
|
+
uniform ivec4 testivec4;
|
485
|
+
|
486
|
+
void main() {
|
487
|
+
testvec1;
|
488
|
+
test;
|
489
|
+
testvec2.x;
|
490
|
+
testvec3.x;
|
491
|
+
testivec1;
|
492
|
+
testivec2.x;
|
493
|
+
testivec3.x;
|
494
|
+
testivec4.x;
|
495
|
+
testvec4;
|
496
|
+
|
497
|
+
gl_Position = ftransform();
|
498
|
+
}
|
499
|
+
SHADER
|
500
|
+
|
501
|
+
program = glCreateProgramObjectARB()
|
502
|
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
503
|
+
glShaderSourceARB(vs, vertex_shader_source)
|
504
|
+
|
505
|
+
glCompileShaderARB(vs)
|
506
|
+
assert(glGetObjectParameterivARB(vs, GL_OBJECT_COMPILE_STATUS_ARB),
|
507
|
+
glGetInfoLogARB(vs))
|
508
|
+
|
509
|
+
glAttachObjectARB(program, vs)
|
510
|
+
|
511
|
+
glBindAttribLocationARB(program, 2, "test")
|
512
|
+
|
513
|
+
glLinkProgramARB(program)
|
514
|
+
assert_equal GL_TRUE, glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB)
|
515
|
+
|
516
|
+
glUseProgramObjectARB(program)
|
517
|
+
|
518
|
+
assert_equal 2, glGetAttribLocationARB(program, "test")
|
519
|
+
assert_equal [1, GL_FLOAT_VEC4, "gl_Vertex"], glGetActiveAttribARB(program, 0)
|
520
|
+
|
521
|
+
glDeleteObjectARB(vs)
|
522
|
+
glDeleteObjectARB(program)
|
523
|
+
end
|
524
|
+
|
525
|
+
end
|
526
|
+
|