opengl 0.9.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +3 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +29 -0
  5. data/.gemtest +0 -0
  6. data/.gitignore +6 -0
  7. data/.travis.yml +19 -0
  8. data/History.rdoc +77 -0
  9. data/MIT-LICENSE +18 -0
  10. data/Manifest.txt +138 -0
  11. data/README.rdoc +102 -0
  12. data/Rakefile +60 -0
  13. data/examples/NeHe/NeHe.png +0 -0
  14. data/examples/NeHe/crate.png +0 -0
  15. data/examples/NeHe/glass.png +0 -0
  16. data/examples/NeHe/nehe_lesson02.rb +117 -0
  17. data/examples/NeHe/nehe_lesson03.rb +123 -0
  18. data/examples/NeHe/nehe_lesson04.rb +132 -0
  19. data/examples/NeHe/nehe_lesson05.rb +182 -0
  20. data/examples/NeHe/nehe_lesson06.rb +186 -0
  21. data/examples/NeHe/nehe_lesson07.rb +240 -0
  22. data/examples/NeHe/nehe_lesson08.rb +255 -0
  23. data/examples/NeHe/nehe_lesson09.rb +203 -0
  24. data/examples/NeHe/nehe_lesson11.rb +176 -0
  25. data/examples/NeHe/nehe_lesson12.rb +203 -0
  26. data/examples/NeHe/nehe_lesson16.rb +211 -0
  27. data/examples/NeHe/nehe_lesson19.rb +209 -0
  28. data/examples/NeHe/nehe_lesson36.rb +308 -0
  29. data/examples/NeHe/particle.png +0 -0
  30. data/examples/NeHe/star.png +0 -0
  31. data/examples/NeHe/tim.png +0 -0
  32. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  33. data/examples/OrangeBook/brick.frag +36 -0
  34. data/examples/OrangeBook/brick.rb +378 -0
  35. data/examples/OrangeBook/brick.vert +41 -0
  36. data/examples/OrangeBook/particle.frag +17 -0
  37. data/examples/OrangeBook/particle.rb +408 -0
  38. data/examples/OrangeBook/particle.vert +38 -0
  39. data/examples/README +16 -0
  40. data/examples/RedBook/aapoly.rb +143 -0
  41. data/examples/RedBook/aargb.rb +121 -0
  42. data/examples/RedBook/accanti.rb +164 -0
  43. data/examples/RedBook/accpersp.rb +217 -0
  44. data/examples/RedBook/alpha.rb +125 -0
  45. data/examples/RedBook/alpha3D.rb +160 -0
  46. data/examples/RedBook/bezcurve.rb +107 -0
  47. data/examples/RedBook/bezmesh.rb +139 -0
  48. data/examples/RedBook/checker.rb +126 -0
  49. data/examples/RedBook/clip.rb +97 -0
  50. data/examples/RedBook/colormat.rb +137 -0
  51. data/examples/RedBook/cube.rb +71 -0
  52. data/examples/RedBook/depthcue.rb +101 -0
  53. data/examples/RedBook/dof.rb +206 -0
  54. data/examples/RedBook/double.rb +107 -0
  55. data/examples/RedBook/drawf.rb +93 -0
  56. data/examples/RedBook/feedback.rb +147 -0
  57. data/examples/RedBook/fog.rb +168 -0
  58. data/examples/RedBook/font.rb +153 -0
  59. data/examples/RedBook/hello.rb +81 -0
  60. data/examples/RedBook/image.rb +139 -0
  61. data/examples/RedBook/jitter.rb +207 -0
  62. data/examples/RedBook/light.rb +155 -0
  63. data/examples/RedBook/lines.rb +130 -0
  64. data/examples/RedBook/list.rb +113 -0
  65. data/examples/RedBook/material.rb +276 -0
  66. data/examples/RedBook/mipmap.rb +158 -0
  67. data/examples/RedBook/model.rb +115 -0
  68. data/examples/RedBook/movelight.rb +134 -0
  69. data/examples/RedBook/pickdepth.rb +181 -0
  70. data/examples/RedBook/planet.rb +110 -0
  71. data/examples/RedBook/quadric.rb +160 -0
  72. data/examples/RedBook/robot.rb +117 -0
  73. data/examples/RedBook/select.rb +198 -0
  74. data/examples/RedBook/smooth.rb +97 -0
  75. data/examples/RedBook/stencil.rb +165 -0
  76. data/examples/RedBook/stroke.rb +169 -0
  77. data/examples/RedBook/surface.rb +168 -0
  78. data/examples/RedBook/teaambient.rb +134 -0
  79. data/examples/RedBook/teapots.rb +184 -0
  80. data/examples/RedBook/tess.rb +185 -0
  81. data/examples/RedBook/texbind.rb +149 -0
  82. data/examples/RedBook/texgen.rb +171 -0
  83. data/examples/RedBook/texturesurf.rb +130 -0
  84. data/examples/RedBook/varray.rb +161 -0
  85. data/examples/RedBook/wrap.rb +150 -0
  86. data/examples/misc/OGLBench.rb +338 -0
  87. data/examples/misc/anisotropic.rb +196 -0
  88. data/examples/misc/fbo_test.rb +357 -0
  89. data/examples/misc/font-glut.rb +47 -0
  90. data/examples/misc/glfwtest.rb +30 -0
  91. data/examples/misc/plane.rb +161 -0
  92. data/examples/misc/readpixel.rb +66 -0
  93. data/examples/misc/sdltest.rb +36 -0
  94. data/examples/misc/trislam.rb +829 -0
  95. data/ext/opengl/common.h +428 -0
  96. data/ext/opengl/conv.h +244 -0
  97. data/ext/opengl/extconf.rb +47 -0
  98. data/ext/opengl/funcdef.h +313 -0
  99. data/ext/opengl/gl-1.0-1.1.c +3075 -0
  100. data/ext/opengl/gl-1.2.c +155 -0
  101. data/ext/opengl/gl-1.3.c +443 -0
  102. data/ext/opengl/gl-1.4.c +348 -0
  103. data/ext/opengl/gl-1.5.c +224 -0
  104. data/ext/opengl/gl-2.0.c +667 -0
  105. data/ext/opengl/gl-2.1.c +57 -0
  106. data/ext/opengl/gl-3.0.c +493 -0
  107. data/ext/opengl/gl-enums.c +4873 -0
  108. data/ext/opengl/gl-enums.h +14588 -0
  109. data/ext/opengl/gl-error.c +112 -0
  110. data/ext/opengl/gl-error.h +28 -0
  111. data/ext/opengl/gl-ext-3dfx.c +27 -0
  112. data/ext/opengl/gl-ext-arb.c +875 -0
  113. data/ext/opengl/gl-ext-ati.c +41 -0
  114. data/ext/opengl/gl-ext-ext.c +889 -0
  115. data/ext/opengl/gl-ext-gremedy.c +41 -0
  116. data/ext/opengl/gl-ext-nv.c +680 -0
  117. data/ext/opengl/gl-types.h +67 -0
  118. data/ext/opengl/gl.c +220 -0
  119. data/ext/opengl/gl_buffer.c +177 -0
  120. data/ext/opengl/opengl.c +7 -0
  121. data/lib/gl.rb +1 -0
  122. data/lib/opengl.rb +53 -0
  123. data/lib/opengl/2.0/opengl.so +0 -0
  124. data/lib/opengl/2.1/opengl.so +0 -0
  125. data/lib/opengl/test_case.rb +86 -0
  126. data/test/dummy.xorg.conf +140 -0
  127. data/test/test_gl.rb +38 -0
  128. data/test/test_gl_10_11.rb +1363 -0
  129. data/test/test_gl_12.rb +71 -0
  130. data/test/test_gl_13.rb +221 -0
  131. data/test/test_gl_14.rb +218 -0
  132. data/test/test_gl_15.rb +258 -0
  133. data/test/test_gl_20.rb +417 -0
  134. data/test/test_gl_21.rb +436 -0
  135. data/test/test_gl_ext_arb.rb +508 -0
  136. data/test/test_gl_ext_ati.rb +28 -0
  137. data/test/test_gl_ext_ext.rb +608 -0
  138. data/test/test_gl_ext_gremedy.rb +29 -0
  139. data/test/test_gl_ext_nv.rb +349 -0
  140. data/test/test_opengl_buffer.rb +120 -0
  141. data/utils/README +6 -0
  142. data/utils/enumgen.rb +108 -0
  143. data/utils/extlistgen.rb +90 -0
  144. metadata +319 -0
  145. metadata.gz.sig +1 -0
