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
@@ -0,0 +1,182 @@
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 'opengl/test_case'
17
+
18
+ class TestGl12 < OpenGL::TestCase
19
+
20
+ def test_glblend
21
+ supported?(1.2)
22
+ glBlendColor(0.0, 1.0, 0.0, 1.0)
23
+ assert_equal(glGetDoublev(GL_BLEND_COLOR), [0, 1, 0, 1])
24
+
25
+ glBlendEquation(GL_MIN)
26
+ assert_equal(glGetIntegerv(GL_BLEND_EQUATION), GL_MIN)
27
+ glBlendEquation(GL_MAX)
28
+ assert_equal(glGetIntegerv(GL_BLEND_EQUATION), GL_MAX)
29
+ end
30
+
31
+ def test_gldrawrangeelements
32
+ supported?(1.2)
33
+ va = [0, 0, 0, 1, 1, 1].pack("f*")
34
+ glVertexPointer(2, GL_FLOAT, 0, va)
35
+
36
+ buf = glFeedbackBuffer(256, GL_3D)
37
+ glRenderMode(GL_FEEDBACK)
38
+
39
+ glEnableClientState(GL_VERTEX_ARRAY)
40
+
41
+ glDrawRangeElements(GL_POINTS, 0, 2, 3, GL_UNSIGNED_BYTE, [0, 1, 2].pack("C*"))
42
+ count = glRenderMode(GL_RENDER)
43
+ assert_equal(count, 12)
44
+
45
+ glDisableClientState(GL_VERTEX_ARRAY)
46
+ end
47
+
48
+ def test_colortable
49
+ supported?(1.2)
50
+
51
+ ct = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
52
+ ct2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
53
+ glColorTable(GL_COLOR_TABLE, GL_RGB8, 4, GL_RGB, GL_FLOAT, ct)
54
+ assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct)
55
+
56
+ glColorSubTable(GL_COLOR_TABLE, 0, 4, GL_RGB, GL_FLOAT, ct2)
57
+ assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct2)
58
+
59
+ glDrawPixels(4, 1, GL_RGB, GL_FLOAT, ct)
60
+ glCopyColorTable(GL_COLOR_TABLE, GL_RGB8, 0, 0, 4)
61
+ assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct)
62
+
63
+ glDrawPixels(4, 1, GL_RGB, GL_FLOAT, ct2)
64
+ glCopyColorSubTable(GL_COLOR_TABLE, 0, 0, 0, 4)
65
+ assert_equal(glGetColorTable(GL_COLOR_TABLE, GL_RGB, GL_FLOAT), ct2)
66
+
67
+ glColorTableParameterfv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS, [0, 1, 0, 1])
68
+ assert_equal(glGetColorTableParameterfv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS), [0, 1, 0, 1])
69
+
70
+ glColorTableParameteriv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS, [1, 0, 1, 0])
71
+ assert_equal(glGetColorTableParameteriv(GL_COLOR_TABLE, GL_COLOR_TABLE_BIAS), [1, 0, 1, 0])
72
+ end
73
+
74
+ def test_convolutionfilter
75
+ supported?(1.2)
76
+
77
+ cf = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
78
+ cf2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
79
+ glConvolutionFilter1D(GL_CONVOLUTION_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT,cf)
80
+ assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf)
81
+
82
+ glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB8, 2,2, GL_RGB, GL_FLOAT,cf2)
83
+ assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf2)
84
+
85
+ glDrawPixels(4,1,GL_RGB,GL_FLOAT,cf2)
86
+ glCopyConvolutionFilter1D(GL_CONVOLUTION_1D,GL_RGB8,0,0,4)
87
+ assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf2)
88
+
89
+ glDrawPixels(2,2,GL_RGB,GL_FLOAT,cf)
90
+ glCopyConvolutionFilter2D(GL_CONVOLUTION_2D,GL_RGB8,0,0,2,2)
91
+ assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf)
92
+
93
+ glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_CONSTANT_BORDER)
94
+ assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
95
+
96
+ glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
97
+ assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_REPLICATE_BORDER)
98
+
99
+ glConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
100
+ assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
101
+
102
+ glConvolutionParameteri(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
103
+ assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_REPLICATE_BORDER)
104
+
105
+ glConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
106
+ assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
107
+ end
108
+
109
+ def test_separablefilter
110
+ supported?(1.2)
111
+ sf_a = ([0]*3+[1]*3).pack("f*")
112
+ sf_b = ([1]*3+[0]*3).pack("f*")
113
+
114
+ glSeparableFilter2D(GL_SEPARABLE_2D, GL_RGB8, 2, 2, GL_RGB, GL_FLOAT, sf_a, sf_b)
115
+ assert_equal(glGetSeparableFilter(GL_SEPARABLE_2D, GL_RGB, GL_FLOAT), [sf_a, sf_b])
116
+ end
117
+
118
+ def test_histogram
119
+ supported?(1.2)
120
+
121
+ glEnable(GL_HISTOGRAM)
122
+
123
+ glHistogram(GL_HISTOGRAM, 1, GL_RGB, GL_FALSE)
124
+ assert_equal(glGetHistogramParameterfv(GL_HISTOGRAM, GL_HISTOGRAM_WIDTH), 1)
125
+ assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM, GL_HISTOGRAM_FORMAT), GL_RGB)
126
+ assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM, GL_HISTOGRAM_SINK), GL_FALSE)
127
+
128
+ glDrawPixels(2, 1, GL_RGB, GL_FLOAT, [1, 1, 1, 1, 1, 1].pack("f*"))
129
+ h = glGetHistogram(GL_HISTOGRAM, GL_FALSE, GL_RGB, GL_FLOAT)
130
+ assert_equal(h.unpack("f*"), [2, 2, 2])
131
+ glResetHistogram(GL_HISTOGRAM)
132
+ h = glGetHistogram(GL_HISTOGRAM, GL_FALSE, GL_RGB, GL_FLOAT)
133
+ assert_equal(h.unpack("f*"), [0, 0, 0])
134
+
135
+ glDisable(GL_HISTOGRAM)
136
+ end
137
+
138
+ def test_minmax
139
+ supported?(1.2)
140
+
141
+ glEnable(GL_MINMAX)
142
+
143
+ glMinmax(GL_MINMAX, GL_RGB, GL_FALSE)
144
+ assert_equal(glGetMinmaxParameteriv(GL_MINMAX, GL_MINMAX_FORMAT), GL_RGB)
145
+ assert_equal(glGetMinmaxParameterfv(GL_MINMAX, GL_MINMAX_FORMAT), GL_RGB)
146
+ assert_equal(glGetMinmaxParameteriv(GL_MINMAX, GL_MINMAX_SINK), GL_FALSE)
147
+
148
+ glDrawPixels(2, 1, GL_RGB, GL_FLOAT, [0, 0, 0, 1, 1, 1].pack("f*"))
149
+ mm = glGetMinmax(GL_MINMAX, GL_FALSE, GL_RGB, GL_FLOAT)
150
+ assert_each_in_delta [0, 0, 0, 1, 1, 1], mm.unpack("f*")
151
+
152
+ glResetMinmax(GL_MINMAX)
153
+ mm = glGetMinmax(GL_MINMAX, GL_FALSE, GL_RGB, GL_UNSIGNED_BYTE)
154
+ assert_equal [-1, -1, -1, 0, 0, 0], mm.unpack("c*")
155
+
156
+ glDisable(GL_MINMAX)
157
+ end
158
+
159
+ def test_texture_3D
160
+ supported?(1.2)
161
+ image = ([0, 0, 0, 1, 1, 1] * 2 * 2).pack("f*")
162
+ image2 = ([1, 1, 1, 0, 0, 0] * 2 * 2).pack("f*")
163
+
164
+ textures = glGenTextures(1)
165
+ glBindTexture(GL_TEXTURE_3D, textures[0])
166
+
167
+ glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8, 2, 2, 2, 0, GL_RGB, GL_FLOAT, image)
168
+ assert_equal(glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT), image)
169
+
170
+ glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 2, 2, 2, GL_RGB, GL_FLOAT, image2)
171
+ assert_equal(glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT), image2)
172
+
173
+ glDrawPixels(2, 2, GL_RGB, GL_FLOAT, image)
174
+ glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 2, 2)
175
+ ti = glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT).unpack("f*")
176
+ assert_equal(ti, ([0]*3 + [1]*3) * 2 + ([1]*3 + [0]*3) * 2)
177
+
178
+ glDeleteTextures(textures)
179
+ end
180
+
181
+ end
182
+
@@ -13,19 +13,19 @@
13
13
  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  #
