opengl 0.7.0.pre1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +8 -0
- data/History.txt +36 -0
- data/MIT-LICENSE +18 -0
- data/Manifest.txt +140 -0
- data/README.rdoc +51 -0
- data/Rakefile +129 -0
- data/Rakefile.cross +104 -0
- data/doc/build_install.txt +119 -0
- data/doc/extensions.txt.in +348 -0
- data/doc/history.txt +66 -0
- data/doc/requirements_and_design.txt +117 -0
- data/doc/roadmap.txt +28 -0
- data/doc/scientific_use.txt +35 -0
- data/doc/supplies/page_template.html +71 -0
- data/doc/thanks.txt +29 -0
- data/doc/tutorial.txt +469 -0
- data/examples/NeHe/nehe_lesson02.rb +117 -0
- data/examples/NeHe/nehe_lesson03.rb +122 -0
- data/examples/NeHe/nehe_lesson04.rb +133 -0
- data/examples/NeHe/nehe_lesson05.rb +186 -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 +376 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +406 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +16 -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/RedBook/double.rb +105 -0
- data/examples/RedBook/drawf.rb +91 -0
- 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/RedBook/jitter.rb +207 -0
- 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/RedBook/model.rb +113 -0
- data/examples/RedBook/movelight.rb +132 -0
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/RedBook/planet.rb +108 -0
- 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/OGLBench.rb +337 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/fbo_test.rb +356 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/misc/glfwtest.rb +30 -0
- data/examples/misc/plane.rb +161 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/misc/sdltest.rb +34 -0
- data/examples/misc/trislam.rb +828 -0
- data/ext/common/common.h +448 -0
- data/ext/common/conv.h +234 -0
- data/ext/common/funcdef.h +280 -0
- data/ext/common/gl-enums.h +10031 -0
- data/ext/common/gl-error.h +23 -0
- data/ext/common/gl-types.h +67 -0
- data/ext/common/glu-enums.h +463 -0
- data/ext/gl/extconf.rb +43 -0
- data/ext/gl/gl-1.0-1.1.c +2811 -0
- data/ext/gl/gl-1.2.c +814 -0
- data/ext/gl/gl-1.3.c +443 -0
- data/ext/gl/gl-1.4.c +348 -0
- data/ext/gl/gl-1.5.c +225 -0
- data/ext/gl/gl-2.0.c +657 -0
- data/ext/gl/gl-2.1.c +57 -0
- data/ext/gl/gl-enums.c +3354 -0
- data/ext/gl/gl-error.c +104 -0
- data/ext/gl/gl-ext-3dfx.c +27 -0
- data/ext/gl/gl-ext-arb.c +866 -0
- data/ext/gl/gl-ext-ati.c +41 -0
- data/ext/gl/gl-ext-ext.c +889 -0
- data/ext/gl/gl-ext-gremedy.c +41 -0
- data/ext/gl/gl-ext-nv.c +679 -0
- data/ext/gl/gl.c +216 -0
- data/ext/glu/extconf.rb +51 -0
- data/ext/glu/glu-enums.c +164 -0
- data/ext/glu/glu.c +1530 -0
- data/ext/glut/extconf.rb +67 -0
- data/ext/glut/glut.c +1624 -0
- data/lib/opengl.rb +89 -0
- data/test/README +10 -0
- data/test/tc_common.rb +98 -0
- data/test/tc_ext_arb.rb +467 -0
- data/test/tc_ext_ati.rb +33 -0
- data/test/tc_ext_ext.rb +551 -0
- data/test/tc_ext_gremedy.rb +36 -0
- data/test/tc_ext_nv.rb +357 -0
- data/test/tc_func_10_11.rb +1281 -0
- data/test/tc_func_12.rb +186 -0
- data/test/tc_func_13.rb +229 -0
- data/test/tc_func_14.rb +197 -0
- data/test/tc_func_15.rb +270 -0
- data/test/tc_func_20.rb +346 -0
- data/test/tc_func_21.rb +541 -0
- data/test/tc_glu.rb +310 -0
- data/test/tc_include_gl.rb +35 -0
- data/test/tc_misc.rb +54 -0
- data/test/tc_require_gl.rb +34 -0
- data/utils/README +11 -0
- data/utils/enumgen.rb +112 -0
- data/utils/extlistgen.rb +90 -0
- data/utils/mkdn2html.rb +59 -0
- data/utils/post-mkdn2html.rb +91 -0
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +198 -0
- metadata +274 -0
data/lib/opengl.rb
ADDED
@@ -0,0 +1,89 @@
|
|
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
|
+
# Extend the search path for Windows binary gem, depending of the current ruby version
|
24
|
+
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
|
25
|
+
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
|
26
|
+
$: << File.join(File.dirname(__FILE__), major_minor)
|
27
|
+
|
28
|
+
require 'gl'
|
29
|
+
require 'glu'
|
30
|
+
require 'glut'
|
31
|
+
|
32
|
+
include Gl,Glu,Glut
|
33
|
+
|
34
|
+
# (Gl.)glVertex -> GL.Vertex
|
35
|
+
# (Gl::)GL_TRUE -> GL::TRUE
|
36
|
+
module GL
|
37
|
+
extend self
|
38
|
+
include Gl
|
39
|
+
|
40
|
+
Gl.constants.each do |cn|
|
41
|
+
n = cn.to_s.sub(/^GL_/,'')
|
42
|
+
# due to ruby naming scheme, we can't export constants with leading decimal,
|
43
|
+
# e.g. (Gl::)GL_2D would under old syntax become (GL::)2D which is illegal
|
44
|
+
next if n =~ /^[0-9]/
|
45
|
+
const_set( n, Gl.const_get( cn ) )
|
46
|
+
end
|
47
|
+
|
48
|
+
Gl.methods( false ).each do |mn|
|
49
|
+
n = mn.to_s.sub(/^gl/,'')
|
50
|
+
alias_method( n, mn )
|
51
|
+
public( n )
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# (Glu.)gluSphere -> GLU.Sphere
|
56
|
+
# (Glu::)GLU_INSIDE -> GLU::INSIDE
|
57
|
+
module GLU
|
58
|
+
extend self
|
59
|
+
include Glu
|
60
|
+
|
61
|
+
Glu.constants.each do |cn|
|
62
|
+
n = cn.to_s.sub(/^GLU_/,'')
|
63
|
+
const_set( n, Glu.const_get( cn ) )
|
64
|
+
end
|
65
|
+
|
66
|
+
Glu.methods( false ).each do |mn|
|
67
|
+
n = mn.to_s.sub(/^glu/,'')
|
68
|
+
alias_method( n, mn )
|
69
|
+
public( n )
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# (Glut.)glutInit -> GLUT.Init
|
74
|
+
# (Glut::)GLUT_RGBA -> GLUT::RGBA
|
75
|
+
module GLUT
|
76
|
+
extend self
|
77
|
+
include Glut
|
78
|
+
|
79
|
+
Glut.constants.each do |cn|
|
80
|
+
n = cn.to_s.sub(/^GLUT_/,'')
|
81
|
+
const_set( n, Glut.const_get( cn ) )
|
82
|
+
end
|
83
|
+
|
84
|
+
Glut.methods( false ).each do |mn|
|
85
|
+
n = mn.to_s.sub(/^glut/,'')
|
86
|
+
alias_method( n, mn )
|
87
|
+
public( n )
|
88
|
+
end
|
89
|
+
end
|
data/test/README
ADDED
@@ -0,0 +1,10 @@
|
|
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
ADDED
@@ -0,0 +1,98 @@
|
|
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
ADDED
@@ -0,0 +1,467 @@
|
|
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
|