opengl 0.8.0-x86-mingw32 → 0.9.0-x86-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 +1 -0
- data.tar.gz.sig +2 -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/1.9/opengl.so +0 -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 +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 +90 -67
- metadata.gz.sig +0 -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/lib/opengl/opengl.so +0 -0
- 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_14.rb
CHANGED
@@ -19,7 +19,6 @@ class TestGl14 < OpenGL::TestCase
|
|
19
19
|
|
20
20
|
def setup
|
21
21
|
super
|
22
|
-
|
23
22
|
supported? 1.4
|
24
23
|
end
|
25
24
|
|
@@ -27,13 +26,13 @@ class TestGl14 < OpenGL::TestCase
|
|
27
26
|
sc = [0, 1, 0, 1, 0, 1].pack("f*")
|
28
27
|
fc = [1, 0].pack("f*")
|
29
28
|
|
30
|
-
glSecondaryColorPointer(3, GL_FLOAT,
|
29
|
+
glSecondaryColorPointer(3, GL_FLOAT, 12, sc)
|
31
30
|
assert_equal 3, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE)
|
32
31
|
assert_equal GL_FLOAT, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE)
|
33
32
|
assert_equal 12, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE)
|
34
33
|
assert_equal sc, glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER)
|
35
34
|
|
36
|
-
glFogCoordPointer(GL_FLOAT,
|
35
|
+
glFogCoordPointer(GL_FLOAT, 4, fc)
|
37
36
|
assert_equal GL_FLOAT, glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE)
|
38
37
|
assert_equal 4, glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE)
|
39
38
|
assert_equal fc, glGetPointerv(GL_FOG_COORD_ARRAY_POINTER)
|
@@ -45,15 +44,15 @@ class TestGl14 < OpenGL::TestCase
|
|
45
44
|
glArrayElement(0)
|
46
45
|
glEnd()
|
47
46
|
|
48
|
-
assert_equal(
|
49
|
-
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD)
|
47
|
+
assert_equal([0, 1, 0, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
|
48
|
+
assert_equal(1, glGetDoublev(GL_CURRENT_FOG_COORD))
|
50
49
|
|
51
50
|
glBegin(GL_TRIANGLES)
|
52
51
|
glArrayElement(1)
|
53
52
|
glEnd()
|
54
53
|
|
55
|
-
assert_equal(
|
56
|
-
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD)
|
54
|
+
assert_equal([1, 0, 1, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
|
55
|
+
assert_equal(0, glGetDoublev(GL_CURRENT_FOG_COORD))
|
57
56
|
|
58
57
|
glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
|
59
58
|
glDisableClientState(GL_FOG_COORD_ARRAY)
|
@@ -81,21 +80,21 @@ class TestGl14 < OpenGL::TestCase
|
|
81
80
|
|
82
81
|
def test_glblendfuncseparate
|
83
82
|
glBlendFuncSeparate(GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR)
|
84
|
-
assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB)
|
85
|
-
assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA)
|
86
|
-
assert_equal(glGetIntegerv(GL_BLEND_DST_RGB)
|
87
|
-
assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA)
|
83
|
+
assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_SRC_RGB))
|
84
|
+
assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_SRC_ALPHA))
|
85
|
+
assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_DST_RGB))
|
86
|
+
assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_DST_ALPHA))
|
88
87
|
end
|
89
88
|
|
90
89
|
def test_glpointparameter
|
91
90
|
glPointParameterf(GL_POINT_SIZE_MIN, 2.0)
|
92
|
-
assert_equal(glGetDoublev(GL_POINT_SIZE_MIN)
|
91
|
+
assert_equal(2.0, glGetDoublev(GL_POINT_SIZE_MIN))
|
93
92
|
|
94
93
|
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, [0, 1, 0])
|
95
94
|
assert_equal([0, 1, 0], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
|
96
95
|
|
97
96
|
glPointParameteri(GL_POINT_SIZE_MAX, 4)
|
98
|
-
assert_equal(glGetDoublev(GL_POINT_SIZE_MAX)
|
97
|
+
assert_equal(4, glGetDoublev(GL_POINT_SIZE_MAX))
|
99
98
|
|
100
99
|
glPointParameteriv(GL_POINT_DISTANCE_ATTENUATION, [1, 0, 1])
|
101
100
|
assert_equal([1, 0, 1], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
|
@@ -103,14 +102,14 @@ class TestGl14 < OpenGL::TestCase
|
|
103
102
|
|
104
103
|
def test_glfogcoord
|
105
104
|
glFogCoordf(2.0)
|
106
|
-
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD)
|
105
|
+
assert_equal(2.0, glGetDoublev(GL_CURRENT_FOG_COORD))
|
107
106
|
glFogCoordfv([3.0])
|
108
|
-
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD)
|
107
|
+
assert_equal(3.0, glGetDoublev(GL_CURRENT_FOG_COORD))
|
109
108
|
|
110
109
|
glFogCoordd(2.0)
|
111
|
-
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD)
|
110
|
+
assert_equal(2.0, glGetDoublev(GL_CURRENT_FOG_COORD))
|
112
111
|
glFogCoorddv([3.0])
|
113
|
-
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD)
|
112
|
+
assert_equal(3.0, glGetDoublev(GL_CURRENT_FOG_COORD))
|
114
113
|
end
|
115
114
|
|
116
115
|
def test_glsecondarycolor
|
@@ -216,6 +215,4 @@ class TestGl14 < OpenGL::TestCase
|
|
216
215
|
glWindowPos3sv [3, 2, 1]
|
217
216
|
assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
|
218
217
|
end
|
219
|
-
|
220
218
|
end
|
221
|
-
|
data/test/test_gl_15.rb
CHANGED
@@ -19,7 +19,6 @@ class TestGl15 < OpenGL::TestCase
|
|
19
19
|
|
20
20
|
def setup
|
21
21
|
super
|
22
|
-
|
23
22
|
supported? 1.5
|
24
23
|
end
|
25
24
|
|
@@ -72,7 +71,7 @@ class TestGl15 < OpenGL::TestCase
|
|
72
71
|
r = glUnmapBuffer(GL_ARRAY_BUFFER)
|
73
72
|
assert(r == true || r == false)
|
74
73
|
|
75
|
-
glDeleteBuffers(buffers)
|
74
|
+
glDeleteBuffers(buffers)
|
76
75
|
refute glIsBuffer(buffers[0])
|
77
76
|
|
78
77
|
# FIXME: GetBufferPointerv not yet implemented
|
@@ -251,10 +250,9 @@ class TestGl15 < OpenGL::TestCase
|
|
251
250
|
glMultiDrawElements(GL_TRIANGLES, GL_UNSIGNED_BYTE, [3, 3], [0, 3])
|
252
251
|
|
253
252
|
count = glRenderMode(GL_RENDER)
|
254
|
-
assert_equal 2 * (3 * 3 + 2)
|
253
|
+
assert_equal count, 2 * (3 * 3 + 2)
|
255
254
|
|
256
255
|
glDisableClientState(GL_VERTEX_ARRAY)
|
257
256
|
glDeleteBuffers(buffers)
|
258
257
|
end
|
259
|
-
|
260
258
|
end
|
data/test/test_gl_20.rb
CHANGED
@@ -19,48 +19,47 @@ class TestGl20 < OpenGL::TestCase
|
|
19
19
|
|
20
20
|
def setup
|
21
21
|
super
|
22
|
-
|
23
22
|
supported? 2.0
|
24
23
|
end
|
25
24
|
|
26
25
|
def test_glblendequationseparate
|
27
26
|
glBlendEquationSeparate(GL_MIN, GL_MAX)
|
28
|
-
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB)
|
29
|
-
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA)
|
27
|
+
assert_equal(GL_MIN, glGetIntegerv(GL_BLEND_EQUATION_RGB))
|
28
|
+
assert_equal(GL_MAX, glGetIntegerv(GL_BLEND_EQUATION_ALPHA))
|
30
29
|
glBlendEquationSeparate(GL_MAX, GL_MIN)
|
31
|
-
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB)
|
32
|
-
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA)
|
30
|
+
assert_equal(GL_MAX, glGetIntegerv(GL_BLEND_EQUATION_RGB))
|
31
|
+
assert_equal(GL_MIN, glGetIntegerv(GL_BLEND_EQUATION_ALPHA))
|
33
32
|
end
|
34
33
|
|
35
34
|
def test_stencilops
|
36
35
|
glStencilOpSeparate(GL_FRONT, GL_ZERO, GL_INCR, GL_DECR)
|
37
|
-
assert_equal(glGetIntegerv(GL_STENCIL_FAIL)
|
38
|
-
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL)
|
39
|
-
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS)
|
36
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_STENCIL_FAIL))
|
37
|
+
assert_equal(GL_INCR, glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL))
|
38
|
+
assert_equal(GL_DECR, glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS))
|
40
39
|
glStencilOpSeparate(GL_FRONT, GL_INCR, GL_DECR, GL_ZERO)
|
41
|
-
assert_equal(glGetIntegerv(GL_STENCIL_FAIL)
|
42
|
-
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL)
|
43
|
-
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS)
|
40
|
+
assert_equal(GL_INCR, glGetIntegerv(GL_STENCIL_FAIL))
|
41
|
+
assert_equal(GL_DECR, glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL))
|
42
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS))
|
44
43
|
|
45
44
|
glStencilFuncSeparate(GL_FRONT, GL_LEQUAL, 1, 0)
|
46
|
-
assert_equal(glGetIntegerv(GL_STENCIL_FUNC)
|
47
|
-
assert_equal(glGetIntegerv(GL_STENCIL_REF)
|
48
|
-
assert_equal(glGetIntegerv(GL_STENCIL_VALUE_MASK)
|
45
|
+
assert_equal(GL_LEQUAL, glGetIntegerv(GL_STENCIL_FUNC))
|
46
|
+
assert_equal(1, glGetIntegerv(GL_STENCIL_REF))
|
47
|
+
assert_equal(0, glGetIntegerv(GL_STENCIL_VALUE_MASK))
|
49
48
|
glStencilFuncSeparate(GL_FRONT, GL_GEQUAL, 0, 1)
|
50
|
-
assert_equal(glGetIntegerv(GL_STENCIL_FUNC)
|
51
|
-
assert_equal(glGetIntegerv(GL_STENCIL_REF)
|
52
|
-
assert_equal(glGetIntegerv(GL_STENCIL_VALUE_MASK)
|
49
|
+
assert_equal(GL_GEQUAL, glGetIntegerv(GL_STENCIL_FUNC))
|
50
|
+
assert_equal(0, glGetIntegerv(GL_STENCIL_REF))
|
51
|
+
assert_equal(1, glGetIntegerv(GL_STENCIL_VALUE_MASK))
|
53
52
|
|
54
53
|
glStencilMaskSeparate(GL_FRONT, 1)
|
55
|
-
assert_equal(glGetIntegerv( GL_STENCIL_WRITEMASK)
|
54
|
+
assert_equal(1, glGetIntegerv( GL_STENCIL_WRITEMASK))
|
56
55
|
glStencilMaskSeparate(GL_FRONT, 0)
|
57
|
-
assert_equal(glGetIntegerv(GL_STENCIL_WRITEMASK)
|
56
|
+
assert_equal(0, glGetIntegerv(GL_STENCIL_WRITEMASK))
|
58
57
|
end
|
59
58
|
|
60
59
|
def test_gldrawbuf
|
61
60
|
glDrawBuffers([GL_FRONT_LEFT, GL_BACK_LEFT])
|
62
|
-
assert_equal(glGetIntegerv(GL_DRAW_BUFFER0)
|
63
|
-
assert_equal(glGetIntegerv(GL_DRAW_BUFFER1)
|
61
|
+
assert_equal(GL_FRONT_LEFT, glGetIntegerv(GL_DRAW_BUFFER0))
|
62
|
+
assert_equal(GL_BACK_LEFT, glGetIntegerv(GL_DRAW_BUFFER1))
|
64
63
|
end
|
65
64
|
|
66
65
|
def test_glvertexattrib
|
@@ -230,15 +229,9 @@ uniform ivec3 testivec3;
|
|
230
229
|
uniform ivec4 testivec4;
|
231
230
|
|
232
231
|
void main() {
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
testvec4;
|
237
|
-
testivec1;
|
238
|
-
testivec2;
|
239
|
-
testivec3;
|
240
|
-
testivec4;
|
241
|
-
gl_Position = ftransform();
|
232
|
+
gl_Position = ftransform() *
|
233
|
+
testvec1 * testvec2[0] * testvec3[0] * testvec4[0] *
|
234
|
+
float(testivec1) * float(testivec2[0]) * float(testivec3[0]) * float(testivec4[0]);
|
242
235
|
}
|
243
236
|
SHADER
|
244
237
|
|
@@ -265,47 +258,47 @@ void main() {
|
|
265
258
|
glUseProgram program
|
266
259
|
|
267
260
|
test = glGetAttribLocation program, "test"
|
268
|
-
assert_equal
|
261
|
+
assert_equal(-1, test)
|
269
262
|
|
270
263
|
tv1l = glGetUniformLocation program, "testvec1"
|
271
|
-
refute_equal
|
264
|
+
refute_equal(-1, tv1l, "testvec1 missing!")
|
272
265
|
|
273
266
|
tv2l = glGetUniformLocation program, "testvec2"
|
274
|
-
refute_equal
|
267
|
+
refute_equal(-1, tv2l, "testvec2 missing!")
|
275
268
|
|
276
269
|
tv3l = glGetUniformLocation program, "testvec3"
|
277
|
-
refute_equal
|
270
|
+
refute_equal(-1, tv3l, "testvec3 missing!")
|
278
271
|
|
279
272
|
tv4l = glGetUniformLocation program, "testvec4"
|
280
|
-
refute_equal
|
273
|
+
refute_equal(-1, tv4l, "testvec4 missing!")
|
281
274
|
|
282
275
|
tv1il = glGetUniformLocation program, "testivec1"
|
283
|
-
refute_equal
|
276
|
+
refute_equal(-1, tv1il, "testivec1 missing!")
|
284
277
|
|
285
278
|
tv2il = glGetUniformLocation program, "testivec2"
|
286
|
-
refute_equal
|
279
|
+
refute_equal(-1, tv2il, "testivec2 missing!")
|
287
280
|
|
288
281
|
tv3il = glGetUniformLocation program, "testivec3"
|
289
|
-
refute_equal
|
282
|
+
refute_equal(-1, tv3il, "testivec3 missing!")
|
290
283
|
|
291
284
|
tv4il = glGetUniformLocation program, "testivec4"
|
292
|
-
refute_equal
|
285
|
+
refute_equal(-1, tv4il, "testivec4 missing!")
|
293
286
|
|
294
287
|
assert_equal [1, GL_FLOAT_VEC4, "gl_Vertex"], glGetActiveAttrib(program, 0)
|
295
288
|
assert_equal [1, GL_INT, "testivec1"], glGetActiveUniform(program, tv1il)
|
296
289
|
|
297
290
|
# f
|
298
291
|
glUniform1f(tv1l, 2.0)
|
299
|
-
assert_equal(glGetUniformfv(program, tv1l)
|
292
|
+
assert_equal(2.0, glGetUniformfv(program, tv1l))
|
300
293
|
glUniform2f(tv2l, 2.0, 2.0)
|
301
294
|
assert_equal([2.0, 2.0], glGetUniformfv(program, tv2l))
|
302
295
|
glUniform3f(tv3l, 2.0, 2.0, 2.0)
|
303
296
|
assert_equal([2.0, 2.0, 2.0], glGetUniformfv(program, tv3l))
|
304
297
|
glUniform4f(tv4l, 2.0, 2.0, 2.0, 2.0)
|
305
298
|
assert_equal([2.0, 2.0, 2.0, 2.0], glGetUniformfv(program, tv4l))
|
306
|
-
# i
|
299
|
+
# i
|
307
300
|
glUniform1i(tv1il, 3)
|
308
|
-
assert_equal(glGetUniformiv(program, tv1il)
|
301
|
+
assert_equal(3, glGetUniformiv(program, tv1il))
|
309
302
|
glUniform2i(tv2il, 3, 3)
|
310
303
|
assert_equal([3, 3], glGetUniformiv(program, tv2il))
|
311
304
|
glUniform3i(tv3il, 3, 3, 3)
|
@@ -314,7 +307,7 @@ void main() {
|
|
314
307
|
assert_equal([3, 3, 3, 3], glGetUniformiv(program, tv4il))
|
315
308
|
# fv
|
316
309
|
glUniform1fv(tv1l, [3.0])
|
317
|
-
assert_equal(glGetUniformfv(program, tv1l)
|
310
|
+
assert_equal(3.0, glGetUniformfv(program, tv1l))
|
318
311
|
glUniform2fv(tv2l, [3.0, 3.0])
|
319
312
|
assert_equal([3.0, 3.0], glGetUniformfv(program, tv2l))
|
320
313
|
glUniform3fv(tv3l, [3.0, 3.0, 3.0])
|
@@ -323,7 +316,7 @@ void main() {
|
|
323
316
|
assert_equal([3.0, 3.0, 3.0, 3.0], glGetUniformfv(program, tv4l))
|
324
317
|
# iv
|
325
318
|
glUniform1iv(tv1il, [2])
|
326
|
-
assert_equal(glGetUniformiv(program, tv1il)
|
319
|
+
assert_equal(2, glGetUniformiv(program, tv1il))
|
327
320
|
glUniform2iv(tv2il, [2, 2])
|
328
321
|
assert_equal([2, 2], glGetUniformiv(program, tv2il))
|
329
322
|
glUniform3iv(tv3il, [2, 2, 2])
|
@@ -344,10 +337,7 @@ uniform mat3 testmat3;
|
|
344
337
|
uniform mat4 testmat4;
|
345
338
|
|
346
339
|
void main() {
|
347
|
-
testmat2;
|
348
|
-
testmat3;
|
349
|
-
testmat4;
|
350
|
-
gl_Position = ftransform();
|
340
|
+
gl_Position = ftransform() * testmat2[0][0] * testmat3[0][0] * testmat4[0][0];
|
351
341
|
}
|
352
342
|
SHADER
|
353
343
|
|
@@ -383,22 +373,21 @@ void main() {
|
|
383
373
|
uniforms[uniform.last] = i
|
384
374
|
end
|
385
375
|
|
386
|
-
glUniformMatrix2fv(uniforms['testmat2'], GL_TRUE, [0, 1,
|
376
|
+
glUniformMatrix2fv(uniforms['testmat2'], GL_TRUE, [0, 1, 2, 3])
|
387
377
|
|
388
|
-
assert_each_in_delta([0,
|
378
|
+
assert_each_in_delta([0, 2, 1, 3],
|
389
379
|
glGetUniformfv(program, uniforms['testmat2']))
|
390
380
|
|
391
|
-
skip "glUniformMatrix3fv complains but I don't know why"
|
392
381
|
glUniformMatrix3fv(uniforms['testmat3'], GL_TRUE,
|
393
|
-
[
|
382
|
+
[0, 1, 2, 3, 4, 5, 6, 7, 8])
|
394
383
|
|
395
|
-
assert_each_in_delta([
|
384
|
+
assert_each_in_delta([0, 3, 6, 1, 4, 7, 2, 5, 8],
|
396
385
|
glGetUniformfv(program, uniforms['testmat3']))
|
397
386
|
|
398
387
|
glUniformMatrix4fv(uniforms['testmat4'], GL_TRUE,
|
399
|
-
[0, 1,
|
388
|
+
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
|
400
389
|
|
401
|
-
assert_each_in_delta([0,
|
390
|
+
assert_each_in_delta([0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15],
|
402
391
|
glGetUniformfv(program, uniforms['testmat4']))
|
403
392
|
ensure
|
404
393
|
glDeleteProgram program
|
@@ -413,7 +402,7 @@ void main() {
|
|
413
402
|
glBufferData(GL_ARRAY_BUFFER, 8*4, vaa, GL_DYNAMIC_DRAW)
|
414
403
|
|
415
404
|
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 0, 0)
|
416
|
-
assert_equal(glGetVertexAttribPointerv(1)
|
405
|
+
assert_equal(0, glGetVertexAttribPointerv(1))
|
417
406
|
|
418
407
|
glEnableVertexAttribArray(1)
|
419
408
|
|
@@ -425,6 +414,4 @@ void main() {
|
|
425
414
|
glDisableVertexAttribArray(1)
|
426
415
|
glDeleteBuffers(buffers)
|
427
416
|
end
|
428
|
-
|
429
417
|
end
|
430
|
-
|
data/test/test_gl_21.rb
CHANGED
@@ -19,7 +19,6 @@ class TestGl21 < OpenGL::TestCase
|
|
19
19
|
|
20
20
|
def setup
|
21
21
|
super
|
22
|
-
|
23
22
|
supported? 2.1
|
24
23
|
end
|
25
24
|
|
@@ -48,25 +47,25 @@ void main() {
|
|
48
47
|
glShaderSource(vs, vertex_shader_source)
|
49
48
|
glCompileShader(vs)
|
50
49
|
|
51
|
-
assert_equal(glGetShaderiv(vs, GL_COMPILE_STATUS)
|
50
|
+
assert_equal(GL_TRUE, glGetShaderiv(vs, GL_COMPILE_STATUS))
|
52
51
|
glAttachShader(program, vs)
|
53
52
|
|
54
|
-
glLinkProgram(program)
|
55
|
-
assert_equal(glGetProgramiv(program, GL_LINK_STATUS)
|
53
|
+
glLinkProgram(program)
|
54
|
+
assert_equal(GL_TRUE, glGetProgramiv(program, GL_LINK_STATUS))
|
56
55
|
glUseProgram(program)
|
57
56
|
|
58
57
|
tm23l = glGetUniformLocation(program, "testmat23")
|
59
|
-
refute_equal
|
58
|
+
refute_equal(-1, tm23l, "testmat23 missing!")
|
60
59
|
tm32l = glGetUniformLocation(program, "testmat32")
|
61
|
-
refute_equal
|
60
|
+
refute_equal(-1, tm32l, "testmat32 missing!")
|
62
61
|
tm24l = glGetUniformLocation(program, "testmat24")
|
63
|
-
refute_equal
|
62
|
+
refute_equal(-1, tm24l, "testmat24 missing!")
|
64
63
|
tm42l = glGetUniformLocation(program, "testmat42")
|
65
|
-
refute_equal
|
64
|
+
refute_equal(-1, tm42l, "testmat42 missing!")
|
66
65
|
tm34l = glGetUniformLocation(program, "testmat34")
|
67
|
-
refute_equal
|
66
|
+
refute_equal(-1, tm34l, "testmat34 missing!")
|
68
67
|
tm43l = glGetUniformLocation(program, "testmat43")
|
69
|
-
refute_equal
|
68
|
+
refute_equal(-1, tm43l, "testmat43 missing!")
|
70
69
|
|
71
70
|
refute_equal(-1, glGetUniformLocation(program, "testmat23"),
|
72
71
|
"testmat23 missing!")
|
@@ -81,50 +80,49 @@ void main() {
|
|
81
80
|
refute_equal(-1, glGetUniformLocation(program, "testmat43"),
|
82
81
|
"testmat43 missing!")
|
83
82
|
|
84
|
-
uniforms = Hash.new
|
83
|
+
uniforms = Hash.new { |_, k| raise "invalid uniform #{k}" }
|
85
84
|
(0...glGetProgramiv(program, GL_ACTIVE_UNIFORMS)).each do |i|
|
86
85
|
uniform = glGetActiveUniform program, i
|
87
86
|
uniforms[uniform.last] = i
|
88
87
|
end
|
89
88
|
|
90
|
-
skip "glUniformMatrix2x3fv complains but I don't know why"
|
91
89
|
glUniformMatrix2x3fv(uniforms["testmat23"], GL_FALSE, [0, 1, 1, 0, 0, 1])
|
92
|
-
assert_equal(
|
90
|
+
assert_equal([0, 1, 1, 0, 0, 1], glGetUniformfv(program, uniforms["testmat23"]))
|
93
91
|
glUniformMatrix3x2fv(uniforms["testmat32"], GL_FALSE, [1, 0, 0, 1, 1, 0])
|
94
|
-
assert_equal(
|
92
|
+
assert_equal([1, 0, 0, 1, 1, 0], glGetUniformfv(program, uniforms["testmat32"]))
|
95
93
|
|
96
94
|
glUniformMatrix2x4fv(uniforms["testmat24"], GL_FALSE, [0, 1, 1, 0, 0, 1, 1, 0])
|
97
|
-
assert_equal(
|
95
|
+
assert_equal([0, 1, 1, 0, 0, 1, 1, 0], glGetUniformfv(program, uniforms["testmat24"]))
|
98
96
|
glUniformMatrix4x2fv(uniforms["testmat42"], GL_FALSE, [1, 0, 0, 1, 1, 0, 0, 1])
|
99
|
-
assert_equal(
|
97
|
+
assert_equal([1, 0, 0, 1, 1, 0, 0, 1], glGetUniformfv(program, uniforms["testmat42"]))
|
100
98
|
|
101
99
|
glUniformMatrix3x4fv(uniforms["testmat34"], GL_FALSE, [0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1])
|
102
|
-
assert_equal(
|
100
|
+
assert_equal([0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1], glGetUniformfv(program, uniforms["testmat34"]))
|
103
101
|
glUniformMatrix4x3fv(uniforms["testmat43"], GL_FALSE, [1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0])
|
104
|
-
assert_equal(
|
102
|
+
assert_equal([1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], glGetUniformfv(program, uniforms["testmat43"]))
|
105
103
|
|
106
104
|
# 2
|
107
105
|
m = Matrix.rows([[0, 1], [1, 0], [0, 1]])
|
108
106
|
glUniformMatrix2x3fv(uniforms["testmat23"], GL_FALSE, m)
|
109
|
-
assert_equal(
|
107
|
+
assert_equal([0, 1, 1, 0, 0, 1], glGetUniformfv(program, uniforms["testmat23"]))
|
110
108
|
m = Matrix.rows([[0, 1, 1], [0, 0, 1]])
|
111
109
|
glUniformMatrix3x2fv(uniforms["testmat32"], GL_FALSE, m)
|
112
|
-
assert_equal(
|
110
|
+
assert_equal([0, 1, 1, 0, 0, 1], glGetUniformfv(program, uniforms["testmat32"]))
|
113
111
|
|
114
112
|
m = Matrix.rows([[0, 1], [1, 0], [0, 1], [1, 0]])
|
115
113
|
glUniformMatrix2x4fv(uniforms["testmat24"], GL_FALSE, m)
|
116
|
-
assert_equal(
|
114
|
+
assert_equal([0, 1, 1, 0, 0, 1, 1, 0], glGetUniformfv(program, uniforms["testmat24"]))
|
117
115
|
m = Matrix.rows([[0, 1, 1, 1], [0, 0, 1, 1]])
|
118
116
|
glUniformMatrix4x2fv(uniforms["testmat42"], GL_FALSE, m)
|
119
|
-
assert_equal(
|
117
|
+
assert_equal([0, 1, 1, 1, 0, 0, 1, 1], glGetUniformfv(program, uniforms["testmat42"]))
|
120
118
|
|
121
119
|
m = Matrix.rows([[0, 1, 0], [1, 0, 1], [0, 1, 0], [1, 0, 1]])
|
122
120
|
glUniformMatrix3x4fv(uniforms["testmat34"], GL_FALSE, m)
|
123
|
-
assert_equal(
|
121
|
+
assert_equal([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], glGetUniformfv(program, uniforms["testmat34"]))
|
124
122
|
|
125
123
|
m = Matrix.rows([[0, 1, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0]])
|
126
124
|
glUniformMatrix4x3fv(uniforms["testmat43"], GL_FALSE, m)
|
127
|
-
assert_equal(
|
125
|
+
assert_equal([0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0], glGetUniformfv(program, uniforms["testmat43"]))
|
128
126
|
|
129
127
|
# 3
|
130
128
|
assert_raises ArgumentError do glUniformMatrix2x3fv(uniforms["testmat23"], GL_FALSE, [1, 2, 3, 4]) end
|
@@ -136,6 +134,7 @@ void main() {
|
|
136
134
|
end
|
137
135
|
|
138
136
|
def test_pixelunpack_bitmap
|
137
|
+
skip("Segfaults on Mesa until upstream fixes it")
|
139
138
|
glOrtho(0, WINDOW_SIZE, 0, WINDOW_SIZE, 0, -1)
|
140
139
|
|
141
140
|
bitmap = [ 0x55 ] * 8 # 64 bits (8x8 bitmap), stipple pattern
|
@@ -148,47 +147,7 @@ void main() {
|
|
148
147
|
|
149
148
|
glBitmap(8, 8, 0, 0, 0, 0, 0)
|
150
149
|
data = glReadPixels(0, 0, 8, 8, GL_RED, GL_UNSIGNED_BYTE)
|
151
|
-
assert_equal(
|
152
|
-
|
153
|
-
glDeleteBuffers(buffers)
|
154
|
-
end
|
155
|
-
|
156
|
-
def test_pixelunpack_color_convolution
|
157
|
-
ct = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
158
|
-
ct2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
159
|
-
|
160
|
-
buffers = glGenBuffers(2)
|
161
|
-
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
162
|
-
glBufferData(GL_PIXEL_UNPACK_BUFFER, 4*3*4, ct, GL_DYNAMIC_DRAW)
|
163
|
-
|
164
|
-
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
165
|
-
glBufferData(GL_PIXEL_UNPACK_BUFFER, 4*3*4, ct2, GL_DYNAMIC_DRAW)
|
166
|
-
|
167
|
-
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
168
|
-
glColorTable(GL_COLOR_TABLE, GL_RGB8, 4, GL_RGB, GL_FLOAT, 0)
|
169
|
-
assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct)
|
170
|
-
glConvolutionFilter1D(GL_CONVOLUTION_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT, 0)
|
171
|
-
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT), ct)
|
172
|
-
|
173
|
-
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
174
|
-
glColorSubTable(GL_COLOR_TABLE, 0, 4, GL_RGB, GL_FLOAT, 0)
|
175
|
-
assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct2)
|
176
|
-
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB8, 2, 2, GL_RGB, GL_FLOAT, 0)
|
177
|
-
assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT), ct2)
|
178
|
-
|
179
|
-
glDeleteBuffers(buffers)
|
180
|
-
end
|
181
|
-
|
182
|
-
def test_pixelunpack_separable
|
183
|
-
sf_a = ([0]*3+[1]*3).pack("f*")
|
184
|
-
sf_b = ([1]*3+[0]*3).pack("f*")
|
185
|
-
|
186
|
-
buffers = glGenBuffers(1)
|
187
|
-
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
188
|
-
glBufferData(GL_PIXEL_UNPACK_BUFFER, 2*3*4 *2, sf_a + sf_b, GL_DYNAMIC_DRAW)
|
189
|
-
|
190
|
-
glSeparableFilter2D(GL_SEPARABLE_2D, GL_RGB8, 2, 2, GL_RGB, GL_FLOAT, 0, 2*3*4)
|
191
|
-
assert_equal(glGetSeparableFilter(GL_SEPARABLE_2D, GL_RGB, GL_FLOAT), [sf_a, sf_b])
|
150
|
+
assert_equal([0, 255] * 32, data.unpack("C*"))
|
192
151
|
|
193
152
|
glDeleteBuffers(buffers)
|
194
153
|
end
|
@@ -206,7 +165,7 @@ void main() {
|
|
206
165
|
glDrawPixels(4, 4, GL_RGB, GL_FLOAT, 0)
|
207
166
|
|
208
167
|
data = glReadPixels(0, 0, 4, 4, GL_RGB, GL_FLOAT)
|
209
|
-
assert_equal(
|
168
|
+
assert_equal(image, data)
|
210
169
|
|
211
170
|
glDeleteBuffers(buffers)
|
212
171
|
end
|
@@ -218,7 +177,7 @@ void main() {
|
|
218
177
|
glBufferData(GL_PIXEL_UNPACK_BUFFER, 128, stipple, GL_DYNAMIC_DRAW)
|
219
178
|
|
220
179
|
glPolygonStipple(0)
|
221
|
-
assert_equal(glGetPolygonStipple()
|
180
|
+
assert_equal(stipple, glGetPolygonStipple())
|
222
181
|
glDeleteBuffers(buffers)
|
223
182
|
end
|
224
183
|
|
@@ -247,7 +206,7 @@ void main() {
|
|
247
206
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
248
207
|
begin
|
249
208
|
glCompressedTexImage1D(GL_TEXTURE_1D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 0, 16, 0)
|
250
|
-
assert_equal(glGetCompressedTexImage(GL_TEXTURE_1D, 0)
|
209
|
+
assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_1D, 0))
|
251
210
|
rescue Gl::Error => err
|
252
211
|
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
253
212
|
end
|
@@ -255,7 +214,7 @@ void main() {
|
|
255
214
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
256
215
|
begin
|
257
216
|
glCompressedTexSubImage1D(GL_TEXTURE_1D, 0, 0, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16, 0)
|
258
|
-
assert_equal(glGetCompressedTexImage(GL_TEXTURE_1D, 0)
|
217
|
+
assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_1D, 0))
|
259
218
|
rescue Gl::Error => err
|
260
219
|
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
261
220
|
end
|
@@ -263,17 +222,17 @@ void main() {
|
|
263
222
|
# 2D
|
264
223
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
265
224
|
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 2, 2, 0, 16, 0)
|
266
|
-
assert_equal(glGetCompressedTexImage(GL_TEXTURE_2D, 0)
|
225
|
+
assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_2D, 0))
|
267
226
|
|
268
227
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
269
228
|
glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 2, 2, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16, 0)
|
270
|
-
assert_equal(glGetCompressedTexImage(GL_TEXTURE_2D, 0)
|
229
|
+
assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_2D, 0))
|
271
230
|
|
272
231
|
# 3D
|
273
232
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
274
233
|
begin
|
275
234
|
glCompressedTexImage3D(GL_TEXTURE_3D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 2, 2, 1, 0, 16, 0)
|
276
|
-
assert_equal(glGetCompressedTexImage(GL_TEXTURE_3D, 0)
|
235
|
+
assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_3D, 0))
|
277
236
|
rescue Gl::Error => err
|
278
237
|
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
279
238
|
end
|
@@ -281,7 +240,7 @@ void main() {
|
|
281
240
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
282
241
|
begin
|
283
242
|
glCompressedTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 2, 2, 1, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16, 0)
|
284
|
-
assert_equal(glGetCompressedTexImage(GL_TEXTURE_3D, 0)
|
243
|
+
assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_3D, 0))
|
285
244
|
rescue Gl::Error => err
|
286
245
|
assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
|
287
246
|
end
|
@@ -306,22 +265,22 @@ void main() {
|
|
306
265
|
|
307
266
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
308
267
|
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8, 2, 2, 4, 0, GL_RGB, GL_FLOAT, 0)
|
309
|
-
assert_equal(glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT)
|
268
|
+
assert_equal(image_1, glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT))
|
310
269
|
|
311
270
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
312
271
|
glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 2, 2, 4, GL_RGB, GL_FLOAT, 0)
|
313
|
-
assert_equal(glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT)
|
272
|
+
assert_equal(image_2, glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT))
|
314
273
|
|
315
274
|
# 2D
|
316
275
|
glBindTexture(GL_TEXTURE_2D, textures[1])
|
317
276
|
|
318
277
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
319
278
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 4, 4, 0, GL_RGB, GL_FLOAT, 0)
|
320
|
-
assert_equal(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT)
|
279
|
+
assert_equal(image_1, glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT))
|
321
280
|
|
322
281
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
323
282
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_FLOAT, 0)
|
324
|
-
assert_equal(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT)
|
283
|
+
assert_equal(image_2, glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT))
|
325
284
|
|
326
285
|
# 1D
|
327
286
|
glBindTexture(GL_TEXTURE_1D, textures[2])
|
@@ -329,11 +288,11 @@ void main() {
|
|
329
288
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[0])
|
330
289
|
|
331
290
|
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB8, 16, 0, GL_RGB, GL_FLOAT, 0)
|
332
|
-
assert_equal(glGetTexImage(GL_TEXTURE_1D, 0, GL_RGB, GL_FLOAT)
|
291
|
+
assert_equal(image_1, glGetTexImage(GL_TEXTURE_1D, 0, GL_RGB, GL_FLOAT))
|
333
292
|
|
334
293
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffers[1])
|
335
294
|
glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 16, GL_RGB, GL_FLOAT, 0)
|
336
|
-
assert_equal(glGetTexImage(GL_TEXTURE_1D, 0, GL_RGB, GL_FLOAT)
|
295
|
+
assert_equal(image_2, glGetTexImage(GL_TEXTURE_1D, 0, GL_RGB, GL_FLOAT))
|
337
296
|
|
338
297
|
glDeleteBuffers(buffers)
|
339
298
|
glDeleteTextures(textures)
|
@@ -349,13 +308,13 @@ void main() {
|
|
349
308
|
glBufferData(GL_PIXEL_UNPACK_BUFFER, 4*4+4*4+4*2, data_1+data_2+data_3, GL_DYNAMIC_DRAW)
|
350
309
|
|
351
310
|
glPixelMapfv(GL_PIXEL_MAP_I_TO_I, 4, 0)
|
352
|
-
assert_equal(
|
311
|
+
assert_equal([1, 2, 3, 4], glGetPixelMapfv(GL_PIXEL_MAP_I_TO_I))
|
353
312
|
|
354
313
|
glPixelMapuiv(GL_PIXEL_MAP_I_TO_I, 4, 4*4)
|
355
|
-
assert_equal(
|
314
|
+
assert_equal([5, 6, 7, 8], glGetPixelMapuiv(GL_PIXEL_MAP_I_TO_I))
|
356
315
|
|
357
316
|
glPixelMapusv(GL_PIXEL_MAP_I_TO_I, 4, 4*4+4*4)
|
358
|
-
assert_equal(
|
317
|
+
assert_equal([9, 10, 11, 12], glGetPixelMapusv(GL_PIXEL_MAP_I_TO_I))
|
359
318
|
|
360
319
|
glDeleteBuffers(buffers)
|
361
320
|
end
|
@@ -373,7 +332,7 @@ void main() {
|
|
373
332
|
glReadPixels(0, 0, 4, 4, GL_RGB, GL_FLOAT, 0)
|
374
333
|
|
375
334
|
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
376
|
-
assert_equal(
|
335
|
+
assert_equal(image, data)
|
377
336
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
378
337
|
|
379
338
|
glDeleteBuffers(buffers)
|
@@ -384,7 +343,7 @@ void main() {
|
|
384
343
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffers[0])
|
385
344
|
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, 4*4, nil, GL_STREAM_READ)
|
386
345
|
|
387
|
-
# fv
|
346
|
+
# fv
|
388
347
|
glPixelMapfv(GL_PIXEL_MAP_I_TO_I, [1, 2, 3, 4])
|
389
348
|
glGetPixelMapfv(GL_PIXEL_MAP_I_TO_I, 0)
|
390
349
|
|
@@ -400,7 +359,7 @@ void main() {
|
|
400
359
|
assert_equal([5, 6, 7, 8].pack("I*"), data)
|
401
360
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
402
361
|
|
403
|
-
# usv
|
362
|
+
# usv
|
404
363
|
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, 4*2, nil, GL_STREAM_READ)
|
405
364
|
|
406
365
|
glPixelMapusv(GL_PIXEL_MAP_I_TO_I, [9, 10, 11, 12])
|
@@ -430,80 +389,6 @@ void main() {
|
|
430
389
|
glDeleteBuffers(buffers)
|
431
390
|
end
|
432
391
|
|
433
|
-
def test_pixelpack_separablefilter
|
434
|
-
sf_a = ([0]*3+[1]*3).pack("f*")
|
435
|
-
sf_b = ([1]*3+[0]*3).pack("f*")
|
436
|
-
|
437
|
-
buffers = glGenBuffers(1)
|
438
|
-
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffers[0])
|
439
|
-
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, 6*4 + 6*4, nil, GL_STREAM_READ)
|
440
|
-
|
441
|
-
glSeparableFilter2D(GL_SEPARABLE_2D, GL_RGB8, 2, 2, GL_RGB, GL_FLOAT, sf_a, sf_b)
|
442
|
-
glGetSeparableFilter(GL_SEPARABLE_2D, GL_RGB, GL_FLOAT, 0, 6*4, 0)
|
443
|
-
|
444
|
-
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
445
|
-
assert_equal(data, sf_a + sf_b)
|
446
|
-
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
447
|
-
|
448
|
-
glDeleteBuffers(buffers)
|
449
|
-
end
|
450
|
-
|
451
|
-
def test_pixelpack_convolutionfilter
|
452
|
-
cf = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
453
|
-
|
454
|
-
buffers = glGenBuffers(1)
|
455
|
-
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffers[0])
|
456
|
-
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, 3*4*4, nil, GL_STREAM_READ)
|
457
|
-
|
458
|
-
glConvolutionFilter1D(GL_CONVOLUTION_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT, cf)
|
459
|
-
|
460
|
-
glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT, 0)
|
461
|
-
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
462
|
-
assert_equal(data, cf)
|
463
|
-
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
464
|
-
|
465
|
-
glDeleteBuffers(buffers)
|
466
|
-
end
|
467
|
-
|
468
|
-
def test_pixelpack_histogram
|
469
|
-
glEnable(GL_HISTOGRAM)
|
470
|
-
|
471
|
-
glHistogram(GL_HISTOGRAM, 1, GL_RGB8, GL_FALSE)
|
472
|
-
|
473
|
-
buffers = glGenBuffers(1)
|
474
|
-
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffers[0])
|
475
|
-
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, 3*4, nil, GL_STREAM_READ)
|
476
|
-
|
477
|
-
glDrawPixels(2, 1, GL_RGB, GL_FLOAT, [1, 1, 1, 1, 1, 1].pack("f*"))
|
478
|
-
glGetHistogram(GL_HISTOGRAM, GL_FALSE, GL_RGB, GL_FLOAT, 0)
|
479
|
-
|
480
|
-
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
481
|
-
assert_equal(data.unpack("f*"), [2, 2, 2])
|
482
|
-
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
483
|
-
|
484
|
-
glDeleteBuffers(buffers)
|
485
|
-
glDisable(GL_HISTOGRAM)
|
486
|
-
end
|
487
|
-
|
488
|
-
def test_pixelpack_minmax
|
489
|
-
glEnable(GL_MINMAX)
|
490
|
-
|
491
|
-
glMinmax(GL_MINMAX, GL_RGB8, GL_FALSE)
|
492
|
-
|
493
|
-
buffers = glGenBuffers(1)
|
494
|
-
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffers[0])
|
495
|
-
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, 6*4, nil, GL_STREAM_READ)
|
496
|
-
|
497
|
-
glDrawPixels(2, 1, GL_RGB, GL_FLOAT, [0, 0, 0, 1, 1, 1].pack("f*"))
|
498
|
-
glGetMinmax(GL_MINMAX, GL_FALSE, GL_RGB, GL_FLOAT, 0)
|
499
|
-
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
500
|
-
assert_equal(data.unpack("f*"), [0, 0, 0, 1, 1, 1])
|
501
|
-
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
502
|
-
|
503
|
-
glDeleteBuffers(buffers)
|
504
|
-
glDisable(GL_MINMAX)
|
505
|
-
end
|
506
|
-
|
507
392
|
def test_pixelpack_teximage
|
508
393
|
textures = glGenTextures(1)
|
509
394
|
glBindTexture(GL_TEXTURE_2D, textures[0])
|
@@ -518,7 +403,7 @@ void main() {
|
|
518
403
|
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT, 0)
|
519
404
|
|
520
405
|
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
521
|
-
assert_equal(
|
406
|
+
assert_equal(image, data)
|
522
407
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
523
408
|
|
524
409
|
glDeleteBuffers(buffers)
|
@@ -542,12 +427,10 @@ void main() {
|
|
542
427
|
glGetCompressedTexImage(GL_TEXTURE_2D, 0, 0)
|
543
428
|
|
544
429
|
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY)
|
545
|
-
assert_equal(
|
430
|
+
assert_equal(image, data)
|
546
431
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB)
|
547
432
|
|
548
433
|
glDeleteBuffers(buffers)
|
549
434
|
glDeleteTextures(textures)
|
550
435
|
end
|
551
|
-
|
552
436
|
end
|
553
|
-
|