15
15
 
16
- require 'test/unit'
16
+ require 'opengl/test_case'
17
17
 
18
- class Test_13 < Test::Unit::TestCase
18
+ class TestGl13 < OpenGL::TestCase
19
19
  def setup
20
- common_setup()
20
+ super()
21
21
  end
22
22
 
23
23
  def teardown
24
- common_teardown()
24
+ super()
25
25
  end
26
26
 
27
27
  def test_glsamplecoverage
28
- return if not supported?(1.3)
28
+ supported?(1.3)
29
29
  glSampleCoverage(0.0,GL_TRUE)
30
30
  assert_equal(glGetDoublev(GL_SAMPLE_COVERAGE_VALUE),0.0)
31
31
  assert_equal(glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT),GL_TRUE)
@@ -35,7 +35,7 @@ class Test_13 < Test::Unit::TestCase
35
35
  end
36
36
 
37
37
  def test_multitexture
38
- return if not supported?(1.3)
38
+ supported?(1.3)
39
39
  glActiveTexture(GL_TEXTURE1)
40
40
  glClientActiveTexture(GL_TEXTURE2)
41
41
  assert_equal(glGetIntegerv(GL_ACTIVE_TEXTURE),GL_TEXTURE1)
@@ -43,7 +43,7 @@ class Test_13 < Test::Unit::TestCase
43
43
  end
