ruby-opengl 0.40.1 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/doc/build_install.txt +48 -28
- data/doc/extensions.txt +361 -0
- data/doc/history.txt +8 -2
- data/doc/requirements_and_design.txt +0 -13
- data/doc/roadmap.txt +11 -13
- data/doc/supplies/page_template.html +11 -5
- data/doc/thanks.txt +2 -4
- data/doc/tutorial.txt +1 -4
- data/examples/{nehe_lesson02.rb → NeHe/nehe_lesson02.rb} +0 -0
- data/examples/{nehe_lesson03.rb → NeHe/nehe_lesson03.rb} +0 -0
- data/examples/{nehe_lesson04.rb → NeHe/nehe_lesson04.rb} +0 -0
- data/examples/{nehe_lesson05.rb → NeHe/nehe_lesson05.rb} +0 -0
- data/examples/NeHe/nehe_lesson36.rb +303 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +388 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +424 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +13 -83
- data/examples/RedBook/aaindex.rb +97 -0
- data/examples/RedBook/aapoly.rb +142 -0
- data/examples/RedBook/aargb.rb +119 -0
- data/examples/RedBook/accanti.rb +162 -0
- data/examples/RedBook/accpersp.rb +215 -0
- data/examples/RedBook/alpha.rb +123 -0
- data/examples/RedBook/alpha3D.rb +158 -0
- data/examples/RedBook/bezcurve.rb +105 -0
- data/examples/RedBook/bezmesh.rb +137 -0
- data/examples/RedBook/checker.rb +124 -0
- data/examples/RedBook/clip.rb +95 -0
- data/examples/RedBook/colormat.rb +135 -0
- data/examples/RedBook/cube.rb +69 -0
- data/examples/RedBook/depthcue.rb +99 -0
- data/examples/RedBook/dof.rb +205 -0
- data/examples/{legacy → RedBook}/double.rb +59 -58
- data/examples/{legacy → RedBook}/drawf.rb +47 -54
- data/examples/RedBook/feedback.rb +145 -0
- data/examples/RedBook/fog.rb +167 -0
- data/examples/RedBook/font.rb +151 -0
- data/examples/RedBook/hello.rb +79 -0
- data/examples/RedBook/image.rb +137 -0
- data/examples/{legacy → RedBook}/jitter.rb +60 -62
- data/examples/RedBook/lines.rb +128 -0
- data/examples/RedBook/list.rb +111 -0
- data/examples/RedBook/material.rb +275 -0
- data/examples/RedBook/mipmap.rb +156 -0
- data/examples/{legacy → RedBook}/model.rb +66 -72
- data/examples/{legacy → RedBook}/movelight.rb +67 -75
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/{legacy → RedBook}/planet.rb +62 -66
- data/examples/RedBook/quadric.rb +158 -0
- data/examples/RedBook/robot.rb +115 -0
- data/examples/RedBook/select.rb +196 -0
- data/examples/RedBook/smooth.rb +95 -0
- data/examples/RedBook/stencil.rb +163 -0
- data/examples/RedBook/stroke.rb +167 -0
- data/examples/RedBook/surface.rb +166 -0
- data/examples/RedBook/teaambient.rb +132 -0
- data/examples/RedBook/teapots.rb +182 -0
- data/examples/RedBook/tess.rb +183 -0
- data/examples/RedBook/texbind.rb +147 -0
- data/examples/RedBook/texgen.rb +169 -0
- data/examples/RedBook/texturesurf.rb +128 -0
- data/examples/RedBook/varray.rb +159 -0
- data/examples/RedBook/wrap.rb +148 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/{plane.rb → misc/plane.rb} +0 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/{smooth.rb → misc/smooth.rb} +0 -0
- data/examples/{test.rb → misc/test.rb} +0 -0
- data/ext/common/common.h +252 -70
- data/ext/common/gl-enums.h +6102 -7334
- data/ext/common/gl-types.h +47 -0
- data/ext/common/glu-enums.h +469 -0
- data/ext/gl/gl-1.0-1.1.c +842 -2464
- data/ext/gl/gl-1.2.c +217 -281
- data/ext/gl/gl-1.3.c +113 -133
- data/ext/gl/gl-1.4.c +98 -334
- data/ext/gl/gl-1.5.c +28 -34
- data/ext/gl/gl-2.0.c +26 -235
- data/ext/gl/gl-2.1.c +31 -124
- data/ext/gl/gl-enums.c +786 -631
- data/ext/gl/gl-ext-arb.c +66 -0
- data/ext/gl/gl-ext-ext.c +218 -0
- data/ext/gl/gl.c +138 -31
- data/ext/gl/mkrf_conf.rb +1 -0
- data/ext/glu/glu-enums.c +163 -0
- data/ext/glu/glu.c +1003 -1205
- data/ext/glu/mkrf_conf.rb +1 -0
- data/ext/glut/glut.c +1056 -1175
- data/lib/opengl.rb +90 -3
- data/test/tc_common.rb +26 -13
- data/test/tc_ext_arb.rb +73 -0
- data/test/tc_ext_ext.rb +74 -0
- data/test/tc_func_12.rb +8 -8
- data/test/tc_func_13.rb +17 -11
- data/test/tc_func_14.rb +8 -8
- data/test/tc_func_15.rb +190 -2
- data/test/tc_func_20.rb +36 -10
- data/test/tc_func_21.rb +445 -2
- data/test/tc_glu.rb +305 -0
- data/test/tc_misc.rb +1 -0
- metadata +84 -68
- data/doc/screenshots.txt +0 -23
- data/examples/legacy/COPYRIGHT +0 -8
- data/examples/legacy/aaindex.rb +0 -98
- data/examples/legacy/aapoly.rb +0 -153
- data/examples/legacy/aargb.rb +0 -139
- data/examples/legacy/accanti.rb +0 -159
- data/examples/legacy/accpersp.rb +0 -216
- data/examples/legacy/alpha.rb +0 -133
- data/examples/legacy/alpha3D.rb +0 -165
- data/examples/legacy/bezcurve.rb +0 -107
- data/examples/legacy/bezmesh.rb +0 -131
- data/examples/legacy/checker.rb +0 -121
- data/examples/legacy/clip.rb +0 -104
- data/examples/legacy/colormat.rb +0 -145
- data/examples/legacy/cube.rb +0 -73
- data/examples/legacy/depthcue.rb +0 -101
- data/examples/legacy/dof.rb +0 -212
- data/examples/legacy/feedback.rb +0 -152
- data/examples/legacy/fog.rb +0 -172
- data/examples/legacy/font-glut.rb +0 -41
- data/examples/legacy/font.rb +0 -158
- data/examples/legacy/hello.rb +0 -75
- data/examples/legacy/image.rb +0 -145
- data/examples/legacy/lines.rb +0 -135
- data/examples/legacy/list.rb +0 -120
- data/examples/legacy/material.rb +0 -290
- data/examples/legacy/mipmap.rb +0 -159
- data/examples/legacy/pickdepth.rb +0 -180
- data/examples/legacy/quadric.rb +0 -180
- data/examples/legacy/readpixel.rb +0 -59
- data/examples/legacy/robot.rb +0 -120
- data/examples/legacy/select.rb +0 -207
- data/examples/legacy/smooth.rb +0 -41
- data/examples/legacy/stencil.rb +0 -154
- data/examples/legacy/stroke.rb +0 -170
- data/examples/legacy/surface.rb +0 -170
- data/examples/legacy/teaambient.rb +0 -132
- data/examples/legacy/teapots.rb +0 -188
- data/examples/legacy/tess.rb +0 -222
- data/examples/legacy/texbind.rb +0 -157
- data/examples/legacy/texgen.rb +0 -171
- data/examples/legacy/texturesurf.rb +0 -128
- data/examples/legacy/varray.rb +0 -167
- data/examples/legacy/wrap.rb +0 -158
- data/lib/gl_prev.rb +0 -46
- data/lib/glu_prev.rb +0 -46
- data/lib/glut_prev.rb +0 -45
data/lib/opengl.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#
|
2
|
+
# Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
|
2
3
|
# Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
3
4
|
#
|
4
5
|
# This program is distributed under the terms of the MIT license.
|
@@ -13,9 +14,95 @@
|
|
13
14
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
15
|
#
|
15
16
|
|
17
|
+
# This module provides access to the GL,GLU and GLUT methods and constants
|
18
|
+
# in the way that they were available in previous versions of ruby-opengl.
|
19
|
+
#
|
20
|
+
# Thanks to Ilmari Heikkinen for a previous "reversed" version of this code,
|
21
|
+
# and to Bill Kelly for a version before that one.
|
22
|
+
|
16
23
|
require 'gl'
|
17
24
|
require 'glu'
|
18
25
|
require 'glut'
|
19
|
-
|
20
|
-
|
21
|
-
|
26
|
+
|
27
|
+
include Gl,Glu,Glut
|
28
|
+
|
29
|
+
# (Gl.)glVertex -> GL.Vertex
|
30
|
+
# (Gl::)GL_TRUE -> GL::TRUE
|
31
|
+
module GL
|
32
|
+
extend self
|
33
|
+
include Gl
|
34
|
+
|
35
|
+
Gl.constants.each do |cn|
|
36
|
+
n = cn.to_s.sub(/^GL_/,'')
|
37
|
+
# due to ruby naming scheme, we can't export constants with leading decimal,
|
38
|
+
# e.g. (Gl::)GL_2D would under old syntax become (GL::)2D which is illegal
|
39
|
+
next if n =~ /^[0-9]/
|
40
|
+
begin
|
41
|
+
const_set( n, Gl.const_get( cn ) )
|
42
|
+
rescue
|
43
|
+
puts "=== #{__FILE__} FAILED on Constant: #{cn} --> #{n}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Gl.methods( false ).each do |mn|
|
48
|
+
n = mn.to_s.sub(/^gl/,'')
|
49
|
+
begin
|
50
|
+
alias_method( n, mn )
|
51
|
+
public( n )
|
52
|
+
rescue
|
53
|
+
puts "=== #{__FILE__} FAILED on Method: #{mn} --> #{n}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# (Glu.)gluSphere -> GLU.Sphere
|
59
|
+
# (Glu::)GLU_INSIDE -> GLU::INSIDE
|
60
|
+
module GLU
|
61
|
+
extend self
|
62
|
+
include Glu
|
63
|
+
|
64
|
+
Glu.constants.each do |cn|
|
65
|
+
n = cn.to_s.sub(/^GLU_/,'')
|
66
|
+
begin
|
67
|
+
const_set( n, Glu.const_get( cn ) )
|
68
|
+
rescue
|
69
|
+
puts "=== #{__FILE__} FAILED on Constant: #{cn} --> #{n}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Glu.methods( false ).each do |mn|
|
74
|
+
n = mn.to_s.sub(/^glu/,'')
|
75
|
+
begin
|
76
|
+
alias_method( n, mn )
|
77
|
+
public( n )
|
78
|
+
rescue
|
79
|
+
puts "=== #{__FILE__} FAILED on Method: #{mn} --> #{n}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# (Glut.)glutInit -> GLUT.Init
|
85
|
+
# (Glut::)GLUT_RGBA -> GLUT::RGBA
|
86
|
+
module GLUT
|
87
|
+
extend self
|
88
|
+
include Glut
|
89
|
+
|
90
|
+
Glut.constants.each do |cn|
|
91
|
+
n = cn.to_s.sub(/^GLUT_/,'')
|
92
|
+
begin
|
93
|
+
const_set( n, Glut.const_get( cn ) )
|
94
|
+
rescue
|
95
|
+
puts "=== #{__FILE__} FAILED on Constant: #{cn} --> #{n}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
Glut.methods( false ).each do |mn|
|
100
|
+
n = mn.to_s.sub(/^glut/,'')
|
101
|
+
begin
|
102
|
+
alias_method( n, mn )
|
103
|
+
public( n )
|
104
|
+
rescue
|
105
|
+
puts "=== #{__FILE__} FAILED on Method: #{mn} --> #{n}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/test/tc_common.rb
CHANGED
@@ -14,9 +14,9 @@
|
|
14
14
|
#
|
15
15
|
|
16
16
|
if __FILE__ == $0
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# If we are being called from the command line, e.g., ruby foo.rb, then
|
18
|
+
# fixup the load path so we can find the OpenGL extension libs
|
19
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
20
20
|
end
|
21
21
|
|
22
22
|
require 'test/unit'
|
@@ -28,11 +28,22 @@ include Glut
|
|
28
28
|
$window_size = 512
|
29
29
|
|
30
30
|
def glut_init()
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
display_func = lambda do
|
32
|
+
raise
|
33
|
+
end
|
34
|
+
|
35
|
+
glutInit
|
36
|
+
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_STENCIL | GLUT_ACCUM | GLUT_ALPHA)
|
37
|
+
glutInitWindowPosition(1, 1)
|
38
|
+
glutInitWindowSize($window_size, $window_size)
|
39
|
+
glutCreateWindow("test")
|
40
|
+
glutDisplayFunc(display_func)
|
41
|
+
# hack the need to call glutMainLoop on some implementations
|
42
|
+
begin
|
43
|
+
glutMainLoop()
|
44
|
+
rescue
|
45
|
+
# continue
|
46
|
+
end
|
36
47
|
end
|
37
48
|
|
38
49
|
def approx_equal(a,b,epsilon=0.01)
|
@@ -64,15 +75,17 @@ end
|
|
64
75
|
def common_teardown
|
65
76
|
glPopAttrib()
|
66
77
|
glPopClientAttrib()
|
67
|
-
|
78
|
+
error = glGetError()
|
79
|
+
p gluErrorString(error) if (error!=0)
|
80
|
+
assert_equal(error,0) # all expected GL errors must be handled by the method itself
|
68
81
|
end
|
69
82
|
|
70
83
|
def supported?(funcs)
|
71
|
-
funcs.each do |name|
|
84
|
+
Array(funcs).each do |name| # convert to array if it isn't already
|
72
85
|
if !Gl.is_available?(name)
|
73
|
-
|
74
|
-
|
75
|
-
|
86
|
+
puts ""
|
87
|
+
puts "#{name} not supported, test skipped"
|
88
|
+
return false
|
76
89
|
end
|
77
90
|
end
|
78
91
|
return true
|
data/test/tc_ext_arb.rb
ADDED
@@ -0,0 +1,73 @@
|
|
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_EXT_ARB < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_gl_arb_transpose_matrix
|
28
|
+
return if not supported?("GL_ARB_transpose_matrix")
|
29
|
+
m_a = [[1.0,2.0,3.0,4.0],
|
30
|
+
[0.0,2.0,0.0,0.0],
|
31
|
+
[0.0,0.0,2.0,0.0],
|
32
|
+
[0.0,0.0,0.0,2.0]]
|
33
|
+
|
34
|
+
m_b = [[1.0,2.0,3.0,4.0],
|
35
|
+
[0.0,3.0,0.0,0.0],
|
36
|
+
[0.0,0.0,3.0,0.0],
|
37
|
+
[0.0,0.0,0.0,3.0]]
|
38
|
+
|
39
|
+
glMatrixMode(GL_MODELVIEW)
|
40
|
+
glLoadTransposeMatrixfARB(m_a)
|
41
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB), m_a)
|
42
|
+
|
43
|
+
glLoadTransposeMatrixdARB(m_b)
|
44
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB), m_b)
|
45
|
+
|
46
|
+
glLoadIdentity()
|
47
|
+
glMultTransposeMatrixfARB(m_a)
|
48
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB), m_a)
|
49
|
+
|
50
|
+
glLoadIdentity()
|
51
|
+
glMultTransposeMatrixdARB(m_b)
|
52
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB), m_b)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_gl_arb_multisample
|
56
|
+
return if not supported?("GL_ARB_multisample")
|
57
|
+
glSampleCoverageARB(0.5,GL_FALSE)
|
58
|
+
assert_equal(glGetFloatv(GL_SAMPLE_COVERAGE_VALUE_ARB),0.5)
|
59
|
+
assert_equal(glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT_ARB),GL_FALSE)
|
60
|
+
glSampleCoverageARB(1.0,GL_TRUE)
|
61
|
+
assert_equal(glGetFloatv(GL_SAMPLE_COVERAGE_VALUE_ARB),1.0)
|
62
|
+
assert_equal(glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT_ARB),GL_TRUE)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_gl_arb_color_buffer_float
|
66
|
+
return if not supported?("GL_ARB_color_buffer_float")
|
67
|
+
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB,GL_FIXED_ONLY_ARB)
|
68
|
+
assert_equal(glGetIntegerv(GL_CLAMP_VERTEX_COLOR_ARB),GL_FIXED_ONLY_ARB)
|
69
|
+
|
70
|
+
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB,GL_TRUE)
|
71
|
+
assert_equal(glGetIntegerv(GL_CLAMP_VERTEX_COLOR_ARB),GL_TRUE)
|
72
|
+
end
|
73
|
+
end
|
data/test/tc_ext_ext.rb
ADDED
@@ -0,0 +1,74 @@
|
|
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_EXT_EXT < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_gl_ext_framebuffer_object
|
28
|
+
return if not supported?("GL_EXT_framebuffer_object")
|
29
|
+
t = glGenTextures(3)
|
30
|
+
glBindTexture(GL_TEXTURE_2D, t[0])
|
31
|
+
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,$window_size,$window_size,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
|
32
|
+
|
33
|
+
glBindTexture(GL_TEXTURE_1D, t[1])
|
34
|
+
glTexImage1D(GL_TEXTURE_1D,0,GL_RGBA8,$window_size,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
|
35
|
+
|
36
|
+
glBindTexture(GL_TEXTURE_3D, t[2])
|
37
|
+
glTexImage3D(GL_TEXTURE_3D,0,GL_RGBA8,$window_size,$window_size,1,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
|
38
|
+
|
39
|
+
fb = glGenFramebuffersEXT(1)
|
40
|
+
assert(fb.size==1)
|
41
|
+
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fb[0])
|
42
|
+
assert_equal(glIsFramebufferEXT(fb[0]),GL_TRUE)
|
43
|
+
|
44
|
+
rb = glGenRenderbuffersEXT(1)
|
45
|
+
assert(rb.size==1)
|
46
|
+
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,rb[0])
|
47
|
+
assert_equal(glIsRenderbufferEXT(rb[0]),GL_TRUE)
|
48
|
+
|
49
|
+
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, $window_size, $window_size)
|
50
|
+
|
51
|
+
assert_equal(glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_WIDTH_EXT),$window_size)
|
52
|
+
assert_equal(glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_HEIGHT_EXT),$window_size)
|
53
|
+
assert_equal(glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_INTERNAL_FORMAT_EXT),GL_DEPTH_COMPONENT)
|
54
|
+
|
55
|
+
|
56
|
+
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb[0]);
|
57
|
+
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, t[0], 0)
|
58
|
+
|
59
|
+
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
|
60
|
+
assert(status == GL_FRAMEBUFFER_COMPLETE_EXT || status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
|
61
|
+
|
62
|
+
assert_equal(glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT),GL_TEXTURE)
|
63
|
+
|
64
|
+
glGenerateMipmapEXT(GL_TEXTURE_2D)
|
65
|
+
|
66
|
+
glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_1D, t[1], 0)
|
67
|
+
glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_3D, t[2], 0, 0)
|
68
|
+
|
69
|
+
glDeleteRenderbuffersEXT(rb)
|
70
|
+
glDeleteFramebuffersEXT(fb)
|
71
|
+
glDeleteTextures(t)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
data/test/tc_func_12.rb
CHANGED
@@ -25,7 +25,7 @@ class Test_12 < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_glblend
|
28
|
-
return if not supported?(
|
28
|
+
return if not supported?(1.2)
|
29
29
|
glBlendColor(0.0,1.0,0.0,1.0)
|
30
30
|
assert_equal(glGetDoublev(GL_BLEND_COLOR),[0,1,0,1])
|
31
31
|
|
@@ -36,7 +36,7 @@ class Test_12 < Test::Unit::TestCase
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_gldrawrangeelements
|
39
|
-
return if not supported?(
|
39
|
+
return if not supported?(1.2)
|
40
40
|
va = [0,0, 0,1, 1,1].pack("f*")
|
41
41
|
glVertexPointer(2,GL_FLOAT,0,va)
|
42
42
|
|
@@ -53,7 +53,7 @@ class Test_12 < Test::Unit::TestCase
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_colortable
|
56
|
-
return if not supported?(
|
56
|
+
return if not supported?(1.2)
|
57
57
|
|
58
58
|
ct = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
59
59
|
ct2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
@@ -79,7 +79,7 @@ class Test_12 < Test::Unit::TestCase
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_convolutionfilter
|
82
|
-
return if not supported?(
|
82
|
+
return if not supported?(1.2)
|
83
83
|
|
84
84
|
cf = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
|
85
85
|
cf2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
|
@@ -114,7 +114,7 @@ class Test_12 < Test::Unit::TestCase
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def test_separablefilter
|
117
|
-
return if not supported?(
|
117
|
+
return if not supported?(1.2)
|
118
118
|
sf_a = ([0]*3+[1]*3).pack("f*")
|
119
119
|
sf_b = ([1]*3+[0]*3).pack("f*")
|
120
120
|
|
@@ -123,7 +123,7 @@ class Test_12 < Test::Unit::TestCase
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def test_histogram
|
126
|
-
return if not supported?(
|
126
|
+
return if not supported?(1.2)
|
127
127
|
|
128
128
|
glEnable(GL_HISTOGRAM)
|
129
129
|
|
@@ -143,7 +143,7 @@ class Test_12 < Test::Unit::TestCase
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def test_minmax
|
146
|
-
return if not supported?(
|
146
|
+
return if not supported?(1.2)
|
147
147
|
|
148
148
|
glEnable(GL_MINMAX)
|
149
149
|
|
@@ -163,7 +163,7 @@ class Test_12 < Test::Unit::TestCase
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def test_texture_3D
|
166
|
-
return if not supported?(
|
166
|
+
return if not supported?(1.2)
|
167
167
|
image = ([0,0,0,1,1,1] * 2 * 2).pack("f*")
|
168
168
|
image2 = ([1,1,1,0,0,0] * 2 * 2).pack("f*")
|
169
169
|
|
data/test/tc_func_13.rb
CHANGED
@@ -25,7 +25,7 @@ class Test_13 < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_glsamplecoverage
|
28
|
-
return if not supported?(
|
28
|
+
return if not supported?(1.3)
|
29
29
|
glSampleCoverage(0.0,GL_TRUE)
|
30
30
|
assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_VALUE),0.0)
|
31
31
|
assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_INVERT),GL_TRUE)
|
@@ -35,7 +35,7 @@ class Test_13 < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_multitexture
|
38
|
-
return if not supported?(
|
38
|
+
return if not supported?(1.3)
|
39
39
|
glActiveTexture(GL_TEXTURE1)
|
40
40
|
glClientActiveTexture(GL_TEXTURE2)
|
41
41
|
assert_equal(glGetIntegerv(GL_ACTIVE_TEXTURE),GL_TEXTURE1)
|
@@ -43,35 +43,36 @@ class Test_13 < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_transposematrix
|
46
|
-
return if not supported?(
|
47
|
-
m_a = [[
|
46
|
+
return if not supported?(1.3)
|
47
|
+
m_a = [[1.0,2.0,3.0,4.0],
|
48
48
|
[0.0,2.0,0.0,0.0],
|
49
49
|
[0.0,0.0,2.0,0.0],
|
50
50
|
[0.0,0.0,0.0,2.0]]
|
51
51
|
|
52
|
-
m_b = [[
|
52
|
+
m_b = [[1.0,2.0,3.0,4.0],
|
53
53
|
[0.0,3.0,0.0,0.0],
|
54
54
|
[0.0,0.0,3.0,0.0],
|
55
55
|
[0.0,0.0,0.0,3.0]]
|
56
56
|
|
57
57
|
glMatrixMode(GL_MODELVIEW)
|
58
58
|
glLoadTransposeMatrixf(m_a)
|
59
|
-
assert_equal(glGetDoublev(
|
59
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX), m_a)
|
60
60
|
|
61
61
|
glLoadTransposeMatrixd(m_b)
|
62
|
-
assert_equal(glGetDoublev(
|
62
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX), m_b)
|
63
63
|
|
64
64
|
glLoadIdentity()
|
65
65
|
glMultTransposeMatrixf(m_a)
|
66
|
-
assert_equal(glGetDoublev(
|
66
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX), m_a)
|
67
67
|
|
68
68
|
glLoadIdentity()
|
69
69
|
glMultTransposeMatrixd(m_b)
|
70
|
-
assert_equal(glGetDoublev(
|
70
|
+
assert_equal(glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX), m_b)
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_texturecompression
|
74
|
-
return if not supported?(
|
74
|
+
return if not supported?(1.3)
|
75
|
+
return if not supported?("GL_EXT_texture_compression_s3tc")
|
75
76
|
|
76
77
|
# S3TC/DXT5 compressed 2x2 pixels stipple patterns [w,b,b,w] and [b,w,w,b]
|
77
78
|
image_1 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x54,0x5C,0x5C].pack("C*")
|
@@ -122,10 +123,15 @@ class Test_13 < Test::Unit::TestCase
|
|
122
123
|
end
|
123
124
|
|
124
125
|
glDeleteTextures(textures)
|
126
|
+
|
127
|
+
n = glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
|
128
|
+
if (n>0)
|
129
|
+
assert_equal(glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS).size,n)
|
130
|
+
end
|
125
131
|
end
|
126
132
|
|
127
133
|
def test_glmultitexcoord
|
128
|
-
return if not supported?(
|
134
|
+
return if not supported?(1.3)
|
129
135
|
|
130
136
|
glActiveTexture(GL_TEXTURE1)
|
131
137
|
|