opengl 0.7.0.pre1-x86-mingw32 → 0.7.0.pre2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.autotest +29 -0
  2. data/.gitignore +5 -8
  3. data/History.rdoc +33 -0
  4. data/Manifest.txt +72 -57
  5. data/README.rdoc +72 -25
  6. data/Rakefile +60 -72
  7. data/Rakefile.cross +5 -2
  8. data/{doc → docs}/build_install.txt +0 -0
  9. data/{doc → docs}/extensions.txt.in +0 -0
  10. data/{doc → docs}/history.txt +0 -0
  11. data/{doc → docs}/requirements_and_design.txt +0 -0
  12. data/{doc → docs}/roadmap.txt +0 -0
  13. data/{doc → docs}/scientific_use.txt +0 -0
  14. data/{doc → docs}/supplies/page_template.html +0 -0
  15. data/{doc → docs}/thanks.txt +0 -0
  16. data/{doc → docs}/tutorial.txt +0 -0
  17. data/examples/NeHe/NeHe.png +0 -0
  18. data/examples/NeHe/crate.png +0 -0
  19. data/examples/NeHe/glass.png +0 -0
  20. data/examples/NeHe/nehe_lesson02.rb +82 -83
  21. data/examples/NeHe/nehe_lesson03.rb +88 -88
  22. data/examples/NeHe/nehe_lesson04.rb +93 -96
  23. data/examples/NeHe/nehe_lesson05.rb +137 -144
  24. data/examples/NeHe/nehe_lesson06.rb +183 -0
  25. data/examples/NeHe/nehe_lesson07.rb +237 -0
  26. data/examples/NeHe/nehe_lesson08.rb +252 -0
  27. data/examples/NeHe/nehe_lesson09.rb +199 -0
  28. data/examples/NeHe/nehe_lesson11.rb +173 -0
  29. data/examples/NeHe/nehe_lesson12.rb +200 -0
  30. data/examples/NeHe/nehe_lesson16.rb +208 -0
  31. data/examples/NeHe/nehe_lesson19.rb +206 -0
  32. data/examples/NeHe/particle.png +0 -0
  33. data/examples/NeHe/star.png +0 -0
  34. data/examples/NeHe/tim.png +0 -0
  35. data/examples/RedBook/light.rb +154 -0
  36. data/examples/misc/OGLBench.rb +2 -2
  37. data/examples/misc/trislam.rb +2 -2
  38. data/ext/{common → opengl}/common.h +2 -11
  39. data/ext/{common → opengl}/conv.h +43 -31
  40. data/ext/{glut → opengl}/extconf.rb +14 -7
  41. data/ext/{common → opengl}/funcdef.h +155 -125
  42. data/ext/{gl → opengl}/gl-1.0-1.1.c +426 -162
  43. data/ext/{gl → opengl}/gl-1.2.c +70 -66
  44. data/ext/{gl → opengl}/gl-1.3.c +19 -19
  45. data/ext/{gl → opengl}/gl-1.4.c +23 -23
  46. data/ext/{gl → opengl}/gl-1.5.c +46 -47
  47. data/ext/{gl → opengl}/gl-2.0.c +66 -60
  48. data/ext/{gl → opengl}/gl-2.1.c +4 -4
  49. data/ext/{gl → opengl}/gl-enums.c +2 -1
  50. data/ext/{common → opengl}/gl-enums.h +0 -0
  51. data/ext/{gl → opengl}/gl-error.c +12 -4
  52. data/ext/{common → opengl}/gl-error.h +7 -2
  53. data/ext/{gl → opengl}/gl-ext-3dfx.c +1 -1
  54. data/ext/{gl → opengl}/gl-ext-arb.c +75 -70
  55. data/ext/{gl → opengl}/gl-ext-ati.c +3 -3
  56. data/ext/{gl → opengl}/gl-ext-ext.c +54 -54
  57. data/ext/{gl → opengl}/gl-ext-gremedy.c +3 -3
  58. data/ext/{gl → opengl}/gl-ext-nv.c +49 -48
  59. data/ext/{common → opengl}/gl-types.h +0 -0
  60. data/ext/{gl → opengl}/gl.c +8 -10
  61. data/ext/{glu → opengl}/glu-enums.c +1 -1
  62. data/ext/{common → opengl}/glu-enums.h +0 -0
  63. data/ext/{glu → opengl}/glu.c +7 -3
  64. data/ext/{glut → opengl}/glut.c +98 -48
  65. data/ext/opengl/opengl.c +11 -0
  66. data/lib/gl.rb +1 -0
  67. data/lib/glu.rb +1 -0
  68. data/lib/glut.rb +1 -0
  69. data/lib/opengl.rb +13 -14
  70. data/lib/opengl/opengl.so +0 -0
  71. data/lib/opengl/test_case.rb +87 -0
  72. data/test/{tc_misc.rb → test_gl.rb} +2 -14
  73. data/test/test_gl_10_11.rb +1363 -0
  74. data/test/test_gl_12.rb +182 -0
  75. data/test/{tc_func_13.rb → test_gl_13.rb} +14 -14
  76. data/test/test_gl_14.rb +221 -0
  77. data/test/test_gl_15.rb +260 -0
  78. data/test/test_gl_20.rb +430 -0
  79. data/test/test_gl_21.rb +553 -0
  80. data/test/test_gl_ext_arb.rb +526 -0
  81. data/test/{tc_ext_ati.rb → test_gl_ext_ati.rb} +11 -14
  82. data/test/test_gl_ext_ext.rb +608 -0
  83. data/test/{tc_ext_gremedy.rb → test_gl_ext_gremedy.rb} +6 -6
  84. data/test/test_gl_ext_nv.rb +352 -0
  85. data/test/test_glu.rb +309 -0
  86. metadata +159 -102
  87. data/History.txt +0 -36
  88. data/ext/gl/extconf.rb +0 -43
  89. data/ext/glu/extconf.rb +0 -51
  90. data/test/README +0 -10
  91. data/test/tc_common.rb +0 -98
  92. data/test/tc_ext_arb.rb +0 -467
  93. data/test/tc_ext_ext.rb +0 -551
  94. data/test/tc_ext_nv.rb +0 -357
  95. data/test/tc_func_10_11.rb +0 -1281
  96. data/test/tc_func_12.rb +0 -186
  97. data/test/tc_func_14.rb +0 -197
  98. data/test/tc_func_15.rb +0 -270
  99. data/test/tc_func_20.rb +0 -346
  100. data/test/tc_func_21.rb +0 -541
  101. data/test/tc_glu.rb +0 -310
  102. data/test/tc_include_gl.rb +0 -35
  103. data/test/tc_require_gl.rb +0 -34
@@ -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
-
@@ -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
@@ -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