ruby-opengl 0.33.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +42 -15
- data/doc/build_install.txt +70 -25
- data/doc/history.txt +4 -0
- data/doc/requirements_and_design.txt +2 -3
- data/doc/roadmap.txt +15 -2
- data/doc/screenshots.txt +23 -0
- data/doc/supplies/page_template.html +2 -1
- data/doc/thanks.txt +3 -0
- data/doc/tutorial.txt +5 -3
- data/examples/README +57 -7
- data/examples/legacy/COPYRIGHT +8 -0
- data/examples/{aaindex.rb → legacy/aaindex.rb} +6 -5
- data/examples/legacy/aapoly.rb +153 -0
- data/examples/legacy/aargb.rb +139 -0
- data/examples/legacy/accanti.rb +159 -0
- data/examples/legacy/accpersp.rb +216 -0
- data/examples/legacy/alpha.rb +133 -0
- data/examples/legacy/alpha3D.rb +165 -0
- data/examples/legacy/bezcurve.rb +107 -0
- data/examples/legacy/bezmesh.rb +131 -0
- data/examples/legacy/checker.rb +121 -0
- data/examples/legacy/clip.rb +104 -0
- data/examples/legacy/colormat.rb +145 -0
- data/examples/legacy/cube.rb +73 -0
- data/examples/legacy/depthcue.rb +101 -0
- data/examples/legacy/dof.rb +212 -0
- data/examples/legacy/double.rb +104 -0
- data/examples/legacy/drawf.rb +98 -0
- data/examples/legacy/feedback.rb +152 -0
- data/examples/legacy/fog.rb +172 -0
- data/examples/legacy/font-glut.rb +41 -0
- data/examples/legacy/font.rb +158 -0
- data/examples/legacy/hello.rb +75 -0
- data/examples/legacy/image.rb +145 -0
- data/examples/legacy/jitter.rb +209 -0
- data/examples/legacy/lines.rb +135 -0
- data/examples/legacy/list.rb +120 -0
- data/examples/legacy/material.rb +290 -0
- data/examples/legacy/mipmap.rb +159 -0
- data/examples/legacy/model.rb +119 -0
- data/examples/legacy/movelight.rb +140 -0
- data/examples/legacy/pickdepth.rb +180 -0
- data/examples/legacy/planet.rb +112 -0
- data/examples/legacy/quadric.rb +180 -0
- data/examples/legacy/readpixel.rb +59 -0
- data/examples/legacy/robot.rb +120 -0
- data/examples/legacy/select.rb +207 -0
- data/examples/{smooth_prev.rb → legacy/smooth.rb} +3 -2
- data/examples/legacy/stencil.rb +154 -0
- data/examples/legacy/stroke.rb +170 -0
- data/examples/legacy/surface.rb +170 -0
- data/examples/legacy/teaambient.rb +132 -0
- data/examples/legacy/teapots.rb +188 -0
- data/examples/legacy/tess.rb +222 -0
- data/examples/legacy/texbind.rb +157 -0
- data/examples/legacy/texgen.rb +171 -0
- data/examples/legacy/texturesurf.rb +128 -0
- data/examples/legacy/varray.rb +167 -0
- data/examples/legacy/wrap.rb +158 -0
- data/examples/nehe_lesson02.rb +117 -0
- data/examples/nehe_lesson03.rb +122 -0
- data/examples/nehe_lesson04.rb +133 -0
- data/examples/nehe_lesson05.rb +186 -0
- data/examples/plane.rb +1 -1
- data/examples/smooth.rb +4 -2
- data/examples/test.rb +3 -2
- data/ext/common/{rbogl.c → common.h} +99 -32
- data/ext/common/gl-enums.h +39 -1
- data/ext/gl/gl-1.0-1.1.c +350 -305
- data/ext/gl/gl-1.2.c +933 -38
- data/ext/gl/gl-1.3.c +725 -0
- data/ext/gl/gl-1.4.c +647 -0
- data/ext/gl/gl-1.5.c +362 -0
- data/ext/gl/gl-2.0.c +1632 -0
- data/ext/gl/gl-2.1.c +154 -0
- data/ext/gl/gl-enums.c +1 -2
- data/ext/gl/gl.c +58 -2
- data/ext/gl/mkrf_conf.rb +4 -1
- data/ext/glu/glu.c +5 -4
- data/ext/glu/mkrf_conf.rb +4 -1
- data/ext/glut/glut.c +7 -1
- data/ext/glut/mkrf_conf.rb +5 -0
- data/lib/gl_prev.rb +4 -3
- data/lib/glu_prev.rb +4 -3
- data/lib/glut_prev.rb +3 -3
- data/{examples/all_tests.rb → lib/opengl.rb} +9 -12
- data/test/README +5 -18
- data/test/tc_common.rb +79 -0
- data/test/tc_func_10_11.rb +1255 -0
- data/test/tc_func_12.rb +186 -0
- data/test/tc_func_13.rb +203 -0
- data/test/tc_func_14.rb +197 -0
- data/test/tc_func_15.rb +82 -0
- data/test/tc_func_20.rb +320 -0
- data/test/tc_func_21.rb +67 -0
- data/test/tc_include_gl.rb +1 -1
- data/test/{tc_opengl_namespace.rb → tc_misc.rb} +20 -20
- data/test/tc_require_gl.rb +1 -1
- metadata +99 -27
- data/ext/common/Rakefile +0 -39
- data/ext/common/rbogl.h +0 -52
- data/test/runtests.sh +0 -7
- data/test/tc_gl_vertex.rb +0 -180
data/test/tc_func_12.rb
ADDED
@@ -0,0 +1,186 @@
|
|
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 'test/unit'
|
17
|
+
|
18
|
+
class Test_12 < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_glblend
|
28
|
+
return if not supported?(["glBlendColor","glBlendEquation"])
|
29
|
+
glBlendColor(0.0,1.0,0.0,1.0)
|
30
|
+
assert_equal(glGetDoublev(GL_BLEND_COLOR),[0,1,0,1])
|
31
|
+
|
32
|
+
glBlendEquation(GL_MIN)
|
33
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION),GL_MIN)
|
34
|
+
glBlendEquation(GL_MAX)
|
35
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION),GL_MAX)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_gldrawrangeelements
|
39
|
+
return if not supported?(["glDrawRangeElements"])
|
40
|
+
va = [0,0, 0,1, 1,1].pack("f*")
|
41
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
42
|
+
|
43
|
+
buf = glFeedbackBuffer(256,GL_3D)
|
44
|
+
glRenderMode(GL_FEEDBACK)
|
45
|
+
|
46
|
+
glEnable(GL_VERTEX_ARRAY)
|
47
|
+
|
48
|
+
glDrawRangeElements(GL_POINTS,0,2,3,GL_UNSIGNED_BYTE,[0,1,2].pack("C*"))
|
49
|
+
count = glRenderMode(GL_RENDER)
|
50
|
+
assert_equal(count,12)
|
51
|
+
|
52
|
+
glDisable(GL_VERTEX_ARRAY)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_colortable
|
56
|
+
return if not supported?(["glColorTable","glGetColorTable","glColorSubTable","glCopyColorTable","glCopyColorSubTable","glColorTableParameterfv","glColorTableParameteriv","glGetColorTableParameterfv","glGetColorTableParameteriv"])
|
57
|
+
|
58
|
+
ct = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
59
|
+
ct2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
60
|
+
glColorTable(GL_COLOR_TABLE,GL_RGB8,4,GL_RGB,GL_FLOAT,ct)
|
61
|
+
assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct)
|
62
|
+
|
63
|
+
glColorSubTable(GL_COLOR_TABLE,0,4,GL_RGB,GL_FLOAT,ct2)
|
64
|
+
assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct2)
|
65
|
+
|
66
|
+
glDrawPixels(4,1,GL_RGB,GL_FLOAT,ct)
|
67
|
+
glCopyColorTable(GL_COLOR_TABLE,GL_RGB8,0,0,4)
|
68
|
+
assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct)
|
69
|
+
|
70
|
+
glDrawPixels(4,1,GL_RGB,GL_FLOAT,ct2)
|
71
|
+
glCopyColorSubTable(GL_COLOR_TABLE,0,0,0,4)
|
72
|
+
assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct2)
|
73
|
+
|
74
|
+
glColorTableParameterfv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS,[0,1,0,1])
|
75
|
+
assert_equal(glGetColorTableParameterfv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS),[0,1,0,1])
|
76
|
+
|
77
|
+
glColorTableParameteriv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS,[1,0,1,0])
|
78
|
+
assert_equal(glGetColorTableParameteriv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS),[1,0,1,0])
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_convolutionfilter
|
82
|
+
return if not supported?(["glConvolutionFilter1D","glConvolutionFilter2D","glGetConvolutionFilter","glCopyConvolutionFilter1D","glCopyConvolutionFilter2D","glConvolutionParameterf","glConvolutionParameterfv","glConvolutionParameteri","glConvolutionParameteriv","glGetConvolutionParameterfv","glGetConvolutionParameteriv"])
|
83
|
+
|
84
|
+
cf = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
85
|
+
cf2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
86
|
+
glConvolutionFilter1D(GL_CONVOLUTION_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT,cf)
|
87
|
+
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf)
|
88
|
+
|
89
|
+
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB8, 2,2, GL_RGB, GL_FLOAT,cf2)
|
90
|
+
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf2)
|
91
|
+
|
92
|
+
glDrawPixels(4,1,GL_RGB,GL_FLOAT,cf2)
|
93
|
+
glCopyConvolutionFilter1D(GL_CONVOLUTION_1D,GL_RGB8,0,0,4)
|
94
|
+
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf2)
|
95
|
+
|
96
|
+
glDrawPixels(2,2,GL_RGB,GL_FLOAT,cf)
|
97
|
+
glCopyConvolutionFilter2D(GL_CONVOLUTION_2D,GL_RGB8,0,0,2,2)
|
98
|
+
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf)
|
99
|
+
|
100
|
+
glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_CONSTANT_BORDER)
|
101
|
+
assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),[GL_CONSTANT_BORDER])
|
102
|
+
|
103
|
+
glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
|
104
|
+
assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),[GL_REPLICATE_BORDER])
|
105
|
+
|
106
|
+
glConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
|
107
|
+
assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),[GL_CONSTANT_BORDER])
|
108
|
+
|
109
|
+
glConvolutionParameteri(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
|
110
|
+
assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),[GL_REPLICATE_BORDER])
|
111
|
+
|
112
|
+
glConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
|
113
|
+
assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),[GL_CONSTANT_BORDER])
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_separablefilter
|
117
|
+
return if not supported?(["glSeparableFilter2D","glGetSeparableFilter"])
|
118
|
+
sf_a = ([0]*3+[1]*3).pack("f*")
|
119
|
+
sf_b = ([1]*3+[0]*3).pack("f*")
|
120
|
+
|
121
|
+
glSeparableFilter2D(GL_SEPARABLE_2D,GL_RGB8, 2,2,GL_RGB,GL_FLOAT,sf_a,sf_b)
|
122
|
+
assert_equal(glGetSeparableFilter(GL_SEPARABLE_2D,GL_RGB,GL_FLOAT), [sf_a,sf_b])
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_histogram
|
126
|
+
return if not supported?(["glHistogram","glGetHistogram","glResetHistogram","glGetHistogramParameterfv","glGetHistogramParameteriv"])
|
127
|
+
|
128
|
+
glEnable(GL_HISTOGRAM)
|
129
|
+
|
130
|
+
glHistogram(GL_HISTOGRAM,1,GL_RGB8,GL_FALSE)
|
131
|
+
assert_equal(glGetHistogramParameterfv(GL_HISTOGRAM,GL_HISTOGRAM_WIDTH),[1])
|
132
|
+
assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM,GL_HISTOGRAM_FORMAT),[GL_RGB8])
|
133
|
+
assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM,GL_HISTOGRAM_SINK),[GL_FALSE])
|
134
|
+
|
135
|
+
glDrawPixels(2,1,GL_RGB,GL_FLOAT,[1,1,1,1,1,1].pack("f*"))
|
136
|
+
h = glGetHistogram(GL_HISTOGRAM,GL_FALSE,GL_RGB,GL_FLOAT)
|
137
|
+
assert_equal(h.unpack("f*"),[2,2,2])
|
138
|
+
glResetHistogram(GL_HISTOGRAM)
|
139
|
+
h = glGetHistogram(GL_HISTOGRAM,GL_FALSE,GL_RGB,GL_FLOAT)
|
140
|
+
assert_equal(h.unpack("f*"),[0,0,0])
|
141
|
+
|
142
|
+
glDisable(GL_HISTOGRAM)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_minmax
|
146
|
+
return if not supported?(["glMinmax","glGetMinmax","glResetMinmax","glGetMinmaxParameterfv","glGetMinmaxParameteriv"])
|
147
|
+
|
148
|
+
glEnable(GL_MINMAX)
|
149
|
+
|
150
|
+
glMinmax(GL_MINMAX,GL_RGB8,GL_FALSE)
|
151
|
+
assert_equal(glGetMinmaxParameteriv(GL_MINMAX,GL_MINMAX_FORMAT),[GL_RGB8])
|
152
|
+
assert_equal(glGetMinmaxParameterfv(GL_MINMAX,GL_MINMAX_FORMAT),[GL_RGB8])
|
153
|
+
assert_equal(glGetMinmaxParameterfv(GL_MINMAX,GL_MINMAX_SINK),[GL_FALSE])
|
154
|
+
|
155
|
+
glDrawPixels(2,1,GL_RGB,GL_FLOAT,[0,0,0,1,1,1].pack("f*"))
|
156
|
+
mm = glGetMinmax(GL_MINMAX,GL_FALSE,GL_RGB,GL_FLOAT)
|
157
|
+
assert_equal(mm.unpack("f*"),[0,0,0,1,1,1])
|
158
|
+
glResetMinmax(GL_MINMAX)
|
159
|
+
mm = glGetMinmax(GL_MINMAX,GL_FALSE,GL_RGB,GL_UNSIGNED_BYTE)
|
160
|
+
assert(approx_equal(mm.unpack("f*"),[0,0,0,0,0,0]))
|
161
|
+
|
162
|
+
glDisable(GL_MINMAX)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_texture_3D
|
166
|
+
return if not supported?(["glTexImage3D","glTexSubImage3D","glCopyTexSubImage3D"])
|
167
|
+
image = ([0,0,0,1,1,1] * 2 * 2).pack("f*")
|
168
|
+
image2 = ([1,1,1,0,0,0] * 2 * 2).pack("f*")
|
169
|
+
|
170
|
+
textures = glGenTextures(1)
|
171
|
+
glBindTexture(GL_TEXTURE_3D,textures[0])
|
172
|
+
|
173
|
+
glTexImage3D(GL_TEXTURE_3D,0,GL_RGB8,2,2,2,0,GL_RGB,GL_FLOAT,image)
|
174
|
+
assert_equal(glGetTexImage(GL_TEXTURE_3D,0,GL_RGB,GL_FLOAT),image)
|
175
|
+
|
176
|
+
glTexSubImage3D(GL_TEXTURE_3D,0, 0,0,0, 2,2,2,GL_RGB,GL_FLOAT,image2)
|
177
|
+
assert_equal(glGetTexImage(GL_TEXTURE_3D,0,GL_RGB,GL_FLOAT),image2)
|
178
|
+
|
179
|
+
glDrawPixels(2,2,GL_RGB,GL_FLOAT,image)
|
180
|
+
glCopyTexSubImage3D(GL_TEXTURE_3D,0,0,0,0,0,0,2,2)
|
181
|
+
ti = glGetTexImage(GL_TEXTURE_3D,0,GL_RGB,GL_FLOAT).unpack("f*")
|
182
|
+
assert_equal(ti,([0]*3 + [1]*3) * 2 + ([1]*3 + [0]*3) * 2)
|
183
|
+
|
184
|
+
glDeleteTextures(textures)
|
185
|
+
end
|
186
|
+
end
|
data/test/tc_func_13.rb
ADDED
@@ -0,0 +1,203 @@
|
|
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 'test/unit'
|
17
|
+
|
18
|
+
class Test_13 < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_glsamplecoverage
|
28
|
+
return if not supported?("glSampleCoverage")
|
29
|
+
glSampleCoverage(0.0,GL_TRUE)
|
30
|
+
assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_VALUE),0.0)
|
31
|
+
assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_INVERT),GL_TRUE)
|
32
|
+
glSampleCoverage(1.0,GL_FALSE)
|
33
|
+
assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_VALUE),1.0)
|
34
|
+
assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_INVERT),GL_FALSE)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_multitexture
|
38
|
+
return if not supported?(["glActiveTexture","glClientActiveTexture"])
|
39
|
+
glActiveTexture(GL_TEXTURE1)
|
40
|
+
glClientActiveTexture(GL_TEXTURE2)
|
41
|
+
assert_equal(glGetIntegerv(GL_ACTIVE_TEXTURE),GL_TEXTURE1)
|
42
|
+
assert_equal(glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE),GL_TEXTURE2)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_transposematrix
|
46
|
+
return if not supported?(["glLoadTransposeMatrixf","glLoadTransposeMatrixd","glMultTransposeMatrixf","glMultTransposeMatrixd"])
|
47
|
+
m_a = [[2.0,0.0,0.0,0.0],
|
48
|
+
[0.0,2.0,0.0,0.0],
|
49
|
+
[0.0,0.0,2.0,0.0],
|
50
|
+
[0.0,0.0,0.0,2.0]]
|
51
|
+
|
52
|
+
m_b = [[3.0,0.0,0.0,0.0],
|
53
|
+
[0.0,3.0,0.0,0.0],
|
54
|
+
[0.0,0.0,3.0,0.0],
|
55
|
+
[0.0,0.0,0.0,3.0]]
|
56
|
+
|
57
|
+
glMatrixMode(GL_MODELVIEW)
|
58
|
+
glLoadTransposeMatrixf(m_a)
|
59
|
+
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m_a)
|
60
|
+
|
61
|
+
glLoadTransposeMatrixd(m_b)
|
62
|
+
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m_b)
|
63
|
+
|
64
|
+
glLoadIdentity()
|
65
|
+
glMultTransposeMatrixf(m_a)
|
66
|
+
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m_a)
|
67
|
+
|
68
|
+
glLoadIdentity()
|
69
|
+
glMultTransposeMatrixd(m_b)
|
70
|
+
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m_b)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_texturecompression
|
74
|
+
return if not supported?(["GL_EXT_texture_compression_s3tc","glCompressedTexImage1D","glCompressedTexImage2D","glCompressedTexImage3D","glCompressedTexSubImage1D","glCompressedTexSubImage2D","glCompressedTexSubImage3D"])
|
75
|
+
|
76
|
+
# S3TC/DXT5 compressed 2x2 pixels stipple patterns [w,b,b,w] and [b,w,w,b]
|
77
|
+
image_1 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x54,0x5C,0x5C].pack("C*")
|
78
|
+
image_2 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x54,0x01,0x0D,0x0D].pack("C*")
|
79
|
+
|
80
|
+
textures = glGenTextures(3)
|
81
|
+
glBindTexture(GL_TEXTURE_1D,textures[0])
|
82
|
+
glBindTexture(GL_TEXTURE_2D,textures[1])
|
83
|
+
glBindTexture(GL_TEXTURE_3D,textures[2])
|
84
|
+
|
85
|
+
# Note: 1D and 3D compressed textures are not supported by S3TC/DXTn, and usually not supported at all
|
86
|
+
|
87
|
+
# 1D
|
88
|
+
glCompressedTexImage1D(GL_TEXTURE_1D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,4,0,16,image_1)
|
89
|
+
err = glGetError()
|
90
|
+
assert(err == 0 || err == GL_INVALID_ENUM || err == GL_INVALID_OPERATION)
|
91
|
+
if (err == 0)
|
92
|
+
assert_equal(glGetCompressedTexImage(GL_TEXTURE_1D,0), image_1)
|
93
|
+
end
|
94
|
+
|
95
|
+
glCompressedTexSubImage1D(GL_TEXTURE_1D,0,0,4,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,16,image_2)
|
96
|
+
err = glGetError()
|
97
|
+
assert(err == 0 || err == GL_INVALID_ENUM || err == GL_INVALID_OPERATION)
|
98
|
+
if (err == 0)
|
99
|
+
assert_equal(glGetCompressedTexImage(GL_TEXTURE_1D,0), image_2)
|
100
|
+
end
|
101
|
+
|
102
|
+
# 2D
|
103
|
+
glCompressedTexImage2D(GL_TEXTURE_2D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,2,2,0,16,image_1)
|
104
|
+
assert_equal(glGetCompressedTexImage(GL_TEXTURE_2D,0), image_1)
|
105
|
+
|
106
|
+
glCompressedTexSubImage2D(GL_TEXTURE_2D,0,0,0,2,2,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,16,image_2)
|
107
|
+
assert_equal(glGetCompressedTexImage(GL_TEXTURE_2D,0), image_2)
|
108
|
+
|
109
|
+
# 3D
|
110
|
+
glCompressedTexImage3D(GL_TEXTURE_3D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,2,2,1,0,16,image_1)
|
111
|
+
err = glGetError()
|
112
|
+
assert(err == 0 || err == GL_INVALID_ENUM || err == GL_INVALID_OPERATION)
|
113
|
+
if (err == 0)
|
114
|
+
assert_equal(glGetCompressedTexImage(GL_TEXTURE_3D,0), image_1)
|
115
|
+
end
|
116
|
+
|
117
|
+
glCompressedTexSubImage3D(GL_TEXTURE_3D,0, 0,0,0, 2,2,1, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16, image_2)
|
118
|
+
err = glGetError()
|
119
|
+
assert(err == 0 || err == GL_INVALID_ENUM || err == GL_INVALID_OPERATION)
|
120
|
+
if (err == 0)
|
121
|
+
assert_equal(glGetCompressedTexImage(GL_TEXTURE_3D,0), image_2)
|
122
|
+
end
|
123
|
+
|
124
|
+
glDeleteTextures(textures)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_glmultitexcoord
|
128
|
+
return if not supported?(["glMultiTexCoord1d"])
|
129
|
+
|
130
|
+
glActiveTexture(GL_TEXTURE1)
|
131
|
+
|
132
|
+
# 1
|
133
|
+
glMultiTexCoord1d(GL_TEXTURE1, 1.0)
|
134
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,0,0,1])
|
135
|
+
glMultiTexCoord1dv(GL_TEXTURE1, [0.0])
|
136
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
137
|
+
glMultiTexCoord1f(GL_TEXTURE1, 1.0)
|
138
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,0,0,1])
|
139
|
+
glMultiTexCoord1fv(GL_TEXTURE1, [0.0])
|
140
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
141
|
+
glMultiTexCoord1i(GL_TEXTURE1, 1)
|
142
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,0,0,1])
|
143
|
+
glMultiTexCoord1iv(GL_TEXTURE1, [0])
|
144
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
145
|
+
glMultiTexCoord1s(GL_TEXTURE1, 1)
|
146
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,0,0,1])
|
147
|
+
glMultiTexCoord1sv(GL_TEXTURE1, [0])
|
148
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
149
|
+
# 2
|
150
|
+
glMultiTexCoord2d(GL_TEXTURE1, 1.0,1.0)
|
151
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,0,1])
|
152
|
+
glMultiTexCoord2dv(GL_TEXTURE1, [0.0,0.0])
|
153
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
154
|
+
glMultiTexCoord2f(GL_TEXTURE1, 1.0,1.0)
|
155
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,0,1])
|
156
|
+
glMultiTexCoord2fv(GL_TEXTURE1, [0.0,0.0])
|
157
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
158
|
+
glMultiTexCoord2i(GL_TEXTURE1, 1,1)
|
159
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,0,1])
|
160
|
+
glMultiTexCoord2iv(GL_TEXTURE1, [0,0])
|
161
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
162
|
+
glMultiTexCoord2s(GL_TEXTURE1, 1,1)
|
163
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,0,1])
|
164
|
+
glMultiTexCoord2sv(GL_TEXTURE1, [0,0])
|
165
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
166
|
+
# 3
|
167
|
+
glMultiTexCoord3d(GL_TEXTURE1, 1.0,1.0,1.0)
|
168
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
169
|
+
glMultiTexCoord3dv(GL_TEXTURE1, [0.0,0.0,0.0])
|
170
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
171
|
+
glMultiTexCoord3f(GL_TEXTURE1, 1.0,1.0,1.0)
|
172
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
173
|
+
glMultiTexCoord3fv(GL_TEXTURE1, [0.0,0.0,0.0])
|
174
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
175
|
+
glMultiTexCoord3i(GL_TEXTURE1, 1,1,1)
|
176
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
177
|
+
glMultiTexCoord3iv(GL_TEXTURE1, [0,0,0])
|
178
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
179
|
+
glMultiTexCoord3s(GL_TEXTURE1, 1,1,1)
|
180
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
181
|
+
glMultiTexCoord3sv(GL_TEXTURE1, [0,0,0])
|
182
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,1])
|
183
|
+
# 4
|
184
|
+
glMultiTexCoord4d(GL_TEXTURE1, 1.0,1.0,1.0,1.0)
|
185
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
186
|
+
glMultiTexCoord4dv(GL_TEXTURE1, [0.0,0.0,0.0,0.0])
|
187
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,0])
|
188
|
+
glMultiTexCoord4f(GL_TEXTURE1, 1.0,1.0,1.0,1.0)
|
189
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
190
|
+
glMultiTexCoord4fv(GL_TEXTURE1, [0.0,0.0,0.0,0.0])
|
191
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,0])
|
192
|
+
glMultiTexCoord4i(GL_TEXTURE1, 1,1,1,1)
|
193
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
194
|
+
glMultiTexCoord4iv(GL_TEXTURE1, [0,0,0,0])
|
195
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,0])
|
196
|
+
glMultiTexCoord4s(GL_TEXTURE1, 1,1,1,1)
|
197
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
198
|
+
glMultiTexCoord4sv(GL_TEXTURE1, [0,0,0,0])
|
199
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,0])
|
200
|
+
|
201
|
+
glActiveTexture(GL_TEXTURE0)
|
202
|
+
end
|
203
|
+
end
|
data/test/tc_func_14.rb
ADDED
@@ -0,0 +1,197 @@
|
|
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 'test/unit'
|
17
|
+
|
18
|
+
class Test_14 < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_arrays_2
|
28
|
+
return if not supported?(["glSecondaryColorPointer","glFogCoordPointer"])
|
29
|
+
sc = [0,1,0, 1,0,1].pack("f*")
|
30
|
+
fc = [1, 0].pack("f*")
|
31
|
+
|
32
|
+
glSecondaryColorPointer(3,GL_FLOAT,0,sc)
|
33
|
+
assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE),3)
|
34
|
+
assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE),GL_FLOAT)
|
35
|
+
assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE),0)
|
36
|
+
assert_equal(glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER),sc)
|
37
|
+
glFogCoordPointer(GL_FLOAT,0,fc)
|
38
|
+
assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE),GL_FLOAT)
|
39
|
+
assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE),0)
|
40
|
+
assert_equal(glGetPointerv(GL_FOG_COORD_ARRAY_POINTER),fc)
|
41
|
+
|
42
|
+
glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
|
43
|
+
glEnableClientState(GL_FOG_COORD_ARRAY)
|
44
|
+
|
45
|
+
glBegin(GL_TRIANGLES)
|
46
|
+
glArrayElement(0)
|
47
|
+
glEnd()
|
48
|
+
|
49
|
+
assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0,1,0,1])
|
50
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),1)
|
51
|
+
|
52
|
+
glBegin(GL_TRIANGLES)
|
53
|
+
glArrayElement(1)
|
54
|
+
glEnd()
|
55
|
+
|
56
|
+
assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1,0,1,1])
|
57
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),0)
|
58
|
+
|
59
|
+
glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
|
60
|
+
glDisableClientState(GL_FOG_COORD_ARRAY)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_arrays_3
|
64
|
+
return if not supported?(["glMultiDrawArrays","glMultiDrawElements"])
|
65
|
+
va = [0,0, 1,0, 1,1, 0,0, 1,0, 0,1].pack("f*")
|
66
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
67
|
+
|
68
|
+
glEnable(GL_VERTEX_ARRAY)
|
69
|
+
|
70
|
+
buf = glFeedbackBuffer(256,GL_3D)
|
71
|
+
glRenderMode(GL_FEEDBACK)
|
72
|
+
|
73
|
+
glMultiDrawArrays(GL_POLYGON, [0,3], [3,3], 2)
|
74
|
+
|
75
|
+
i1 = [0,1,2].pack("C*")
|
76
|
+
i2 = [3,4,5].pack("C*")
|
77
|
+
glMultiDrawElements(GL_TRIANGLES,GL_UNSIGNED_BYTE,[i1,i2])
|
78
|
+
|
79
|
+
count = glRenderMode(GL_RENDER)
|
80
|
+
assert_equal(count,(3*3+2)*4)
|
81
|
+
glDisable(GL_VERTEX_ARRAY)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_glblendfuncseparate
|
85
|
+
return if not supported?(["glBlendFuncSeparate"])
|
86
|
+
glBlendFuncSeparate(GL_SRC_COLOR,GL_SRC_COLOR,GL_SRC_COLOR,GL_SRC_COLOR)
|
87
|
+
assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB),GL_SRC_COLOR)
|
88
|
+
assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA),GL_SRC_COLOR)
|
89
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_RGB),GL_SRC_COLOR)
|
90
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA),GL_SRC_COLOR)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_glpointparameter
|
94
|
+
return if not supported?(["glPointParameterf","glPointParameterfv","glPointParameteri","glPointParameteriv"])
|
95
|
+
glPointParameterf(GL_POINT_SIZE_MIN,2.0)
|
96
|
+
assert_equal(glGetDoublev(GL_POINT_SIZE_MIN),2.0)
|
97
|
+
|
98
|
+
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION,[0,1,0])
|
99
|
+
assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[0,1,0])
|
100
|
+
|
101
|
+
glPointParameteri(GL_POINT_SIZE_MAX,4)
|
102
|
+
assert_equal(glGetDoublev(GL_POINT_SIZE_MAX),4)
|
103
|
+
|
104
|
+
glPointParameteriv(GL_POINT_DISTANCE_ATTENUATION,[1,0,1])
|
105
|
+
assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[1,0,1])
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_glfogcoord
|
109
|
+
return if not supported?(["glFogCoordf","glFogCoordd","glFogCoordfv","glFogCoorddv",])
|
110
|
+
|
111
|
+
glFogCoordf(2.0)
|
112
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
|
113
|
+
glFogCoordfv([3.0])
|
114
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
|
115
|
+
|
116
|
+
glFogCoordd(2.0)
|
117
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
|
118
|
+
glFogCoorddv([3.0])
|
119
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_glsecondarycolor
|
123
|
+
return if not supported?(["glSecondaryColor3b"])
|
124
|
+
|
125
|
+
glSecondaryColor3b(2**7-1,0,2**7-1)
|
126
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
127
|
+
glSecondaryColor3bv([0,2**7-1,0])
|
128
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
129
|
+
glSecondaryColor3d(1.0,0.0,1.0)
|
130
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
131
|
+
glSecondaryColor3dv(0.0,1.0,0.0)
|
132
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
133
|
+
glSecondaryColor3f(1.0,0.0,1.0)
|
134
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
135
|
+
glSecondaryColor3fv(0.0,1.0,0.0)
|
136
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
137
|
+
glSecondaryColor3i(2**31-1,0,2**31-1)
|
138
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
139
|
+
glSecondaryColor3iv([0,2**31-1,0])
|
140
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
141
|
+
glSecondaryColor3s(2**15-1,0,2**15-1)
|
142
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
143
|
+
glSecondaryColor3sv([0,2**15-1,0])
|
144
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
145
|
+
glSecondaryColor3ub(2**8-1,0,2**8-1)
|
146
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
147
|
+
glSecondaryColor3ubv([0,2**8-1,0])
|
148
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
149
|
+
glSecondaryColor3ui(2**32-1,0,2**32-1)
|
150
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
151
|
+
glSecondaryColor3uiv([0,2**32-1,0])
|
152
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
153
|
+
glSecondaryColor3us(2**16-1,0,2**16-1)
|
154
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
155
|
+
glSecondaryColor3usv([0,2**16-1,0])
|
156
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_glwindowpos
|
160
|
+
return if not supported?(["glWindowPos2d"])
|
161
|
+
# 2
|
162
|
+
glWindowPos2d(1.0,2.0)
|
163
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
164
|
+
glWindowPos2dv([2.0,1.0])
|
165
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
166
|
+
glWindowPos2f(1.0,2.0)
|
167
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
168
|
+
glWindowPos2fv([2.0,1.0])
|
169
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
170
|
+
glWindowPos2i(1,2)
|
171
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
172
|
+
glWindowPos2iv([2,1])
|
173
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
174
|
+
glWindowPos2s(1,2)
|
175
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
176
|
+
glWindowPos2sv([2,1])
|
177
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
178
|
+
|
179
|
+
# 3
|
180
|
+
glWindowPos3d(1.0,2.0,0.5)
|
181
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0.5,1])
|
182
|
+
glWindowPos3dv([3.0,2.0,1.0])
|
183
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
184
|
+
glWindowPos3f(1.0,2.0,0.5)
|
185
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0.5,1])
|
186
|
+
glWindowPos3fv([3.0,2.0,1.0])
|
187
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
188
|
+
glWindowPos3i(1,2,0)
|
189
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
190
|
+
glWindowPos3iv([3,2,1])
|
191
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
192
|
+
glWindowPos3s(1,2,0)
|
193
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
194
|
+
glWindowPos3sv([3,2,1])
|
195
|
+
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
196
|
+
end
|
197
|
+
end
|