44
44
 
45
45
  def test_transposematrix
46
- return if not supported?(1.3)
46
+ supported?(1.3)
47
47
  m_a = [[1.0,2.0,3.0,4.0],
48
48
  [0.0,2.0,0.0,0.0],
49
49
  [0.0,0.0,2.0,0.0],
@@ -84,15 +84,15 @@ class Test_13 < Test::Unit::TestCase
84
84
  glMultTransposeMatrixd(m)
85
85
  assert_equal(glGetDoublev(GL_MODELVIEW_MATRIX), m.to_a.transpose)
86
86
 
87
- assert_raise ArgumentError do glLoadTransposeMatrixf([1,2,3,4]) end
88
- assert_raise ArgumentError do glLoadTransposeMatrixd([1,2,3,4]) end
89
- assert_raise ArgumentError do glMultTransposeMatrixf([1,2,3,4]) end
90
- assert_raise ArgumentError do glMultTransposeMatrixd([1,2,3,4]) end
87
+ assert_raises ArgumentError do glLoadTransposeMatrixf([1,2,3,4]) end
88
+ assert_raises ArgumentError do glLoadTransposeMatrixd([1,2,3,4]) end
89
+ assert_raises ArgumentError do glMultTransposeMatrixf([1,2,3,4]) end
90
+ assert_raises ArgumentError do glMultTransposeMatrixd([1,2,3,4]) end
91
91
  end
92
92
 
93
93
  def test_texturecompression
94
- return if not supported?(1.3)
95
- return if not supported?("GL_EXT_texture_compression_s3tc")
94
+ supported?(1.3)
95
+ supported?("GL_EXT_texture_compression_s3tc")
96
96
 
97
97
  # S3TC/DXT5 compressed 2x2 pixels stipple patterns [w,b,b,w] and [b,w,w,b]
98
98
  image_1 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x54,0x5C,0x5C].pack("C*")
