ruby-opengl 0.60.1 → 0.61.0
Sign up to get free protection for your applications and to get access to all the features.
- metadata +36 -186
- data/Rakefile +0 -168
- data/doc/build_install.txt +0 -122
- data/doc/extensions.txt +0 -556
- data/doc/extensions.txt.in +0 -348
- data/doc/history.txt +0 -66
- data/doc/requirements_and_design.txt +0 -117
- data/doc/roadmap.txt +0 -28
- data/doc/scientific_use.txt +0 -35
- data/doc/supplies/page_template.html +0 -71
- data/doc/thanks.txt +0 -29
- data/doc/tutorial.txt +0 -469
- data/examples/NeHe/nehe_lesson02.rb +0 -117
- data/examples/NeHe/nehe_lesson03.rb +0 -122
- data/examples/NeHe/nehe_lesson04.rb +0 -133
- data/examples/NeHe/nehe_lesson05.rb +0 -186
- data/examples/NeHe/nehe_lesson36.rb +0 -303
- data/examples/OrangeBook/3Dlabs-License.txt +0 -33
- data/examples/OrangeBook/brick.frag +0 -36
- data/examples/OrangeBook/brick.rb +0 -376
- data/examples/OrangeBook/brick.vert +0 -41
- data/examples/OrangeBook/particle.frag +0 -17
- data/examples/OrangeBook/particle.rb +0 -406
- data/examples/OrangeBook/particle.vert +0 -38
- data/examples/README +0 -16
- data/examples/RedBook/aapoly.rb +0 -142
- data/examples/RedBook/aargb.rb +0 -119
- data/examples/RedBook/accanti.rb +0 -162
- data/examples/RedBook/accpersp.rb +0 -215
- data/examples/RedBook/alpha.rb +0 -123
- data/examples/RedBook/alpha3D.rb +0 -158
- data/examples/RedBook/bezcurve.rb +0 -105
- data/examples/RedBook/bezmesh.rb +0 -137
- data/examples/RedBook/checker.rb +0 -124
- data/examples/RedBook/clip.rb +0 -95
- data/examples/RedBook/colormat.rb +0 -135
- data/examples/RedBook/cube.rb +0 -69
- data/examples/RedBook/depthcue.rb +0 -99
- data/examples/RedBook/dof.rb +0 -205
- data/examples/RedBook/double.rb +0 -105
- data/examples/RedBook/drawf.rb +0 -91
- data/examples/RedBook/feedback.rb +0 -145
- data/examples/RedBook/fog.rb +0 -167
- data/examples/RedBook/font.rb +0 -151
- data/examples/RedBook/hello.rb +0 -79
- data/examples/RedBook/image.rb +0 -137
- data/examples/RedBook/jitter.rb +0 -207
- data/examples/RedBook/lines.rb +0 -128
- data/examples/RedBook/list.rb +0 -111
- data/examples/RedBook/material.rb +0 -275
- data/examples/RedBook/mipmap.rb +0 -156
- data/examples/RedBook/model.rb +0 -113
- data/examples/RedBook/movelight.rb +0 -132
- data/examples/RedBook/pickdepth.rb +0 -179
- data/examples/RedBook/planet.rb +0 -108
- data/examples/RedBook/quadric.rb +0 -158
- data/examples/RedBook/robot.rb +0 -115
- data/examples/RedBook/select.rb +0 -196
- data/examples/RedBook/smooth.rb +0 -95
- data/examples/RedBook/stencil.rb +0 -163
- data/examples/RedBook/stroke.rb +0 -167
- data/examples/RedBook/surface.rb +0 -166
- data/examples/RedBook/teaambient.rb +0 -132
- data/examples/RedBook/teapots.rb +0 -182
- data/examples/RedBook/tess.rb +0 -183
- data/examples/RedBook/texbind.rb +0 -147
- data/examples/RedBook/texgen.rb +0 -169
- data/examples/RedBook/texturesurf.rb +0 -128
- data/examples/RedBook/varray.rb +0 -159
- data/examples/RedBook/wrap.rb +0 -148
- data/examples/misc/OGLBench.rb +0 -337
- data/examples/misc/anisotropic.rb +0 -194
- data/examples/misc/fbo_test.rb +0 -356
- data/examples/misc/font-glut.rb +0 -46
- data/examples/misc/glfwtest.rb +0 -30
- data/examples/misc/plane.rb +0 -161
- data/examples/misc/readpixel.rb +0 -65
- data/examples/misc/sdltest.rb +0 -34
- data/examples/misc/trislam.rb +0 -828
- data/ext/common/common.h +0 -423
- data/ext/common/conv.h +0 -244
- data/ext/common/funcdef.h +0 -280
- data/ext/common/gl-enums.h +0 -10031
- data/ext/common/gl-error.h +0 -23
- data/ext/common/gl-types.h +0 -61
- data/ext/common/glu-enums.h +0 -463
- data/ext/gl/gl-1.0-1.1.c +0 -2817
- data/ext/gl/gl-1.2.c +0 -814
- data/ext/gl/gl-1.3.c +0 -444
- data/ext/gl/gl-1.4.c +0 -349
- data/ext/gl/gl-1.5.c +0 -225
- data/ext/gl/gl-2.0.c +0 -657
- data/ext/gl/gl-2.1.c +0 -57
- data/ext/gl/gl-enums.c +0 -3354
- data/ext/gl/gl-error.c +0 -104
- data/ext/gl/gl-ext-3dfx.c +0 -27
- data/ext/gl/gl-ext-arb.c +0 -866
- data/ext/gl/gl-ext-ati.c +0 -41
- data/ext/gl/gl-ext-ext.c +0 -890
- data/ext/gl/gl-ext-gremedy.c +0 -41
- data/ext/gl/gl-ext-nv.c +0 -679
- data/ext/gl/gl.c +0 -214
- data/ext/gl/mkrf_conf.rb +0 -34
- data/ext/glu/glu-enums.c +0 -164
- data/ext/glu/glu.c +0 -1530
- data/ext/glu/mkrf_conf.rb +0 -35
- data/ext/glut/glut.c +0 -1623
- data/ext/glut/mkrf_conf.rb +0 -37
- data/lib/opengl.rb +0 -84
- data/test/README +0 -10
- data/test/tc_common.rb +0 -98
- data/test/tc_ext_arb.rb +0 -467
- data/test/tc_ext_ati.rb +0 -33
- data/test/tc_ext_ext.rb +0 -551
- data/test/tc_ext_gremedy.rb +0 -36
- data/test/tc_ext_nv.rb +0 -357
- data/test/tc_func_10_11.rb +0 -1281
- data/test/tc_func_12.rb +0 -186
- data/test/tc_func_13.rb +0 -229
- data/test/tc_func_14.rb +0 -197
- data/test/tc_func_15.rb +0 -270
- data/test/tc_func_20.rb +0 -346
- data/test/tc_func_21.rb +0 -541
- data/test/tc_glu.rb +0 -310
- data/test/tc_include_gl.rb +0 -35
- data/test/tc_misc.rb +0 -54
- data/test/tc_require_gl.rb +0 -34
data/ext/glut/mkrf_conf.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# extconf.rb for ruby-opengl's glut extension module.
|
2
|
-
#
|
3
|
-
# Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
|
4
|
-
#
|
5
|
-
# This program is distributed under the terms of the MIT license.
|
6
|
-
# See the included COPYRIGHT file for the terms of this license.
|
7
|
-
#
|
8
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
9
|
-
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
10
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
11
|
-
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
12
|
-
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
13
|
-
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
14
|
-
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
-
|
16
|
-
require 'rubygems'
|
17
|
-
require 'mkrf'
|
18
|
-
|
19
|
-
RUBYVER = " -DRUBY_VERSION=" + RUBY_VERSION.split(".").join
|
20
|
-
|
21
|
-
Mkrf::Generator.new( 'glut' ) do |g|
|
22
|
-
case RUBY_PLATFORM
|
23
|
-
when /darwin/
|
24
|
-
g.cflags << RUBYVER
|
25
|
-
g.ldshared << ' -framework GLUT -framework OpenGL -framework Cocoa'
|
26
|
-
when /mswin32/
|
27
|
-
g.cflags << ' -DWIN32' + RUBYVER
|
28
|
-
g.include_library( 'glut32.lib', 'glutSolidTeapot' )
|
29
|
-
g.include_library( 'glu32.lib', 'gluLookAt' )
|
30
|
-
g.include_library( 'opengl32.lib', 'glVertex3d' )
|
31
|
-
else
|
32
|
-
g.cflags << RUBYVER
|
33
|
-
g.include_library( 'glut', 'glutSolidTeapot' )
|
34
|
-
g.include_library( 'GLU', 'gluLookAt' )
|
35
|
-
g.include_library( 'GL', 'glVertex3d')
|
36
|
-
end
|
37
|
-
end
|
data/lib/opengl.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
|
3
|
-
# Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
4
|
-
#
|
5
|
-
# This program is distributed under the terms of the MIT license.
|
6
|
-
# See the included MIT-LICENSE file for the terms of this license.
|
7
|
-
#
|
8
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
9
|
-
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
10
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
11
|
-
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
12
|
-
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
13
|
-
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
14
|
-
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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
|
-
|
23
|
-
require 'gl'
|
24
|
-
require 'glu'
|
25
|
-
require 'glut'
|
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
|
-
const_set( n, Gl.const_get( cn ) )
|
41
|
-
end
|
42
|
-
|
43
|
-
Gl.methods( false ).each do |mn|
|
44
|
-
n = mn.to_s.sub(/^gl/,'')
|
45
|
-
alias_method( n, mn )
|
46
|
-
public( n )
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# (Glu.)gluSphere -> GLU.Sphere
|
51
|
-
# (Glu::)GLU_INSIDE -> GLU::INSIDE
|
52
|
-
module GLU
|
53
|
-
extend self
|
54
|
-
include Glu
|
55
|
-
|
56
|
-
Glu.constants.each do |cn|
|
57
|
-
n = cn.to_s.sub(/^GLU_/,'')
|
58
|
-
const_set( n, Glu.const_get( cn ) )
|
59
|
-
end
|
60
|
-
|
61
|
-
Glu.methods( false ).each do |mn|
|
62
|
-
n = mn.to_s.sub(/^glu/,'')
|
63
|
-
alias_method( n, mn )
|
64
|
-
public( n )
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# (Glut.)glutInit -> GLUT.Init
|
69
|
-
# (Glut::)GLUT_RGBA -> GLUT::RGBA
|
70
|
-
module GLUT
|
71
|
-
extend self
|
72
|
-
include Glut
|
73
|
-
|
74
|
-
Glut.constants.each do |cn|
|
75
|
-
n = cn.to_s.sub(/^GLUT_/,'')
|
76
|
-
const_set( n, Glut.const_get( cn ) )
|
77
|
-
end
|
78
|
-
|
79
|
-
Glut.methods( false ).each do |mn|
|
80
|
-
n = mn.to_s.sub(/^glut/,'')
|
81
|
-
alias_method( n, mn )
|
82
|
-
public( n )
|
83
|
-
end
|
84
|
-
end
|
data/test/README
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
ruby-opengl tests
|
2
|
-
=================
|
3
|
-
|
4
|
-
This directory contains the unit tests for ruby-opengl. You should be able
|
5
|
-
to run the test by calling 'rake test' from installation root directory.
|
6
|
-
|
7
|
-
Note that the tests are meant for purposes of internal development, and depending on
|
8
|
-
your system configuration may not run at all - the purpose is to test the
|
9
|
-
bindings, not the underlying OpenGL implementation.
|
10
|
-
|
data/test/tc_common.rb
DELETED
@@ -1,98 +0,0 @@
|
|
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
|
-
if __FILE__ == $0
|
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
|
-
end
|
21
|
-
|
22
|
-
require 'test/unit'
|
23
|
-
require 'gl'
|
24
|
-
require 'glut'
|
25
|
-
require 'matrix'
|
26
|
-
include Gl
|
27
|
-
include Glut
|
28
|
-
|
29
|
-
Gl.enable_error_checking
|
30
|
-
|
31
|
-
$window_size = 512
|
32
|
-
|
33
|
-
def glut_init()
|
34
|
-
display_func = lambda do
|
35
|
-
raise
|
36
|
-
end
|
37
|
-
|
38
|
-
glutInit
|
39
|
-
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_STENCIL | GLUT_ACCUM | GLUT_ALPHA)
|
40
|
-
glutInitWindowPosition(1, 1)
|
41
|
-
glutInitWindowSize($window_size, $window_size)
|
42
|
-
glutCreateWindow("test")
|
43
|
-
|
44
|
-
# hack the need to call glutMainLoop on some implementations
|
45
|
-
glutDisplayFunc(display_func)
|
46
|
-
begin
|
47
|
-
glutMainLoop()
|
48
|
-
rescue
|
49
|
-
# continue
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def approx_equal(a,b,epsilon=0.01)
|
54
|
-
(0...a.size).each do |i|
|
55
|
-
if ((a[i] - b[i]).abs > epsilon)
|
56
|
-
return false
|
57
|
-
end
|
58
|
-
end
|
59
|
-
true
|
60
|
-
end
|
61
|
-
|
62
|
-
def common_setup
|
63
|
-
if $glut_initialized == nil
|
64
|
-
glut_init()
|
65
|
-
$glut_initialized = true
|
66
|
-
end
|
67
|
-
|
68
|
-
glPushAttrib(GL_ALL_ATTRIB_BITS)
|
69
|
-
glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS)
|
70
|
-
glMatrixMode(GL_MODELVIEW)
|
71
|
-
glLoadIdentity()
|
72
|
-
glMatrixMode(GL_PROJECTION)
|
73
|
-
glLoadIdentity()
|
74
|
-
|
75
|
-
glClearColor(0,0,0,0)
|
76
|
-
glClear(GL_COLOR_BUFFER_BIT)
|
77
|
-
end
|
78
|
-
|
79
|
-
def common_teardown
|
80
|
-
glPopAttrib()
|
81
|
-
glPopClientAttrib()
|
82
|
-
glRenderMode(GL_RENDER)
|
83
|
-
# in case there is an GL error that escaped error checking routines ...
|
84
|
-
error = glGetError()
|
85
|
-
p gluErrorString(error) if (error!=0)
|
86
|
-
assert_equal(error,0)
|
87
|
-
end
|
88
|
-
|
89
|
-
def supported?(funcs)
|
90
|
-
Array(funcs).each do |name| # convert to array if it isn't already
|
91
|
-
if !Gl.is_available?(name)
|
92
|
-
puts ""
|
93
|
-
print "#{name} not supported, test skipped"
|
94
|
-
return false
|
95
|
-
end
|
96
|
-
end
|
97
|
-
return true
|
98
|
-
end
|
data/test/tc_ext_arb.rb
DELETED
@@ -1,467 +0,0 @@
|
|
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
|
-
|
54
|
-
# 2
|
55
|
-
m = Matrix.rows([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]])
|
56
|
-
glMatrixMode(GL_MODELVIEW)
|
57
|
-
glLoadTransposeMatrixfARB(m)
|
58
|
-
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m.to_a.transpose)
|
59
|
-
glLoadIdentity()
|
60
|
-
glLoadTransposeMatrixdARB(m)
|
61
|
-
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m.to_a.transpose)
|
62
|
-
glLoadIdentity()
|
63
|
-
glMultTransposeMatrixfARB(m)
|
64
|
-
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m.to_a.transpose)
|
65
|
-
glLoadIdentity()
|
66
|
-
glMultTransposeMatrixdARB(m)
|
67
|
-
assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m.to_a.transpose)
|
68
|
-
|
69
|
-
assert_raise ArgumentError do glLoadTransposeMatrixfARB([1,2,3,4]) end
|
70
|
-
assert_raise ArgumentError do glLoadTransposeMatrixdARB([1,2,3,4]) end
|
71
|
-
assert_raise ArgumentError do glMultTransposeMatrixfARB([1,2,3,4]) end
|
72
|
-
assert_raise ArgumentError do glMultTransposeMatrixdARB([1,2,3,4]) end
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_gl_arb_multisample
|
76
|
-
return if not supported?("GL_ARB_multisample")
|
77
|
-
glSampleCoverageARB(0.5,GL_FALSE)
|
78
|
-
assert_equal(glGetFloatv(GL_SAMPLE_COVERAGE_VALUE_ARB),0.5)
|
79
|
-
assert_equal(glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT_ARB),false)
|
80
|
-
glSampleCoverageARB(1.0,GL_TRUE)
|
81
|
-
assert_equal(glGetFloatv(GL_SAMPLE_COVERAGE_VALUE_ARB),1.0)
|
82
|
-
assert_equal(glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT_ARB),true)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_gl_arb_color_buffer_float
|
86
|
-
return if not supported?("GL_ARB_color_buffer_float")
|
87
|
-
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB,GL_FIXED_ONLY_ARB)
|
88
|
-
assert_equal(glGetIntegerv(GL_CLAMP_VERTEX_COLOR_ARB),GL_FIXED_ONLY_ARB)
|
89
|
-
|
90
|
-
glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB,GL_TRUE)
|
91
|
-
assert_equal(glGetBooleanv(GL_CLAMP_VERTEX_COLOR_ARB),GL_TRUE)
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_gl_arb_vertex_program
|
95
|
-
return if not supported?("GL_ARB_vertex_program")
|
96
|
-
|
97
|
-
assert_equal(glIsProgramARB(0),false)
|
98
|
-
programs = glGenProgramsARB(1)
|
99
|
-
assert_equal(programs.size,1)
|
100
|
-
|
101
|
-
program = "!!ARBvp1.0\nTEMP vv;\nEND"
|
102
|
-
|
103
|
-
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, programs[0])
|
104
|
-
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, program)
|
105
|
-
assert_equal(glGetProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_STRING_ARB), program)
|
106
|
-
assert_equal(glIsProgramARB(programs[0]),true)
|
107
|
-
|
108
|
-
assert_equal(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,GL_PROGRAM_LENGTH_ARB),program.size)
|
109
|
-
assert_equal(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,GL_PROGRAM_BINDING_ARB),programs[0])
|
110
|
-
|
111
|
-
glEnableVertexAttribArrayARB(1)
|
112
|
-
assert_equal(glGetVertexAttribivARB(1,GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB),GL_TRUE)
|
113
|
-
glDisableVertexAttribArrayARB(1)
|
114
|
-
assert_equal(glGetVertexAttribivARB(1,GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB),GL_FALSE)
|
115
|
-
|
116
|
-
glVertexAttribPointerARB(1,2,GL_FLOAT,GL_FALSE,0,[1,1].pack("f*"))
|
117
|
-
assert_equal(glGetVertexAttribPointervARB(1),[1,1].pack("f*"))
|
118
|
-
|
119
|
-
|
120
|
-
glProgramEnvParameter4dARB(GL_VERTEX_PROGRAM_ARB,1, 1,2,3,4)
|
121
|
-
assert_equal(glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB,1),[1,2,3,4])
|
122
|
-
glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB,1, 5,6,7,8)
|
123
|
-
assert_equal(glGetProgramEnvParameterfvARB(GL_VERTEX_PROGRAM_ARB,1),[5,6,7,8])
|
124
|
-
glProgramEnvParameter4dvARB(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4])
|
125
|
-
assert_equal(glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB,1),[1,2,3,4])
|
126
|
-
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB,1, [5,6,7,8])
|
127
|
-
assert_equal(glGetProgramEnvParameterfvARB(GL_VERTEX_PROGRAM_ARB,1),[5,6,7,8])
|
128
|
-
|
129
|
-
glProgramLocalParameter4dARB(GL_VERTEX_PROGRAM_ARB,1, 1,2,3,4)
|
130
|
-
assert_equal(glGetProgramLocalParameterdvARB(GL_VERTEX_PROGRAM_ARB,1),[1,2,3,4])
|
131
|
-
glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB,1, 5,6,7,8)
|
132
|
-
assert_equal(glGetProgramLocalParameterfvARB(GL_VERTEX_PROGRAM_ARB,1),[5,6,7,8])
|
133
|
-
glProgramLocalParameter4dvARB(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4])
|
134
|
-
assert_equal(glGetProgramLocalParameterdvARB(GL_VERTEX_PROGRAM_ARB,1),[1,2,3,4])
|
135
|
-
glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB,1, [5,6,7,8])
|
136
|
-
assert_equal(glGetProgramLocalParameterfvARB(GL_VERTEX_PROGRAM_ARB,1),[5,6,7,8])
|
137
|
-
|
138
|
-
glVertexAttrib1dARB(1,1)
|
139
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],1)
|
140
|
-
glVertexAttrib1fARB(1,2)
|
141
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],2)
|
142
|
-
glVertexAttrib1sARB(1,3)
|
143
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],3)
|
144
|
-
glVertexAttrib1dvARB(1,[1])
|
145
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],1)
|
146
|
-
glVertexAttrib1fvARB(1,[2])
|
147
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],2)
|
148
|
-
glVertexAttrib1svARB(1,[3])
|
149
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],3)
|
150
|
-
|
151
|
-
glVertexAttrib2dARB(1,1,2)
|
152
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[1,2])
|
153
|
-
glVertexAttrib2fARB(1,2,3)
|
154
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[2,3])
|
155
|
-
glVertexAttrib2sARB(1,3,4)
|
156
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[3,4])
|
157
|
-
glVertexAttrib2dvARB(1,[1,2])
|
158
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[1,2])
|
159
|
-
glVertexAttrib2fvARB(1,[2,3])
|
160
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[2,3])
|
161
|
-
glVertexAttrib2svARB(1,[3,4])
|
162
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[3,4])
|
163
|
-
|
164
|
-
glVertexAttrib3dARB(1,1,2,3)
|
165
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[1,2,3])
|
166
|
-
glVertexAttrib3fARB(1,2,3,4)
|
167
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[2,3,4])
|
168
|
-
glVertexAttrib3sARB(1,3,4,5)
|
169
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[3,4,5])
|
170
|
-
glVertexAttrib3dvARB(1,[1,2,3])
|
171
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[1,2,3])
|
172
|
-
glVertexAttrib3fvARB(1,[2,3,4])
|
173
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[2,3,4])
|
174
|
-
glVertexAttrib3svARB(1,[3,4,5])
|
175
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[3,4,5])
|
176
|
-
|
177
|
-
glVertexAttrib4dARB(1,1,2,3,4)
|
178
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,2,3,4])
|
179
|
-
glVertexAttrib4fARB(1,2,3,4,5)
|
180
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[2,3,4,5])
|
181
|
-
glVertexAttrib4sARB(1,3,4,5,6)
|
182
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[3,4,5,6])
|
183
|
-
glVertexAttrib4dvARB(1,[1,2,3,4])
|
184
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,2,3,4])
|
185
|
-
glVertexAttrib4fvARB(1,[2,3,4,5])
|
186
|
-
assert_equal(glGetVertexAttribfvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[2,3,4,5])
|
187
|
-
glVertexAttrib4svARB(1,[3,4,5,6])
|
188
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[3,4,5,6])
|
189
|
-
|
190
|
-
|
191
|
-
glVertexAttrib4bvARB(1,[1,2,3,4])
|
192
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,2,3,4])
|
193
|
-
glVertexAttrib4ivARB(1,[2,3,4,5])
|
194
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[2,3,4,5])
|
195
|
-
glVertexAttrib4ubvARB(1,[3,4,5,6])
|
196
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[3,4,5,6])
|
197
|
-
glVertexAttrib4uivARB(1,[1,2,3,4])
|
198
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,2,3,4])
|
199
|
-
glVertexAttrib4usvARB(1,[2,3,4,5])
|
200
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[2,3,4,5])
|
201
|
-
|
202
|
-
glVertexAttrib4NbvARB(1,[0,2**7-1,0,2**7-1])
|
203
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[0,1,0,1])
|
204
|
-
glVertexAttrib4NivARB(1,[2**31-1,0,2**31-1,0])
|
205
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,0,1,0])
|
206
|
-
glVertexAttrib4NsvARB(1,[0,2**15-1,0,2**15-1])
|
207
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[0,1,0,1])
|
208
|
-
|
209
|
-
glVertexAttrib4NubARB(1,2**8-1,0,2**8-1,0)
|
210
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,0,1,0])
|
211
|
-
|
212
|
-
glVertexAttrib4NubvARB(1,[0,2**8-1,0,2**8-1])
|
213
|
-
assert_equal(glGetVertexAttribdvARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[0,1,0,1])
|
214
|
-
glVertexAttrib4NuivARB(1,[2**32-1,0,2**32-1,0])
|
215
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[1,0,1,0])
|
216
|
-
glVertexAttrib4NusvARB(1,[0,2**16-1,0,2**16-1])
|
217
|
-
assert_equal(glGetVertexAttribivARB(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,4],[0,1,0,1])
|
218
|
-
|
219
|
-
glDeleteProgramsARB(programs)
|
220
|
-
end
|
221
|
-
|
222
|
-
def test_gl_arb_windowpos
|
223
|
-
return if not supported?("GL_ARB_window_pos")
|
224
|
-
# 2
|
225
|
-
glWindowPos2dARB(1.0,2.0)
|
226
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
227
|
-
glWindowPos2dvARB([2.0,1.0])
|
228
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
229
|
-
glWindowPos2fARB(1.0,2.0)
|
230
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
231
|
-
glWindowPos2fvARB([2.0,1.0])
|
232
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
233
|
-
glWindowPos2iARB(1,2)
|
234
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
235
|
-
glWindowPos2ivARB([2,1])
|
236
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
237
|
-
glWindowPos2sARB(1,2)
|
238
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
239
|
-
glWindowPos2svARB([2,1])
|
240
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
|
241
|
-
|
242
|
-
# 3
|
243
|
-
glWindowPos3dARB(1.0,2.0,0.5)
|
244
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0.5,1])
|
245
|
-
glWindowPos3dvARB([3.0,2.0,1.0])
|
246
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
247
|
-
glWindowPos3fARB(1.0,2.0,0.5)
|
248
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0.5,1])
|
249
|
-
glWindowPos3fvARB([3.0,2.0,1.0])
|
250
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
251
|
-
glWindowPos3iARB(1,2,0)
|
252
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
253
|
-
glWindowPos3ivARB([3,2,1])
|
254
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
255
|
-
glWindowPos3sARB(1,2,0)
|
256
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
|
257
|
-
glWindowPos3svARB([3,2,1])
|
258
|
-
assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_gl_arb_pointparameter
|
262
|
-
return if not supported?("GL_ARB_point_parameters")
|
263
|
-
glPointParameterfARB(GL_POINT_SIZE_MIN,1.0)
|
264
|
-
assert_equal(glGetDoublev(GL_POINT_SIZE_MIN),1.0)
|
265
|
-
|
266
|
-
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION,[1,0,1])
|
267
|
-
assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[1,0,1])
|
268
|
-
end
|
269
|
-
|
270
|
-
def test_gl_arb_occlusion_query
|
271
|
-
return if not supported?("GL_ARB_occlusion_query")
|
272
|
-
|
273
|
-
queries = glGenQueriesARB(2)
|
274
|
-
assert_equal(queries.size,2)
|
275
|
-
|
276
|
-
glBeginQueryARB(GL_SAMPLES_PASSED,queries[1])
|
277
|
-
assert_equal(glIsQueryARB(queries[1]),true)
|
278
|
-
|
279
|
-
glEndQueryARB(GL_SAMPLES_PASSED)
|
280
|
-
r = glGetQueryObjectivARB(queries[1],GL_QUERY_RESULT_AVAILABLE)
|
281
|
-
assert(r==GL_TRUE || r==GL_FALSE)
|
282
|
-
assert(glGetQueryObjectuivARB(queries[1],GL_QUERY_RESULT)>=0)
|
283
|
-
|
284
|
-
glDeleteQueriesARB(queries)
|
285
|
-
assert_equal(glIsQueryARB(queries[1]),false)
|
286
|
-
end
|
287
|
-
|
288
|
-
def test_gl_arb_shader_objects
|
289
|
-
return if not supported?("GL_ARB_shader_objects")
|
290
|
-
|
291
|
-
vertex_shader_source = "void main() { gl_Position = ftransform();}"
|
292
|
-
|
293
|
-
program = glCreateProgramObjectARB()
|
294
|
-
|
295
|
-
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
296
|
-
|
297
|
-
glShaderSourceARB(vs,vertex_shader_source)
|
298
|
-
assert_equal(glGetShaderSourceARB(vs),vertex_shader_source)
|
299
|
-
|
300
|
-
assert_equal(glGetObjectParameterivARB(vs,GL_OBJECT_TYPE_ARB),GL_SHADER_OBJECT_ARB)
|
301
|
-
assert_equal(glGetObjectParameterfvARB(vs,GL_OBJECT_TYPE_ARB),GL_SHADER_OBJECT_ARB)
|
302
|
-
assert_equal(glGetObjectParameterfvARB(vs,GL_OBJECT_SUBTYPE_ARB),GL_VERTEX_SHADER)
|
303
|
-
glCompileShaderARB(vs)
|
304
|
-
assert_equal(glGetObjectParameterivARB(vs,GL_OBJECT_COMPILE_STATUS_ARB),GL_TRUE)
|
305
|
-
|
306
|
-
vslog = glGetInfoLogARB(vs)
|
307
|
-
assert_equal(vslog.class,String)
|
308
|
-
|
309
|
-
glAttachObjectARB(program,vs)
|
310
|
-
assert_equal(glGetAttachedObjectsARB(program),vs)
|
311
|
-
|
312
|
-
glValidateProgramARB(program)
|
313
|
-
assert_equal(glGetObjectParameterivARB(program,GL_OBJECT_VALIDATE_STATUS_ARB),GL_TRUE)
|
314
|
-
|
315
|
-
glLinkProgramARB(program)
|
316
|
-
assert_equal(glGetObjectParameterivARB(program,GL_OBJECT_LINK_STATUS_ARB),GL_TRUE)
|
317
|
-
|
318
|
-
glUseProgramObjectARB(program)
|
319
|
-
assert_equal(glGetIntegerv(GL_CURRENT_PROGRAM),program)
|
320
|
-
|
321
|
-
assert_equal(glGetHandleARB(GL_PROGRAM_OBJECT_ARB),program)
|
322
|
-
|
323
|
-
glUseProgramObjectARB(0)
|
324
|
-
|
325
|
-
glDetachObjectARB(program,vs)
|
326
|
-
|
327
|
-
glDeleteObjectARB(vs)
|
328
|
-
glDeleteObjectARB(program)
|
329
|
-
end
|
330
|
-
|
331
|
-
def test_gl_arb_shader_objects_2
|
332
|
-
return if not supported?("GL_ARB_shader_objects")
|
333
|
-
|
334
|
-
vertex_shader_source = "attribute vec4 test; uniform float testvec1; uniform vec2 testvec2; uniform vec3 testvec3; uniform vec4 testvec4; uniform int testivec1; uniform ivec2 testivec2; uniform ivec3 testivec3; uniform ivec4 testivec4; void main() { gl_Position = testvec1 * test * testvec2.x * testvec3.x * testivec1 * testivec2.x * testivec3.x * testivec4.x + testvec4;}"
|
335
|
-
|
336
|
-
program = glCreateProgramObjectARB()
|
337
|
-
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
338
|
-
glShaderSourceARB(vs,vertex_shader_source)
|
339
|
-
|
340
|
-
glCompileShaderARB(vs)
|
341
|
-
assert_equal(glGetObjectParameterivARB(vs,GL_OBJECT_COMPILE_STATUS_ARB),GL_TRUE)
|
342
|
-
|
343
|
-
glAttachObjectARB(program,vs)
|
344
|
-
|
345
|
-
glLinkProgramARB(program)
|
346
|
-
assert_equal(glGetObjectParameterivARB(program,GL_OBJECT_LINK_STATUS_ARB),GL_TRUE)
|
347
|
-
|
348
|
-
glUseProgramObjectARB(program)
|
349
|
-
|
350
|
-
assert((tv1l = glGetUniformLocationARB(program,"testvec1"))>=0)
|
351
|
-
assert((tv2l = glGetUniformLocationARB(program,"testvec2"))>=0)
|
352
|
-
assert((tv3l = glGetUniformLocationARB(program,"testvec3"))>=0)
|
353
|
-
assert((tv4l = glGetUniformLocationARB(program,"testvec4"))>=0)
|
354
|
-
assert((tv1il = glGetUniformLocationARB(program,"testivec1"))>=0)
|
355
|
-
assert((tv2il = glGetUniformLocationARB(program,"testivec2"))>=0)
|
356
|
-
assert((tv3il = glGetUniformLocationARB(program,"testivec3"))>=0)
|
357
|
-
assert((tv4il = glGetUniformLocationARB(program,"testivec4"))>=0)
|
358
|
-
|
359
|
-
##
|
360
|
-
|
361
|
-
assert_equal(glGetActiveUniformARB(program,tv1il),[1,GL_INT,"testivec1"])
|
362
|
-
|
363
|
-
## f
|
364
|
-
glUniform1fARB(tv1l,2.0)
|
365
|
-
assert_equal(glGetUniformfvARB(program,tv1l),2.0)
|
366
|
-
glUniform2fARB(tv2l,2.0,2.0)
|
367
|
-
assert_equal(glGetUniformfvARB(program,tv2l),[2.0,2.0])
|
368
|
-
glUniform3fARB(tv3l,2.0,2.0,2.0)
|
369
|
-
assert_equal(glGetUniformfvARB(program,tv3l),[2.0,2.0,2.0])
|
370
|
-
glUniform4fARB(tv4l,2.0,2.0,2.0,2.0)
|
371
|
-
assert_equal(glGetUniformfvARB(program,tv4l),[2.0,2.0,2.0,2.0])
|
372
|
-
# i
|
373
|
-
glUniform1iARB(tv1il,3)
|
374
|
-
assert_equal(glGetUniformivARB(program,tv1il),3)
|
375
|
-
glUniform2iARB(tv2il,3,3)
|
376
|
-
assert_equal(glGetUniformivARB(program,tv2il),[3,3])
|
377
|
-
glUniform3iARB(tv3il,3,3,3)
|
378
|
-
assert_equal(glGetUniformivARB(program,tv3il),[3,3,3])
|
379
|
-
glUniform4iARB(tv4il,3,3,3,3)
|
380
|
-
assert_equal(glGetUniformivARB(program,tv4il),[3,3,3,3])
|
381
|
-
# fv
|
382
|
-
glUniform1fvARB(tv1l,[3.0])
|
383
|
-
assert_equal(glGetUniformfvARB(program,tv1l),3.0)
|
384
|
-
glUniform2fvARB(tv2l,[3.0,3.0])
|
385
|
-
assert_equal(glGetUniformfvARB(program,tv2l),[3.0,3.0])
|
386
|
-
glUniform3fvARB(tv3l,[3.0,3.0,3.0])
|
387
|
-
assert_equal(glGetUniformfvARB(program,tv3l),[3.0,3.0,3.0])
|
388
|
-
glUniform4fvARB(tv4l,[3.0,3.0,3.0,3.0])
|
389
|
-
assert_equal(glGetUniformfvARB(program,tv4l),[3.0,3.0,3.0,3.0])
|
390
|
-
# iv
|
391
|
-
glUniform1ivARB(tv1il,[2])
|
392
|
-
assert_equal(glGetUniformivARB(program,tv1il),2)
|
393
|
-
glUniform2ivARB(tv2il,[2,2])
|
394
|
-
assert_equal(glGetUniformivARB(program,tv2il),[2,2])
|
395
|
-
glUniform3ivARB(tv3il,[2,2,2])
|
396
|
-
assert_equal(glGetUniformivARB(program,tv3il),[2,2,2])
|
397
|
-
glUniform4ivARB(tv4il,[2,2,2,2])
|
398
|
-
assert_equal(glGetUniformivARB(program,tv4il),[2,2,2,2])
|
399
|
-
|
400
|
-
glDeleteObjectARB(vs)
|
401
|
-
glDeleteObjectARB(program)
|
402
|
-
end
|
403
|
-
|
404
|
-
def test_gl_arb_shader_objects_3
|
405
|
-
return if not supported?("GL_ARB_shader_objects")
|
406
|
-
|
407
|
-
vertex_shader_source = "uniform mat2 testmat2; uniform mat3 testmat3; uniform mat4 testmat4; void main() { gl_Position = gl_Vertex * testmat4[0].x * testmat3[0].x * testmat2[0].x;}"
|
408
|
-
|
409
|
-
program = glCreateProgramObjectARB()
|
410
|
-
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
411
|
-
glShaderSourceARB(vs,vertex_shader_source)
|
412
|
-
|
413
|
-
glCompileShaderARB(vs)
|
414
|
-
assert_equal(glGetObjectParameterivARB(vs,GL_OBJECT_COMPILE_STATUS_ARB),GL_TRUE)
|
415
|
-
|
416
|
-
glAttachObjectARB(program,vs)
|
417
|
-
|
418
|
-
glLinkProgramARB(program)
|
419
|
-
assert_equal(glGetObjectParameterivARB(program,GL_OBJECT_LINK_STATUS_ARB),GL_TRUE)
|
420
|
-
|
421
|
-
glUseProgramObjectARB(program)
|
422
|
-
#
|
423
|
-
assert((tm2l = glGetUniformLocationARB(program,"testmat2"))>=0)
|
424
|
-
assert((tm3l = glGetUniformLocationARB(program,"testmat3"))>=0)
|
425
|
-
assert((tm4l = glGetUniformLocationARB(program,"testmat4"))>=0)
|
426
|
-
|
427
|
-
glUniformMatrix2fvARB(tm2l, GL_TRUE, [0,1, 1,0])
|
428
|
-
assert_equal(glGetUniformfvARB(program,tm2l),[0,1,1,0])
|
429
|
-
|
430
|
-
glUniformMatrix3fvARB(tm3l, GL_TRUE, [0,1,0, 1,0,1, 0,1,0])
|
431
|
-
assert_equal(glGetUniformfvARB(program,tm3l),[0,1,0, 1,0,1, 0,1,0])
|
432
|
-
|
433
|
-
glUniformMatrix4fvARB(tm4l, GL_TRUE, [0,1,0,1, 1,0,1,0, 0,1,0,1, 1,0,1,0])
|
434
|
-
assert_equal(glGetUniformfvARB(program,tm4l),[0,1,0,1, 1,0,1,0, 0,1,0,1, 1,0,1,0])
|
435
|
-
|
436
|
-
glDeleteObjectARB(vs)
|
437
|
-
glDeleteObjectARB(program)
|
438
|
-
end
|
439
|
-
|
440
|
-
def test_gl_arb_vertex_shader
|
441
|
-
return if not supported?("GL_ARB_vertex_shader")
|
442
|
-
|
443
|
-
vertex_shader_source = "attribute vec4 test; uniform float testvec1; uniform vec2 testvec2; uniform vec3 testvec3; uniform vec4 testvec4; uniform int testivec1; uniform ivec2 testivec2; uniform ivec3 testivec3; uniform ivec4 testivec4; void main() { gl_Position = testvec1 * test * testvec2.x * testvec3.x * testivec1 * testivec2.x * testivec3.x * testivec4.x + testvec4;}"
|
444
|
-
|
445
|
-
program = glCreateProgramObjectARB()
|
446
|
-
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
447
|
-
glShaderSourceARB(vs,vertex_shader_source)
|
448
|
-
|
449
|
-
glCompileShaderARB(vs)
|
450
|
-
assert_equal(glGetObjectParameterivARB(vs,GL_OBJECT_COMPILE_STATUS_ARB),GL_TRUE)
|
451
|
-
|
452
|
-
glAttachObjectARB(program,vs)
|
453
|
-
|
454
|
-
glBindAttribLocationARB(program,2,"test")
|
455
|
-
|
456
|
-
glLinkProgramARB(program)
|
457
|
-
assert_equal(glGetObjectParameterivARB(program,GL_OBJECT_LINK_STATUS_ARB),GL_TRUE)
|
458
|
-
|
459
|
-
glUseProgramObjectARB(program)
|
460
|
-
|
461
|
-
assert_equal(glGetAttribLocationARB(program,"test"),2)
|
462
|
-
assert_equal(glGetActiveAttribARB(program,0),[1,GL_FLOAT_VEC4,"test"])
|
463
|
-
|
464
|
-
glDeleteObjectARB(vs)
|
465
|
-
glDeleteObjectARB(program)
|
466
|
-
end
|
467
|
-
end
|