@@ -0,0 +1,71 @@
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 setup
21
+ super
22
+ supported? 1.2
23
+ end
24
+
25
+ def test_glblend
26
+ glBlendColor(0.0, 1.0, 0.0, 1.0)
27
+ assert_equal(glGetDoublev(GL_BLEND_COLOR), [0, 1, 0, 1])
28
+
29
+ glBlendEquation(GL_MIN)
30
+ assert_equal(GL_MIN, glGetIntegerv(GL_BLEND_EQUATION))
31
+ glBlendEquation(GL_MAX)
32
+ assert_equal(GL_MAX, glGetIntegerv(GL_BLEND_EQUATION))
33
+ end
34
+
35
+ def test_gldrawrangeelements
36
+ va = [0, 0, 0, 1, 1, 1].pack("f*")
37
+ glVertexPointer(2, GL_FLOAT, 0, va)
38
+
39
+ buf = glFeedbackBuffer(256, GL_3D)
40
+ glRenderMode(GL_FEEDBACK)
41
+
42
+ glEnableClientState(GL_VERTEX_ARRAY)
43
+
44
+ glDrawRangeElements(GL_POINTS, 0, 2, 3, GL_UNSIGNED_BYTE, [0, 1, 2].pack("C*"))
45
+ count = glRenderMode(GL_RENDER)
46
+ assert_equal(12, count)
47
+
48
+ glDisableClientState(GL_VERTEX_ARRAY)
49
+ end
50
+
51
+ def test_texture_3D
52
+ image = ([0, 0, 0, 1, 1, 1] * 2 * 2).pack("f*")
53
+ image2 = ([1, 1, 1, 0, 0, 0] * 2 * 2).pack("f*")
54
+
55
+ textures = glGenTextures(1)
56
+ glBindTexture(GL_TEXTURE_3D, textures[0])
57
+
58
+ glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8, 2, 2, 2, 0, GL_RGB, GL_FLOAT, image)
59
+ assert_equal(image, glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT))
60
+
61
+ glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 2, 2, 2, GL_RGB, GL_FLOAT, image2)
62
+ assert_equal(image2, glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT))
63
+
64
+ glDrawPixels(2, 2, GL_RGB, GL_FLOAT, image)
65
+ glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 2, 2)
66
+ ti = glGetTexImage(GL_TEXTURE_3D, 0, GL_RGB, GL_FLOAT).unpack("f*")
67
+ assert_equal(([0]*3 + [1]*3) * 2 + ([1]*3 + [0]*3) * 2, ti)
68
+
69
+ glDeleteTextures(textures)
70
+ end
71
+ end
@@ -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 TestGl13 < OpenGL::TestCase
19
+
20
+ def setup
21
+ super
22
+ supported? 1.3
23
+ end
24
+
25
+ def test_glsamplecoverage
26
+ glSampleCoverage(0.0, GL_TRUE)
27
+ assert_equal(0.0, glGetDoublev(GL_SAMPLE_COVERAGE_VALUE))
28
+ assert_equal(GL_TRUE, glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT))
29
+ glSampleCoverage(1.0, GL_FALSE)
30
+ assert_equal(1.0, glGetDoublev(GL_SAMPLE_COVERAGE_VALUE))
31
+ assert_equal(GL_FALSE, glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT))
32
+ end
33
+
34
+ def test_multitexture
35
+ glActiveTexture(GL_TEXTURE1)
36
+ glClientActiveTexture(GL_TEXTURE2)
37
+ assert_equal(GL_TEXTURE1, glGetIntegerv(GL_ACTIVE_TEXTURE))
38
+ assert_equal(GL_TEXTURE2, glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE))
39
+ end
40
+
41
+ def test_transposematrix
42
+ m_a = [[1.0,2.0,3.0,4.0],
43
+ [0.0,2.0,0.0,0.0],
44
+ [0.0,0.0,2.0,0.0],
45
+ [0.0,0.0,0.0,2.0]]
46
+
47
+ m_b = [[1.0,2.0,3.0,4.0],
48
+ [0.0,3.0,0.0,0.0],
49
+ [0.0,0.0,3.0,0.0],
50
+ [0.0,0.0,0.0,3.0]]
51
+
52
+ glMatrixMode(GL_MODELVIEW)
53
+ glLoadTransposeMatrixf(m_a)
54
+ assert_equal(m_a, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
55
+
56
+ glLoadTransposeMatrixd(m_b)
57
+ assert_equal(m_b, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
58
+
59
+ glLoadIdentity()
60
+ glMultTransposeMatrixf(m_a)
61
+ assert_equal(m_a, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
62
+
63
+ glLoadIdentity()
64
+ glMultTransposeMatrixd(m_b)
65
+ assert_equal(m_b, glGetDoublev(GL_TRANSPOSE_MODELVIEW_MATRIX))
66
+
67
+ # 2
68
+ m = Matrix.rows([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]])
69
+ glMatrixMode(GL_MODELVIEW)
70
+ glLoadTransposeMatrixf(m)
71
+ assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
72
+ glLoadIdentity()
73
+ glLoadTransposeMatrixd(m)
74
+ assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
75
+ glLoadIdentity()
76
+ glMultTransposeMatrixf(m)
77
+ assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
78
+ glLoadIdentity()
79
+ glMultTransposeMatrixd(m)
80
+ assert_equal(m.to_a.transpose, glGetDoublev(GL_MODELVIEW_MATRIX))
81
+
82
+ assert_raises ArgumentError do glLoadTransposeMatrixf([1,2,3,4]) end
83
+ assert_raises ArgumentError do glLoadTransposeMatrixd([1,2,3,4]) end
84
+ assert_raises ArgumentError do glMultTransposeMatrixf([1,2,3,4]) end
85
+ assert_raises ArgumentError do glMultTransposeMatrixd([1,2,3,4]) end
86
+ end
87
+
88
+ def test_texturecompression
89
+ supported?("GL_EXT_texture_compression_s3tc")
90
+
91
+ # S3TC/DXT5 compressed 2x2 pixels stipple patterns [w,b,b,w] and [b,w,w,b]
92
+ image_1 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x54,0x5C,0x5C].pack("C*")
93
+ image_2 = [0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x54,0x01,0x0D,0x0D].pack("C*")
94
+
95
+ textures = glGenTextures(3)
96
+ glBindTexture(GL_TEXTURE_1D,textures[0])
97
+ glBindTexture(GL_TEXTURE_2D,textures[1])
98
+ glBindTexture(GL_TEXTURE_3D,textures[2])
99
+
100
+ # Note: 1D and 3D compressed textures are not supported by S3TC/DXTn, and usually not supported at all
101
+
102
+ # 1D
103
+ begin
104
+ glCompressedTexImage1D(GL_TEXTURE_1D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,4,0,16,image_1)
105
+ assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_1D,0))
106
+ rescue Gl::Error => err
107
+ assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
108
+ end
109
+
110
+ begin
111
+ glCompressedTexSubImage1D(GL_TEXTURE_1D,0,0,4,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,16,image_2)
112
+ assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_1D,0))
113
+ rescue Gl::Error => err
114
+ assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
115
+ end
116
+
117
+ # 2D
118
+ glCompressedTexImage2D(GL_TEXTURE_2D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,2,2,0,16,image_1)
119
+ assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_2D,0))
120
+
121
+ glCompressedTexSubImage2D(GL_TEXTURE_2D,0,0,0,2,2,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,16,image_2)
122
+ assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_2D,0))
123
+
124
+ # 3D
125
+ begin
126
+ glCompressedTexImage3D(GL_TEXTURE_3D,0,GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,2,2,1,0,16,image_1)
127
+ assert_equal(image_1, glGetCompressedTexImage(GL_TEXTURE_3D,0))
128
+ rescue Gl::Error => err
129
+ assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
130
+ end
131
+
132
+ begin
133
+ glCompressedTexSubImage3D(GL_TEXTURE_3D,0, 0,0,0, 2,2,1, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 16, image_2)
134
+ assert_equal(image_2, glGetCompressedTexImage(GL_TEXTURE_3D,0))
135
+ rescue Gl::Error => err
136
+ assert(err.id == GL_INVALID_ENUM || err.id == GL_INVALID_OPERATION)
137
+ end
138
+
139
+ glDeleteTextures(textures)
140
+
141
+ n = glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
142
+ if (n>0)
143
+ assert_equal(n, glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS).size)
144
+ end
145
+ end
146
+
147
+ def test_glmultitexcoord
148
+ glActiveTexture(GL_TEXTURE1)
149
+
150
+ # 1
151
+ glMultiTexCoord1d(GL_TEXTURE1, 1.0)
152
+ assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
153
+ glMultiTexCoord1dv(GL_TEXTURE1, [0.0])
154
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
155
+ glMultiTexCoord1f(GL_TEXTURE1, 1.0)
156
+ assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
157
+ glMultiTexCoord1fv(GL_TEXTURE1, [0.0])
158
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
159
+ glMultiTexCoord1i(GL_TEXTURE1, 1)
160
+ assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
161
+ glMultiTexCoord1iv(GL_TEXTURE1, [0])
162
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
163
+ glMultiTexCoord1s(GL_TEXTURE1, 1)
164
+ assert_equal([1,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
165
+ glMultiTexCoord1sv(GL_TEXTURE1, [0])
166
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
167
+ # 2
168
+ glMultiTexCoord2d(GL_TEXTURE1, 1.0,1.0)
169
+ assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
170
+ glMultiTexCoord2dv(GL_TEXTURE1, [0.0,0.0])
171
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
172
+ glMultiTexCoord2f(GL_TEXTURE1, 1.0,1.0)
173
+ assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
174
+ glMultiTexCoord2fv(GL_TEXTURE1, [0.0,0.0])
175
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
176
+ glMultiTexCoord2i(GL_TEXTURE1, 1,1)
177
+ assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
178
+ glMultiTexCoord2iv(GL_TEXTURE1, [0,0])
179
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
180
+ glMultiTexCoord2s(GL_TEXTURE1, 1,1)
181
+ assert_equal([1,1,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
182
+ glMultiTexCoord2sv(GL_TEXTURE1, [0,0])
183
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
184
+ # 3
185
+ glMultiTexCoord3d(GL_TEXTURE1, 1.0,1.0,1.0)
186
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
187
+ glMultiTexCoord3dv(GL_TEXTURE1, [0.0,0.0,0.0])
188
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
189
+ glMultiTexCoord3f(GL_TEXTURE1, 1.0,1.0,1.0)
190
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
191
+ glMultiTexCoord3fv(GL_TEXTURE1, [0.0,0.0,0.0])
192
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
193
+ glMultiTexCoord3i(GL_TEXTURE1, 1,1,1)
194
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
195
+ glMultiTexCoord3iv(GL_TEXTURE1, [0,0,0])
196
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
197
+ glMultiTexCoord3s(GL_TEXTURE1, 1,1,1)
198
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
199
+ glMultiTexCoord3sv(GL_TEXTURE1, [0,0,0])
200
+ assert_equal([0,0,0,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
201
+ # 4
202
+ glMultiTexCoord4d(GL_TEXTURE1, 1.0,1.0,1.0,1.0)
203
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
204
+ glMultiTexCoord4dv(GL_TEXTURE1, [0.0,0.0,0.0,0.0])
205
+ assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
206
+ glMultiTexCoord4f(GL_TEXTURE1, 1.0,1.0,1.0,1.0)
207
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
208
+ glMultiTexCoord4fv(GL_TEXTURE1, [0.0,0.0,0.0,0.0])
209
+ assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
210
+ glMultiTexCoord4i(GL_TEXTURE1, 1,1,1,1)
211
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
212
+ glMultiTexCoord4iv(GL_TEXTURE1, [0,0,0,0])
213
+ assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
214
+ glMultiTexCoord4s(GL_TEXTURE1, 1,1,1,1)
215
+ assert_equal([1,1,1,1], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
216
+ glMultiTexCoord4sv(GL_TEXTURE1, [0,0,0,0])
217
+ assert_equal([0,0,0,0], glGetDoublev(GL_CURRENT_TEXTURE_COORDS))
218
+
219
+ glActiveTexture(GL_TEXTURE0)
220
+ end
221
+ end
@@ -0,0 +1,218 @@
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
+ supported? 1.4
23
+ end
24
+
25
+ def test_arrays_2
26
+ sc = [0, 1, 0, 1, 0, 1].pack("f*")
27
+ fc = [1, 0].pack("f*")
28
+
29
+ glSecondaryColorPointer(3, GL_FLOAT, 12, sc)
30
+ assert_equal 3, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE)
31
+ assert_equal GL_FLOAT, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE)
32
+ assert_equal 12, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE)
33
+ assert_equal sc, glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER)
34
+
35
+ glFogCoordPointer(GL_FLOAT, 4, fc)
36
+ assert_equal GL_FLOAT, glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE)
37
+ assert_equal 4, glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE)
38
+ assert_equal fc, glGetPointerv(GL_FOG_COORD_ARRAY_POINTER)
39
+
40
+ glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
41
+ glEnableClientState(GL_FOG_COORD_ARRAY)
42
+
43
+ glBegin(GL_TRIANGLES)
44
+ glArrayElement(0)
45
+ glEnd()
46
+
47
+ assert_equal([0, 1, 0, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
48
+ assert_equal(1, glGetDoublev(GL_CURRENT_FOG_COORD))
49
+
50
+ glBegin(GL_TRIANGLES)
51
+ glArrayElement(1)
52
+ glEnd()
53
+
54
+ assert_equal([1, 0, 1, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
55
+ assert_equal(0, glGetDoublev(GL_CURRENT_FOG_COORD))
56
+
57
+ glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
58
+ glDisableClientState(GL_FOG_COORD_ARRAY)
59
+ end
60
+
61
+ def test_arrays_3
62
+ va = [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1].pack("f*")
63
+ glVertexPointer(2, GL_FLOAT, 0, va)
64
+
65
+ glEnableClientState(GL_VERTEX_ARRAY)
66
+
67
+ buf = glFeedbackBuffer(256, GL_3D)
68
+ glRenderMode(GL_FEEDBACK)
69
+
70
+ glMultiDrawArrays(GL_POLYGON, [0, 3], [3, 3])
71
+
72
+ i1 = [0, 1, 2].pack("C*")
73
+ i2 = [3, 4, 5].pack("C*")
74
+ glMultiDrawElements(GL_TRIANGLES, GL_UNSIGNED_BYTE, [i1, i2])
75
+
76
+ count = glRenderMode(GL_RENDER)
77
+ assert_equal(count, (3*3+2)*4)
78
+ glDisableClientState(GL_VERTEX_ARRAY)
79
+ end
80
+
81
+ def test_glblendfuncseparate
82
+ glBlendFuncSeparate(GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR)
83
+ assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_SRC_RGB))
84
+ assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_SRC_ALPHA))
85
+ assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_DST_RGB))
86
+ assert_equal(GL_SRC_COLOR, glGetIntegerv(GL_BLEND_DST_ALPHA))
87
+ end
88
+
89
+ def test_glpointparameter
90
+ glPointParameterf(GL_POINT_SIZE_MIN, 2.0)
91
+ assert_equal(2.0, glGetDoublev(GL_POINT_SIZE_MIN))
92
+
93
+ glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, [0, 1, 0])
94
+ assert_equal([0, 1, 0], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
95
+
96
+ glPointParameteri(GL_POINT_SIZE_MAX, 4)
97
+ assert_equal(4, glGetDoublev(GL_POINT_SIZE_MAX))
98
+
99
+ glPointParameteriv(GL_POINT_DISTANCE_ATTENUATION, [1, 0, 1])
100
+ assert_equal([1, 0, 1], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
101
+ end
102
+
103
+ def test_glfogcoord
104
+ glFogCoordf(2.0)
105
+ assert_equal(2.0, glGetDoublev(GL_CURRENT_FOG_COORD))
106
+ glFogCoordfv([3.0])
107
+ assert_equal(3.0, glGetDoublev(GL_CURRENT_FOG_COORD))
108
+
109
+ glFogCoordd(2.0)
110
+ assert_equal(2.0, glGetDoublev(GL_CURRENT_FOG_COORD))
111
+ glFogCoorddv([3.0])
112
+ assert_equal(3.0, glGetDoublev(GL_CURRENT_FOG_COORD))
113
+ end
114
+
115
+ def test_glsecondarycolor
116
+ glSecondaryColor3b(2**7-1, 0, 2**7-1)
117
+ assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
118
+
119
+ glSecondaryColor3bv([0, 2**7-1, 0])
120
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
121
+
122
+ glSecondaryColor3d(1.0, 0.0, 1.0)
123
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
124
+
125
+ glSecondaryColor3dv([0.0, 1.0, 0.0])
126
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
127
+
128
+ glSecondaryColor3f(1.0, 0.0, 1.0)
129
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
130
+
131
+ glSecondaryColor3fv([0.0, 1.0, 0.0])
132
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
133
+
134
+ glSecondaryColor3i(2**31-1, 0, 2**31-1)
135
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
136
+
137
+ glSecondaryColor3iv([0, 2**31-1, 0])
138
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
139
+
140
+ glSecondaryColor3s(2**15-1, 0, 2**15-1)
141
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
142
+
143
+ glSecondaryColor3sv([0, 2**15-1, 0])
144
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
145
+
146
+ glSecondaryColor3ub(2**8-1, 0, 2**8-1)
147
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
148
+
149
+ glSecondaryColor3ubv([0, 2**8-1, 0])
150
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
151
+
152
+ glSecondaryColor3ui(2**32-1, 0, 2**32-1)
153
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
154
+
155
+ glSecondaryColor3uiv([0, 2**32-1, 0])
156
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
157
+
158
+ glSecondaryColor3us(2**16-1, 0, 2**16-1)
159
+ assert_each_in_delta([1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
160
+
161
+ glSecondaryColor3usv([0, 2**16-1, 0])
162
+ assert_each_in_delta([0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
163
+ end
164
+
165
+ def test_glwindowpos_2
166
+ glLoadIdentity
167
+
168
+ glWindowPos2d 1.0, 2.0
169
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
170
+
171
+ glWindowPos2dv [2.0, 1.0]
172
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
173
+
174
+ glWindowPos2f 1.0, 2.0
175
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
176
+
177
+ glWindowPos2fv [2.0, 1.0]
178
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
179
+
180
+ glWindowPos2i 1, 2
181
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
182
+
183
+ glWindowPos2iv [2, 1]
184
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
185
+
186
+ glWindowPos2s 1, 2
187
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
188
+
189
+ glWindowPos2sv [2, 1]
190
+ assert_each_in_delta [2, 1, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
191
+ end
192
+
193
+ def test_glwindowspos_3
194
+ glWindowPos3d 1.0, 2.0, 0.5
195
+ assert_each_in_delta [1, 2, 0.5, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
196
+
197
+ glWindowPos3dv [3.0, 2.0, 1.0]
198
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
199
+
200
+ glWindowPos3f 1.0, 2.0, 0.5
201
+ assert_each_in_delta [1, 2, 0.5, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
202
+
203
+ glWindowPos3fv [3.0, 2.0, 1.0]
204
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
205
+
206
+ glWindowPos3i 1, 2, 0
207
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
208
+
209
+ glWindowPos3iv [3, 2, 1]
210
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
211
+
212
+ glWindowPos3s 1, 2, 0
213
+ assert_each_in_delta [1, 2, 0, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
214
+
215
+ glWindowPos3sv [3, 2, 1]
216
+ assert_each_in_delta [3, 2, 1, 1], glGetDoublev(GL_CURRENT_RASTER_POSITION)
217
+ end
218
+ end