@@ -151,7 +151,7 @@ class Test_13 < Test::Unit::TestCase
151
151
  end
152
152
 
153
153
  def test_glmultitexcoord
154
- return if not supported?(1.3)
154
+ supported?(1.3)
155
155
 
156
156
  glActiveTexture(GL_TEXTURE1)
157
157
 
@@ -0,0 +1,221 @@
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 'opengl/test_case'
17
+
18
+ class TestGl14 < OpenGL::TestCase
19
+
20
+ def setup
21
+ super
22
+
23
+ supported? 1.4
24
+ end
25
+
26
+ def test_arrays_2
27
+ sc = [0, 1, 0, 1, 0, 1].pack("f*")
28
+ fc = [1, 0].pack("f*")
29
+
30
+ glSecondaryColorPointer(3, GL_FLOAT, 0, sc)
31
+ assert_equal 3, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE)
32
+ assert_equal GL_FLOAT, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE)
33
+ assert_equal 12, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE)
34
+ assert_equal sc, glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER)
35
+
36
+ glFogCoordPointer(GL_FLOAT, 0, fc)
37
+ assert_equal GL_FLOAT, glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE)
38
+ assert_equal 4, glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE)
39
+ assert_equal fc, glGetPointerv(GL_FOG_COORD_ARRAY_POINTER)
40
+
41
+ glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
42
+ glEnableClientState(GL_FOG_COORD_ARRAY)
43
+
44
+ glBegin(GL_TRIANGLES)
45
+ glArrayElement(0)
46
+ glEnd()
47
+
48
+ assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR), [0, 1, 0, 1])
49
+ assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD), 1)
50
+
51
+ glBegin(GL_TRIANGLES)
52
+ glArrayElement(1)
53
+ glEnd()
54
+
55
+ assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR), [1, 0, 1, 1])
56
+ assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD), 0)
57
+
58
+ glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
59
+ glDisableClientState(GL_FOG_COORD_ARRAY)
60
+ end
61
+
62
+ def test_arrays_3
63
+ va = [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1].pack("f*")
64
+ glVertexPointer(2, GL_FLOAT, 0, va)
65
+
66
+ glEnableClientState(GL_VERTEX_ARRAY)
67
+
68
+ buf = glFeedbackBuffer(256, GL_3D)
69
+ glRenderMode(GL_FEEDBACK)
70
+
71
+ glMultiDrawArrays(GL_POLYGON, [0, 3], [3, 3])
72
+
73
+ i1 = [0, 1, 2].pack("C*")
74
+ i2 = [3, 4, 5].pack("C*")
75
+ glMultiDrawElements(GL_TRIANGLES, GL_UNSIGNED_BYTE, [i1, i2])
76
+
77
+ count = glRenderMode(GL_RENDER)
78
+ assert_equal(count, (3*3+2)*4)
79
+ glDisableClientState(GL_VERTEX_ARRAY)
80
+ end
81
+
82
+ def test_glblendfuncseparate
83
+ glBlendFuncSeparate(GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR)
84
+ assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB), GL_SRC_COLOR)
85
+ assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA), GL_SRC_COLOR)
86
+ assert_equal(glGetIntegerv(GL_BLEND_DST_RGB), GL_SRC_COLOR)
87
+ assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA), GL_SRC_COLOR)
88
+ end
89
+
90
+ def test_glpointparameter
91
+ glPointParameterf(GL_POINT_SIZE_MIN, 2.0)
92
+ assert_equal(glGetDoublev(GL_POINT_SIZE_MIN), 2.0)
93
+
94
+ glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, [0, 1, 0])
95
+ assert_equal([0, 1, 0], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
96
+
97
+ glPointParameteri(GL_POINT_SIZE_MAX, 4)
98
+ assert_equal(glGetDoublev(GL_POINT_SIZE_MAX), 4)
99
+
100
+ glPointParameteriv(GL_POINT_DISTANCE_ATTENUATION, [1, 0, 1])
101
+ assert_equal([1, 0, 1], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
102
+ end
103
+
104
+ def test_glfogcoord
105
+ glFogCoordf(2.0)
106
+ assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD), 2.0)
107
+ glFogCoordfv([3.0])
108
+ assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD), 3.0)
109
+
110
+ glFogCoordd(2.0)
111
+ assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD), 2.0)
112
+ glFogCoorddv([3.0])
113
+ assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD), 3.0)
114
+ end
115
+
116
+ def test_glsecondarycolor
117
+ glSecondaryColor3b(2**7-1, 0, 2**7-1)
118
+ assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
119
+
120
+ glSecondaryColor3bv([0, 2**7-1, 0])
121
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
122
+
123
+ glSecondaryColor3d(1.0, 0.0, 1.0)
124
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
125
+
126
+ glSecondaryColor3dv([0.0, 1.0, 0.0])
127
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
128
+
129
+ glSecondaryColor3f(1.0, 0.0, 1.0)
130
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
131
+
132
+ glSecondaryColor3fv([0.0, 1.0, 0.0])
133
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
134
+
135
+ glSecondaryColor3i(2**31-1, 0, 2**31-1)
136
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
137
+
138
+ glSecondaryColor3iv([0, 2**31-1, 0])
139
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
140
+
141
+ glSecondaryColor3s(2**15-1, 0, 2**15-1)
142
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
143
+
144
+ glSecondaryColor3sv([0, 2**15-1, 0])
145
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
146
+
147
+ glSecondaryColor3ub(2**8-1, 0, 2**8-1)
148
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
149
+
150
+ glSecondaryColor3ubv([0, 2**8-1, 0])
151
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
152
+
153
+ glSecondaryColor3ui(2**32-1, 0, 2**32-1)
154
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
155
+
156
+ glSecondaryColor3uiv([0, 2**32-1, 0])
157
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
158
+
159
+ glSecondaryColor3us(2**16-1, 0, 2**16-1)
160
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
161
+
162
+ glSecondaryColor3usv([0, 2**16-1, 0])
163
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
164
+ end
165
+
166
+ def test_glwindowpos_2
167
+ glLoadIdentity
168
+
169
+ glWindowPos2d 1.0, 2.0
170
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
171
+
172
+ glWindowPos2dv [2.0, 1.0]
173
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
174
+
175
+ glWindowPos2f 1.0, 2.0
176
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
177
+
178
+ glWindowPos2fv [2.0, 1.0]
179
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
180
+
181
+ glWindowPos2i 1, 2
182
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
183
+
184
+ glWindowPos2iv [2, 1]
185
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
186
+
187
+ glWindowPos2s 1, 2
188
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
189
+
190
+ glWindowPos2sv [2, 1]
191
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
192
+ end
193
+
194
+ def test_glwindowspos_3
195
+ glWindowPos3d 1.0, 2.0, 0.5
196
+ assert_each_in_delta [1, 2, 0.5, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
197
+
198
+ glWindowPos3dv [3.0, 2.0, 1.0]
199
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
200
+
201
+ glWindowPos3f 1.0, 2.0, 0.5
202
+ assert_each_in_delta [1, 2, 0.5, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
203
+
204
+ glWindowPos3fv [3.0, 2.0, 1.0]
205
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
206
+
207
+ glWindowPos3i 1, 2, 0
208
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
209
+
210
+ glWindowPos3iv [3, 2, 1]
211
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
212
+
213
+ glWindowPos3s 1, 2, 0
214
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
215
+
216
+ glWindowPos3sv [3, 2, 1]
217
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
218
+ end
219
+
220
+ end
221
+