opengl 0.8.0 → 0.9.0
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 +1 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -1
- data/.travis.yml +19 -0
- data/History.rdoc +26 -0
- data/Manifest.txt +3 -23
- data/README.rdoc +43 -37
- data/Rakefile +6 -62
- data/examples/NeHe/nehe_lesson02.rb +3 -2
- data/examples/NeHe/nehe_lesson03.rb +3 -2
- data/examples/NeHe/nehe_lesson04.rb +3 -1
- data/examples/NeHe/nehe_lesson05.rb +4 -1
- data/examples/NeHe/nehe_lesson06.rb +9 -6
- data/examples/NeHe/nehe_lesson07.rb +9 -6
- data/examples/NeHe/nehe_lesson08.rb +9 -6
- data/examples/NeHe/nehe_lesson09.rb +10 -6
- data/examples/NeHe/nehe_lesson11.rb +9 -6
- data/examples/NeHe/nehe_lesson12.rb +9 -6
- data/examples/NeHe/nehe_lesson16.rb +50 -47
- data/examples/NeHe/nehe_lesson19.rb +10 -7
- data/examples/NeHe/nehe_lesson36.rb +234 -229
- data/examples/OrangeBook/brick.rb +227 -225
- data/examples/OrangeBook/particle.rb +233 -231
- data/examples/RedBook/aapoly.rb +71 -70
- data/examples/RedBook/aargb.rb +54 -52
- data/examples/RedBook/accanti.rb +96 -94
- data/examples/RedBook/accpersp.rb +106 -104
- data/examples/RedBook/alpha.rb +54 -52
- data/examples/RedBook/alpha3D.rb +90 -88
- data/examples/RedBook/bezcurve.rb +48 -46
- data/examples/RedBook/bezmesh.rb +71 -69
- data/examples/RedBook/checker.rb +57 -55
- data/examples/RedBook/clip.rb +41 -39
- data/examples/RedBook/colormat.rb +72 -70
- data/examples/RedBook/cube.rb +39 -37
- data/examples/RedBook/depthcue.rb +37 -35
- data/examples/RedBook/dof.rb +110 -109
- data/examples/RedBook/double.rb +40 -38
- data/examples/RedBook/drawf.rb +30 -28
- data/examples/RedBook/feedback.rb +79 -77
- data/examples/RedBook/fog.rb +90 -89
- data/examples/RedBook/font.rb +78 -76
- data/examples/RedBook/hello.rb +29 -27
- data/examples/RedBook/image.rb +57 -55
- data/examples/RedBook/jitter.rb +131 -131
- data/examples/RedBook/light.rb +2 -1
- data/examples/RedBook/lines.rb +70 -68
- data/examples/RedBook/list.rb +48 -46
- data/examples/RedBook/material.rb +200 -199
- data/examples/RedBook/mipmap.rb +84 -82
- data/examples/RedBook/model.rb +55 -53
- data/examples/RedBook/movelight.rb +52 -50
- data/examples/RedBook/pickdepth.rb +103 -101
- data/examples/RedBook/planet.rb +46 -44
- data/examples/RedBook/quadric.rb +97 -95
- data/examples/RedBook/robot.rb +55 -53
- data/examples/RedBook/select.rb +118 -116
- data/examples/RedBook/smooth.rb +35 -33
- data/examples/RedBook/stencil.rb +96 -94
- data/examples/RedBook/stroke.rb +75 -73
- data/examples/RedBook/surface.rb +93 -91
- data/examples/RedBook/teaambient.rb +71 -69
- data/examples/RedBook/teapots.rb +105 -103
- data/examples/RedBook/tess.rb +96 -94
- data/examples/RedBook/texbind.rb +79 -77
- data/examples/RedBook/texgen.rb +88 -86
- data/examples/RedBook/texturesurf.rb +57 -55
- data/examples/RedBook/varray.rb +85 -83
- data/examples/RedBook/wrap.rb +76 -74
- data/examples/misc/OGLBench.rb +114 -113
- data/examples/misc/anisotropic.rb +154 -152
- data/examples/misc/fbo_test.rb +37 -36
- data/examples/misc/font-glut.rb +47 -46
- data/examples/misc/glfwtest.rb +16 -16
- data/examples/misc/plane.rb +13 -13
- data/examples/misc/readpixel.rb +66 -65
- data/examples/misc/sdltest.rb +21 -19
- data/examples/misc/trislam.rb +548 -547
- data/ext/opengl/common.h +16 -38
- data/ext/opengl/conv.h +39 -41
- data/ext/opengl/extconf.rb +4 -31
- data/ext/opengl/funcdef.h +126 -124
- data/ext/opengl/gl-1.0-1.1.c +1917 -1917
- data/ext/opengl/gl-1.2.c +4 -667
- data/ext/opengl/gl-1.3.c +9 -9
- data/ext/opengl/gl-1.4.c +8 -8
- data/ext/opengl/gl-1.5.c +1 -1
- data/ext/opengl/gl-2.0.c +392 -388
- data/ext/opengl/gl-3.0.c +493 -0
- data/ext/opengl/gl-enums.c +1523 -5
- data/ext/opengl/gl-enums.h +4679 -122
- data/ext/opengl/gl-error.c +7 -7
- data/ext/opengl/gl-error.h +4 -4
- data/ext/opengl/gl-ext-arb.c +468 -464
- data/ext/opengl/gl-ext-ext.c +18 -18
- data/ext/opengl/gl-ext-nv.c +15 -15
- data/ext/opengl/gl.c +2 -0
- data/ext/opengl/gl_buffer.c +92 -92
- data/ext/opengl/opengl.c +1 -7
- data/lib/opengl.rb +23 -59
- data/lib/opengl/test_case.rb +1 -2
- data/test/dummy.xorg.conf +140 -0
- data/test/test_gl.rb +18 -22
- data/test/test_gl_10_11.rb +220 -220
- data/test/test_gl_12.rb +11 -122
- data/test/test_gl_13.rb +202 -210
- data/test/test_gl_14.rb +16 -19
- data/test/test_gl_15.rb +2 -4
- data/test/test_gl_20.rb +45 -58
- data/test/test_gl_21.rb +46 -163
- data/test/test_gl_ext_arb.rb +54 -72
- data/test/test_gl_ext_ati.rb +0 -2
- data/test/test_gl_ext_ext.rb +66 -66
- data/test/test_gl_ext_gremedy.rb +8 -15
- data/test/test_gl_ext_nv.rb +109 -112
- data/test/test_opengl_buffer.rb +8 -25
- data/utils/README +0 -5
- data/utils/enumgen.rb +72 -76
- data/utils/extlistgen.rb +55 -55
- metadata +87 -66
- metadata.gz.sig +2 -0
- data/Rakefile.cross +0 -107
- data/docs/build_install.txt +0 -119
- data/docs/extensions.txt.in +0 -348
- data/docs/history.txt +0 -66
- data/docs/requirements_and_design.txt +0 -117
- data/docs/roadmap.txt +0 -28
- data/docs/scientific_use.txt +0 -35
- data/docs/supplies/page_template.html +0 -71
- data/docs/thanks.txt +0 -29
- data/docs/tutorial.txt +0 -469
- data/ext/opengl/glu-enums.c +0 -164
- data/ext/opengl/glu-enums.h +0 -463
- data/ext/opengl/glu.c +0 -1534
- data/ext/opengl/glut.c +0 -1145
- data/ext/opengl/glut_callbacks.c +0 -845
- data/lib/glu.rb +0 -1
- data/lib/glut.rb +0 -1
- data/test/test_glu.rb +0 -309
- data/utils/mkdn2html.rb +0 -59
- data/utils/post-mkdn2html.rb +0 -91
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +0 -198
data/test/test_gl_12.rb
CHANGED
@@ -17,19 +17,22 @@ require 'opengl/test_case'
|
|
17
17
|
|
18
18
|
class TestGl12 < OpenGL::TestCase
|
19
19
|
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
supported? 1.2
|
23
|
+
end
|
24
|
+
|
20
25
|
def test_glblend
|
21
|
-
supported?(1.2)
|
22
26
|
glBlendColor(0.0, 1.0, 0.0, 1.0)
|
23
27
|
assert_equal(glGetDoublev(GL_BLEND_COLOR), [0, 1, 0, 1])
|
24
28
|
|
25
29
|
glBlendEquation(GL_MIN)
|
26
|
-
assert_equal(glGetIntegerv(GL_BLEND_EQUATION)
|
30
|
+
assert_equal(GL_MIN, glGetIntegerv(GL_BLEND_EQUATION))
|
27
31
|
glBlendEquation(GL_MAX)
|
28
|
-
assert_equal(glGetIntegerv(GL_BLEND_EQUATION)
|
32
|
+
assert_equal(GL_MAX, glGetIntegerv(GL_BLEND_EQUATION))
|
29
33
|
end
|
30
34
|
|
31
35
|
def test_gldrawrangeelements
|
32
|
-
supported?(1.2)
|
33
36
|
va = [0, 0, 0, 1, 1, 1].pack("f*")
|
34
37
|
glVertexPointer(2, GL_FLOAT, 0, va)
|
35
38
|
|
@@ -40,124 +43,12 @@ class TestGl12 < OpenGL::TestCase
|
|
40
43
|
|
41
44
|
glDrawRangeElements(GL_POINTS, 0, 2, 3, GL_UNSIGNED_BYTE, [0, 1, 2].pack("C*"))
|
42
45
|
count = glRenderMode(GL_RENDER)
|
43
|
-
assert_equal(
|
46
|
+
assert_equal(12, count)
|
44
47
|
|
45
48
|
glDisableClientState(GL_VERTEX_ARRAY)
|
46
49
|
end
|
47
50
|
|
48
|
-
def test_colortable
|
49
|
-
supported?(1.2)
|
50
|
-
|
51
|
-
ct = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
52
|
-
ct2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
53
|
-
glColorTable(GL_COLOR_TABLE, GL_RGB8, 4, GL_RGB, GL_FLOAT, ct)
|
54
|
-
assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct)
|
55
|
-
|
56
|
-
glColorSubTable(GL_COLOR_TABLE, 0, 4, GL_RGB, GL_FLOAT, ct2)
|
57
|
-
assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct2)
|
58
|
-
|
59
|
-
glDrawPixels(4, 1, GL_RGB, GL_FLOAT, ct)
|
60
|
-
glCopyColorTable(GL_COLOR_TABLE, GL_RGB8, 0, 0, 4)
|
61
|
-
assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct)
|
62
|
-
|
63
|
-
glDrawPixels(4, 1, GL_RGB, GL_FLOAT, ct2)
|
64
|
-
glCopyColorSubTable(GL_COLOR_TABLE, 0, 0, 0, 4)
|
65
|
-
assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct2)
|
66
|
-
|
67
|
-
glColorTableParameterfv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS, [0, 1, 0, 1])
|
68
|
-
assert_equal(glGetColorTableParameterfv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS), [0, 1, 0, 1])
|
69
|
-
|
70
|
-
glColorTableParameteriv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS, [1, 0, 1, 0])
|
71
|
-
assert_equal(glGetColorTableParameteriv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS), [1, 0, 1, 0])
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_convolutionfilter
|
75
|
-
supported?(1.2)
|
76
|
-
|
77
|
-
cf = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
78
|
-
cf2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
79
|
-
glConvolutionFilter1D(GL_CONVOLUTION_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT,cf)
|
80
|
-
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf)
|
81
|
-
|
82
|
-
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB8, 2,2, GL_RGB, GL_FLOAT,cf2)
|
83
|
-
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf2)
|
84
|
-
|
85
|
-
glDrawPixels(4,1,GL_RGB,GL_FLOAT,cf2)
|
86
|
-
glCopyConvolutionFilter1D(GL_CONVOLUTION_1D,GL_RGB8,0,0,4)
|
87
|
-
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf2)
|
88
|
-
|
89
|
-
glDrawPixels(2,2,GL_RGB,GL_FLOAT,cf)
|
90
|
-
glCopyConvolutionFilter2D(GL_CONVOLUTION_2D,GL_RGB8,0,0,2,2)
|
91
|
-
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf)
|
92
|
-
|
93
|
-
glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_CONSTANT_BORDER)
|
94
|
-
assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
|
95
|
-
|
96
|
-
glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
|
97
|
-
assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_REPLICATE_BORDER)
|
98
|
-
|
99
|
-
glConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
|
100
|
-
assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
|
101
|
-
|
102
|
-
glConvolutionParameteri(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
|
103
|
-
assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_REPLICATE_BORDER)
|
104
|
-
|
105
|
-
glConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
|
106
|
-
assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_separablefilter
|
110
|
-
supported?(1.2)
|
111
|
-
sf_a = ([0]*3+[1]*3).pack("f*")
|
112
|
-
sf_b = ([1]*3+[0]*3).pack("f*")
|
113
|
-
|
114
|
-
glSeparableFilter2D(GL_SEPARABLE_2D, GL_RGB8, 2, 2, GL_RGB, GL_FLOAT, sf_a, sf_b)
|
115
|
-
assert_equal(glGetSeparableFilter(GL_SEPARABLE_2D, GL_RGB, GL_FLOAT), [sf_a, sf_b])
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_histogram
|
119
|
-
supported?(1.2)
|
120
|
-
|
121
|
-
glEnable(GL_HISTOGRAM)
|
122
|
-
|
123
|
-
glHistogram(GL_HISTOGRAM, 1, GL_RGB, GL_FALSE)
|
124
|
-
assert_equal(glGetHistogramParameterfv(GL_HISTOGRAM, GL_HISTOGRAM_WIDTH), 1)
|
125
|
-
assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM, GL_HISTOGRAM_FORMAT), GL_RGB)
|
126
|
-
assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM, GL_HISTOGRAM_SINK), GL_FALSE)
|
127
|
-
|
128
|
-
glDrawPixels(2, 1, GL_RGB, GL_FLOAT, [1, 1, 1, 1, 1, 1].pack("f*"))
|
129
|
-
h = glGetHistogram(GL_HISTOGRAM, GL_FALSE, GL_RGB, GL_FLOAT)
|
130
|
-
assert_equal(h.unpack("f*"), [2, 2, 2])
|
131
|
-
glResetHistogram(GL_HISTOGRAM)
|
132
|
-
h = glGetHistogram(GL_HISTOGRAM, GL_FALSE, GL_RGB, GL_FLOAT)
|
133
|
-
assert_equal(h.unpack("f*"), [0, 0, 0])
|
134
|
-
|
135
|
-
glDisable(GL_HISTOGRAM)
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_minmax
|
139
|
-
supported?(1.2)
|
140
|
-
|
141
|
-
glEnable(GL_MINMAX)
|
142
|
-
|
143
|
-
glMinmax(GL_MINMAX, GL_RGB, GL_FALSE)
|
144
|
-
assert_equal(glGetMinmaxParameteriv(GL_MINMAX, GL_MINMAX_FORMAT), GL_RGB)
|
145
|
-
assert_equal(glGetMinmaxParameterfv(GL_MINMAX, GL_MINMAX_FORMAT), GL_RGB)
|
146
|
-
assert_equal(glGetMinmaxParameteriv(GL_MINMAX, GL_MINMAX_SINK), GL_FALSE)
|
147
|
-
|
148
|
-
glDrawPixels(2, 1, GL_RGB, GL_FLOAT, [0, 0, 0, 1, 1, 1].pack("f*"))
|
149
|
-
mm = glGetMinmax(GL_MINMAX, GL_FALSE, GL_RGB, GL_FLOAT)
|
150
|
-
assert_each_in_delta [0, 0, 0, 1, 1, 1], mm.unpack("f*")
|
151
|
-
|
152
|
-
glResetMinmax(GL_MINMAX)
|
153
|
-
mm = glGetMinmax(GL_MINMAX, GL_FALSE, GL_RGB, GL_UNSIGNED_BYTE)
|
154
|
-
assert_equal [-1, -1, -1, 0, 0, 0], mm.unpack("c*")
|
155
|
-
|
156
|
-
glDisable(GL_MINMAX)
|
157
|
-
end
|
158
|
-
|
159
51
|
def test_texture_3D
|
160
|
-
supported?(1.2)
|
161
52
|
image = ([0, 0, 0, 1, 1, 1] * 2 * 2).pack("f*")
|
162
53
|
image2 = ([1, 1, 1, 0, 0, 0] * 2 * 2).pack("f*")
|
163
54
|
|
@@ -165,18 +56,16 @@ class TestGl12 < OpenGL::TestCase
|
|
165
56
|
glBindTexture(GL_TEXTURE_3D, textures[0])
|
166
57
|
|
167
58
|
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8, 2, 2, 2, 0, GL_RGB, GL_FLOAT, image)
|
168
|
-
assert_equal(glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT)
|
59
|
+
assert_equal(image, glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT))
|
169
60
|
|
170
61
|
glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 2, 2, 2, GL_RGB, GL_FLOAT, image2)
|
171
|
-
assert_equal(glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT)
|
62
|
+
assert_equal(image2, glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT))
|
172
63
|
|
173
64
|
glDrawPixels(2, 2, GL_RGB, GL_FLOAT, image)
|
174
65
|
glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 2, 2)
|
175
66
|
ti = glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT).unpack("f*")
|
176
|
-
assert_equal(
|
67
|
+
assert_equal(([0]*3 + [1]*3) * 2 + ([1]*3 + [0]*3) * 2, ti)
|
177
68
|
|
178
69
|
glDeleteTextures(textures)
|
179
70
|
end
|
180
|
-
|
181
71
|
end
|
182
|
-
|
data/test/test_gl_13.rb
CHANGED
@@ -16,214 +16,206 @@
|
|
16
16
|
require 'opengl/test_case'
|
17
17
|
|
18
18
|
class TestGl13 < OpenGL::TestCase
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,0])
|
222
|
-
glMultiTexCoord4s(GL_TEXTURE1, 1,1,1,1)
|
223
|
-
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [1,1,1,1])
|
224
|
-
glMultiTexCoord4sv(GL_TEXTURE1, [0,0,0,0])
|
225
|
-
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS), [0,0,0,0])
|
226
|
-
|
227
|
-
glActiveTexture(GL_TEXTURE0)
|
228
|
-
end
|
19
|
+
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
supported? 1.3
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_glsamplecoverage
|
26
|
+
glSampleCoverage(0.0, GL_TRUE)
|
27
|
+
assert_equal(0.0, glGetDoublev(GL_SAMPLE_COVERAGE_VALUE))
|
28
|
+
assert_equal(GL_TRUE, glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT))
|
29
|
+
glSampleCoverage(1.0, GL_FALSE)
|
30
|
+
assert_equal(1.0, glGetDoublev(GL_SAMPLE_COVERAGE_VALUE))
|
31
|
+
assert_equal(GL_FALSE, glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_multitexture
|
35
|
+
glActiveTexture(GL_TEXTURE1)
|
36
|
+
glClientActiveTexture(GL_TEXTURE2)
|
37
|
+
assert_equal(GL_TEXTURE1, glGetIntegerv(GL_ACTIVE_TEXTURE))
|
38
|
+
assert_equal(GL_TEXTURE2, glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_transposematrix
|
42
|
+
m_a = [[1.0,2.0,3.0,4.0],
|
43
|
+
[0.0,2.0,0.0,0.0],
|
44
|
+
[0.0,0.0,2.0,0.0],
|
45
|
+
[0.0,0.0,0.0,2.0]]
|
46
|
+
|
47
|
+
m_b = [[1.0,2.0,3.0,4.0],
|
48
|
+
[0.0,3.0,0.0,0.0],
|
49
|
+
[0.0,0.0,3.0,0.0],
|
50
|
+
[0.0,0.0,0.0,3.0]]
|
51
|
+
|
52
|
+
glMatrixMode(GL_MODELVIEW)
|
53
|
+
glLoadTransposeMatrixf(m_a)
|
54
|
+
assert_equal(m_a, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
|
55
|
+
|
56
|
+
glLoadTransposeMatrixd(m_b)
|
57
|
+
assert_equal(m_b, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
|
58
|
+
|
59
|
+
glLoadIdentity()
|
60
|
+
glMultTransposeMatrixf(m_a)
|
61
|
+
assert_equal(m_a, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
|
62
|
+
|
63
|
+
glLoadIdentity()
|
64
|
+
glMultTransposeMatrixd(m_b)
|
65
|
+
assert_equal(m_b, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
|
66
|
+
|
67
|
+
# 2
|
68
|
+
m = Matrix.rows([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]])
|
69
|
+
glMatrixMode(GL_MODELVIEW)
|
70
|
+
glLoadTransposeMatrixf(m)
|
71
|
+
assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
|
72
|
+
glLoadIdentity()
|
73
|
+
glLoadTransposeMatrixd(m)
|
74
|
+
assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
|
75
|
+
glLoadIdentity()
|
76
|
+
glMultTransposeMatrixf(m)
|
77
|
+
assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
|
78
|
+
glLoadIdentity()
|
79
|
+
glMultTransposeMatrixd(m)
|
80
|
+
assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
|
81
|
+
|
82
|
+
assert_raises ArgumentError do glLoadTransposeMatrixf([1,2,3,4]) end
|
83
|
+
assert_raises ArgumentError do glLoadTransposeMatrixd([1,2,3,4]) end
|
84
|
+
assert_raises ArgumentError do glMultTransposeMatrixf([1,2,3,4]) end
|
85
|
+
assert_raises ArgumentError do glMultTransposeMatrixd([1,2,3,4]) end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_texturecompression
|
89
|
+
supported?("GL_EXT_texture_compression_s3tc")
|
90
|
+
|
91
|
+
# S3TC/DXT5 compressed 2x2 pixels stipple patterns [w,b,b,w] and [b,w,w,b]
|
92
|
+
image_1 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x54,0x5C,0x5C].pack("C*")
|
93
|
+
image_2 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x54,0x01,0x0D,0x0D].pack("C*")
|
94
|
+
|
95
|
+
textures = glGenTextures(3)
|
96
|
+
glBindTexture(GL_TEXTURE_1D,textures[0])
|
97
|
+
glBindTexture(GL_TEXTURE_2D,textures[1])
|
98
|
+
glBindTexture(GL_TEXTURE_3D,textures[2])
|
99
|
+
|
100
|
+
# Note: 1D and 3D compressed textures are not supported by S3TC/DXTn, and usually not supported at all
|
101
|
+
|
102
|
+
# 1D
|
103
|
+
begin
|
104
|
+
glCompressedTexImage1D(GL_TEXTURE_1D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,4,0,16,image_1)
|
105
|
+
assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_1D,0))
|
106
|
+
rescue Gl::Error => err
|
107
|
+
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
108
|
+
end
|
109
|
+
|
110
|
+
begin
|
111
|
+
glCompressedTexSubImage1D(GL_TEXTURE_1D,0,0,4,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,16,image_2)
|
112
|
+
assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_1D,0))
|
113
|
+
rescue Gl::Error => err
|
114
|
+
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
115
|
+
end
|
116
|
+
|
117
|
+
# 2D
|
118
|
+
glCompressedTexImage2D(GL_TEXTURE_2D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,2,2,0,16,image_1)
|
119
|
+
assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_2D,0))
|
120
|
+
|
121
|
+
glCompressedTexSubImage2D(GL_TEXTURE_2D,0,0,0,2,2,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,16,image_2)
|
122
|
+
assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_2D,0))
|
123
|
+
|
124
|
+
# 3D
|
125
|
+
begin
|
126
|
+
glCompressedTexImage3D(GL_TEXTURE_3D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,2,2,1,0,16,image_1)
|
127
|
+
assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_3D,0))
|
128
|
+
rescue Gl::Error => err
|
129
|
+
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
130
|
+
end
|
131
|
+
|
132
|
+
begin
|
133
|
+
glCompressedTexSubImage3D(GL_TEXTURE_3D,0, 0,0,0, 2,2,1, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16, image_2)
|
134
|
+
assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_3D,0))
|
135
|
+
rescue Gl::Error => err
|
136
|
+
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
137
|
+
end
|
138
|
+
|
139
|
+
glDeleteTextures(textures)
|
140
|
+
|
141
|
+
n = glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
|
142
|
+
if (n>0)
|
143
|
+
assert_equal(n, glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS).size)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_glmultitexcoord
|
148
|
+
glActiveTexture(GL_TEXTURE1)
|
149
|
+
|
150
|
+
# 1
|
151
|
+
glMultiTexCoord1d(GL_TEXTURE1, 1.0)
|
152
|
+
assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
153
|
+
glMultiTexCoord1dv(GL_TEXTURE1, [0.0])
|
154
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
155
|
+
glMultiTexCoord1f(GL_TEXTURE1, 1.0)
|
156
|
+
assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
157
|
+
glMultiTexCoord1fv(GL_TEXTURE1, [0.0])
|
158
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
159
|
+
glMultiTexCoord1i(GL_TEXTURE1, 1)
|
160
|
+
assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
161
|
+
glMultiTexCoord1iv(GL_TEXTURE1, [0])
|
162
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
163
|
+
glMultiTexCoord1s(GL_TEXTURE1, 1)
|
164
|
+
assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
165
|
+
glMultiTexCoord1sv(GL_TEXTURE1, [0])
|
166
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
167
|
+
# 2
|
168
|
+
glMultiTexCoord2d(GL_TEXTURE1, 1.0,1.0)
|
169
|
+
assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
170
|
+
glMultiTexCoord2dv(GL_TEXTURE1, [0.0,0.0])
|
171
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
172
|
+
glMultiTexCoord2f(GL_TEXTURE1, 1.0,1.0)
|
173
|
+
assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
174
|
+
glMultiTexCoord2fv(GL_TEXTURE1, [0.0,0.0])
|
175
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
176
|
+
glMultiTexCoord2i(GL_TEXTURE1, 1,1)
|
177
|
+
assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
178
|
+
glMultiTexCoord2iv(GL_TEXTURE1, [0,0])
|
179
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
180
|
+
glMultiTexCoord2s(GL_TEXTURE1, 1,1)
|
181
|
+
assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
182
|
+
glMultiTexCoord2sv(GL_TEXTURE1, [0,0])
|
183
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
184
|
+
# 3
|
185
|
+
glMultiTexCoord3d(GL_TEXTURE1, 1.0,1.0,1.0)
|
186
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
187
|
+
glMultiTexCoord3dv(GL_TEXTURE1, [0.0,0.0,0.0])
|
188
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
189
|
+
glMultiTexCoord3f(GL_TEXTURE1, 1.0,1.0,1.0)
|
190
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
191
|
+
glMultiTexCoord3fv(GL_TEXTURE1, [0.0,0.0,0.0])
|
192
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
193
|
+
glMultiTexCoord3i(GL_TEXTURE1, 1,1,1)
|
194
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
195
|
+
glMultiTexCoord3iv(GL_TEXTURE1, [0,0,0])
|
196
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
197
|
+
glMultiTexCoord3s(GL_TEXTURE1, 1,1,1)
|
198
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
199
|
+
glMultiTexCoord3sv(GL_TEXTURE1, [0,0,0])
|
200
|
+
assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
201
|
+
# 4
|
202
|
+
glMultiTexCoord4d(GL_TEXTURE1, 1.0,1.0,1.0,1.0)
|
203
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
204
|
+
glMultiTexCoord4dv(GL_TEXTURE1, [0.0,0.0,0.0,0.0])
|
205
|
+
assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
206
|
+
glMultiTexCoord4f(GL_TEXTURE1, 1.0,1.0,1.0,1.0)
|
207
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
208
|
+
glMultiTexCoord4fv(GL_TEXTURE1, [0.0,0.0,0.0,0.0])
|
209
|
+
assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
210
|
+
glMultiTexCoord4i(GL_TEXTURE1, 1,1,1,1)
|
211
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
212
|
+
glMultiTexCoord4iv(GL_TEXTURE1, [0,0,0,0])
|
213
|
+
assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
214
|
+
glMultiTexCoord4s(GL_TEXTURE1, 1,1,1,1)
|
215
|
+
assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
216
|
+
glMultiTexCoord4sv(GL_TEXTURE1, [0,0,0,0])
|
217
|
+
assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
|
218
|
+
|
219
|
+
glActiveTexture(GL_TEXTURE0)
|
220
|
+
end
|
229
221
|
end
|