danabr75-opengl 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.autotest +29 -0
- data/.gemtest +0 -0
- data/.gitignore +6 -0
- data/.travis.yml +19 -0
- data/Gemfile +8 -0
- data/History.md +101 -0
- data/MIT-LICENSE +18 -0
- data/Manifest.txt +142 -0
- data/README.rdoc +105 -0
- data/Rakefile +170 -0
- data/danabr75-opengl.gemspec +32 -0
- data/examples/NeHe/NeHe.png +0 -0
- data/examples/NeHe/crate.png +0 -0
- data/examples/NeHe/glass.png +0 -0
- data/examples/NeHe/nehe_lesson02.rb +117 -0
- data/examples/NeHe/nehe_lesson03.rb +123 -0
- data/examples/NeHe/nehe_lesson04.rb +132 -0
- data/examples/NeHe/nehe_lesson05.rb +182 -0
- data/examples/NeHe/nehe_lesson06.rb +186 -0
- data/examples/NeHe/nehe_lesson07.rb +240 -0
- data/examples/NeHe/nehe_lesson08.rb +255 -0
- data/examples/NeHe/nehe_lesson09.rb +203 -0
- data/examples/NeHe/nehe_lesson11.rb +176 -0
- data/examples/NeHe/nehe_lesson12.rb +203 -0
- data/examples/NeHe/nehe_lesson16.rb +211 -0
- data/examples/NeHe/nehe_lesson19.rb +209 -0
- data/examples/NeHe/nehe_lesson36.rb +308 -0
- data/examples/NeHe/particle.png +0 -0
- data/examples/NeHe/star.png +0 -0
- data/examples/NeHe/tim.png +0 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +378 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +408 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +16 -0
- data/examples/RedBook/aapoly.rb +143 -0
- data/examples/RedBook/aargb.rb +121 -0
- data/examples/RedBook/accanti.rb +164 -0
- data/examples/RedBook/accpersp.rb +217 -0
- data/examples/RedBook/alpha.rb +125 -0
- data/examples/RedBook/alpha3D.rb +160 -0
- data/examples/RedBook/bezcurve.rb +107 -0
- data/examples/RedBook/bezmesh.rb +139 -0
- data/examples/RedBook/checker.rb +126 -0
- data/examples/RedBook/clip.rb +97 -0
- data/examples/RedBook/colormat.rb +137 -0
- data/examples/RedBook/cube.rb +71 -0
- data/examples/RedBook/depthcue.rb +101 -0
- data/examples/RedBook/dof.rb +206 -0
- data/examples/RedBook/double.rb +107 -0
- data/examples/RedBook/drawf.rb +93 -0
- data/examples/RedBook/feedback.rb +147 -0
- data/examples/RedBook/fog.rb +168 -0
- data/examples/RedBook/font.rb +153 -0
- data/examples/RedBook/hello.rb +81 -0
- data/examples/RedBook/image.rb +139 -0
- data/examples/RedBook/jitter.rb +207 -0
- data/examples/RedBook/light.rb +157 -0
- data/examples/RedBook/lines.rb +130 -0
- data/examples/RedBook/list.rb +113 -0
- data/examples/RedBook/material.rb +276 -0
- data/examples/RedBook/mipmap.rb +158 -0
- data/examples/RedBook/model.rb +115 -0
- data/examples/RedBook/movelight.rb +134 -0
- data/examples/RedBook/pickdepth.rb +181 -0
- data/examples/RedBook/planet.rb +110 -0
- data/examples/RedBook/quadric.rb +160 -0
- data/examples/RedBook/robot.rb +117 -0
- data/examples/RedBook/select.rb +198 -0
- data/examples/RedBook/smooth.rb +97 -0
- data/examples/RedBook/stencil.rb +165 -0
- data/examples/RedBook/stroke.rb +169 -0
- data/examples/RedBook/surface.rb +168 -0
- data/examples/RedBook/teaambient.rb +134 -0
- data/examples/RedBook/teapots.rb +184 -0
- data/examples/RedBook/tess.rb +185 -0
- data/examples/RedBook/texbind.rb +149 -0
- data/examples/RedBook/texgen.rb +171 -0
- data/examples/RedBook/texturesurf.rb +130 -0
- data/examples/RedBook/varray.rb +161 -0
- data/examples/RedBook/wrap.rb +150 -0
- data/examples/misc/OGLBench.rb +338 -0
- data/examples/misc/anisotropic.rb +196 -0
- data/examples/misc/fbo_test.rb +357 -0
- data/examples/misc/font-glut.rb +47 -0
- data/examples/misc/glfwtest.rb +30 -0
- data/examples/misc/plane.rb +161 -0
- data/examples/misc/readpixel.rb +66 -0
- data/examples/misc/sdltest.rb +36 -0
- data/examples/misc/trislam.rb +829 -0
- data/ext/opengl/GL/gl.h +2115 -0
- data/ext/opengl/GL/glext.h +11770 -0
- data/ext/opengl/common.h +372 -0
- data/ext/opengl/conv.h +247 -0
- data/ext/opengl/extconf.rb +19 -0
- data/ext/opengl/fptr_struct.h +912 -0
- data/ext/opengl/funcdef.h +279 -0
- data/ext/opengl/gl-1.0-1.1.c +3345 -0
- data/ext/opengl/gl-1.2.c +155 -0
- data/ext/opengl/gl-1.3.c +447 -0
- data/ext/opengl/gl-1.4.c +346 -0
- data/ext/opengl/gl-1.5.c +225 -0
- data/ext/opengl/gl-2.0.c +665 -0
- data/ext/opengl/gl-2.1.c +57 -0
- data/ext/opengl/gl-3.0.c +502 -0
- data/ext/opengl/gl-enums.c +4853 -0
- data/ext/opengl/gl-enums.h +14528 -0
- data/ext/opengl/gl-error.c +110 -0
- data/ext/opengl/gl-error.h +25 -0
- data/ext/opengl/gl-ext-3dfx.c +27 -0
- data/ext/opengl/gl-ext-arb.c +880 -0
- data/ext/opengl/gl-ext-ati.c +41 -0
- data/ext/opengl/gl-ext-ext.c +885 -0
- data/ext/opengl/gl-ext-gremedy.c +41 -0
- data/ext/opengl/gl-ext-nv.c +679 -0
- data/ext/opengl/gl.c +265 -0
- data/ext/opengl/gl_buffer.c +202 -0
- data/ext/opengl/glimpl.c +187 -0
- data/ext/opengl/glimpl.h +47 -0
- data/ext/opengl/opengl.c +9 -0
- data/lib/gl.rb +1 -0
- data/lib/opengl.rb +79 -0
- data/lib/opengl/bindings_version.rb +4 -0
- data/lib/opengl/implementation.rb +38 -0
- data/lib/opengl/test_case.rb +86 -0
- data/test/dummy.xorg.conf +140 -0
- data/test/test_gl.rb +45 -0
- data/test/test_gl_10_11.rb +1363 -0
- data/test/test_gl_12.rb +71 -0
- data/test/test_gl_13.rb +221 -0
- data/test/test_gl_14.rb +218 -0
- data/test/test_gl_15.rb +258 -0
- data/test/test_gl_20.rb +417 -0
- data/test/test_gl_21.rb +436 -0
- data/test/test_gl_ext_arb.rb +508 -0
- data/test/test_gl_ext_ati.rb +28 -0
- data/test/test_gl_ext_ext.rb +608 -0
- data/test/test_gl_ext_gremedy.rb +29 -0
- data/test/test_gl_ext_nv.rb +349 -0
- data/test/test_glimpl.rb +23 -0
- data/test/test_opengl_buffer.rb +122 -0
- data/utils/README +6 -0
- data/utils/enumgen.rb +108 -0
- data/utils/extlistgen.rb +90 -0
- metadata +326 -0
@@ -0,0 +1,28 @@
|
|
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 TestGlExtAti < OpenGL::TestCase
|
19
|
+
|
20
|
+
def test_gl_ati_draw_buffers
|
21
|
+
supported? "GL_ATI_draw_buffers"
|
22
|
+
|
23
|
+
glDrawBuffersATI [GL_BACK_LEFT, GL_FRONT_LEFT]
|
24
|
+
|
25
|
+
assert_equal GL_BACK_LEFT, glGetIntegerv(GL_DRAW_BUFFER0)
|
26
|
+
assert_equal GL_FRONT_LEFT, glGetIntegerv(GL_DRAW_BUFFER1)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,608 @@
|
|
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 TestGlExtExt < OpenGL::TestCase
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
if Gl.is_available?("GL_EXT_framebuffer_object")
|
22
|
+
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0)
|
23
|
+
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0)
|
24
|
+
end
|
25
|
+
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_gl_ext_polygon_offset
|
30
|
+
supported?("GL_EXT_polygon_offset")
|
31
|
+
|
32
|
+
glPolygonOffsetEXT(1.0, 2.0)
|
33
|
+
assert_equal(1.0, glGetIntegerv(GL_POLYGON_OFFSET_FACTOR_EXT))
|
34
|
+
assert_equal(2.0, glGetIntegerv(GL_POLYGON_OFFSET_BIAS_EXT))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_gl_ext_framebuffer_object
|
38
|
+
supported?("GL_EXT_framebuffer_object")
|
39
|
+
t = glGenTextures(3)
|
40
|
+
glBindTexture(GL_TEXTURE_2D, t[0])
|
41
|
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, WINDOW_SIZE, WINDOW_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil)
|
42
|
+
|
43
|
+
glBindTexture(GL_TEXTURE_1D, t[1])
|
44
|
+
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, WINDOW_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil)
|
45
|
+
|
46
|
+
glBindTexture(GL_TEXTURE_3D, t[2])
|
47
|
+
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, WINDOW_SIZE, WINDOW_SIZE, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil)
|
48
|
+
|
49
|
+
fb = glGenFramebuffersEXT(1)
|
50
|
+
assert(fb.size==1)
|
51
|
+
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb[0])
|
52
|
+
assert_equal(true, glIsFramebufferEXT(fb[0]))
|
53
|
+
|
54
|
+
rb = glGenRenderbuffersEXT(1)
|
55
|
+
assert(rb.size==1)
|
56
|
+
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb[0])
|
57
|
+
assert_equal(true, glIsRenderbufferEXT(rb[0]))
|
58
|
+
|
59
|
+
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, WINDOW_SIZE, WINDOW_SIZE)
|
60
|
+
|
61
|
+
assert_equal WINDOW_SIZE, glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_WIDTH_EXT)
|
62
|
+
assert_equal WINDOW_SIZE, glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_HEIGHT_EXT)
|
63
|
+
assert_equal GL_DEPTH_COMPONENT24, glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_INTERNAL_FORMAT_EXT)
|
64
|
+
|
65
|
+
|
66
|
+
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb[0]);
|
67
|
+
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, t[0], 0)
|
68
|
+
|
69
|
+
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
|
70
|
+
assert(status == GL_FRAMEBUFFER_COMPLETE_EXT || status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
|
71
|
+
|
72
|
+
assert_equal GL_TEXTURE, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT)
|
73
|
+
|
74
|
+
glGenerateMipmapEXT(GL_TEXTURE_2D)
|
75
|
+
|
76
|
+
glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_1D, t[1], 0)
|
77
|
+
glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_3D, t[2], 0, 0)
|
78
|
+
|
79
|
+
glDeleteRenderbuffersEXT(rb)
|
80
|
+
glDeleteFramebuffersEXT(fb)
|
81
|
+
glDeleteTextures(t)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_gl_ext_gpu_program_parameters
|
85
|
+
supported?("GL_EXT_gpu_program_parameters")
|
86
|
+
|
87
|
+
glProgramEnvParameters4fvEXT(GL_VERTEX_PROGRAM_ARB, 1, [1, 2, 3, 4, 5, 6, 7, 8])
|
88
|
+
assert_equal([1, 2, 3, 4], glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB, 1))
|
89
|
+
assert_equal([5, 6, 7, 8], glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB, 2))
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_gl_ext_framebuffer_blit
|
93
|
+
supported?("GL_EXT_framebuffer_blit")
|
94
|
+
fbo = glGenFramebuffersEXT(2)
|
95
|
+
texture = glGenTextures(2)
|
96
|
+
data = [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0]
|
97
|
+
|
98
|
+
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo[0])
|
99
|
+
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo[1])
|
100
|
+
|
101
|
+
glBindTexture(GL_TEXTURE_2D, texture[0])
|
102
|
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.pack("C*"))
|
103
|
+
glGenerateMipmapEXT(GL_TEXTURE_2D);
|
104
|
+
|
105
|
+
glBindTexture(GL_TEXTURE_2D, texture[1])
|
106
|
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil)
|
107
|
+
glGenerateMipmapEXT(GL_TEXTURE_2D);
|
108
|
+
|
109
|
+
glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture[0], 0)
|
110
|
+
glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture[1], 0)
|
111
|
+
|
112
|
+
status = glCheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER_EXT)
|
113
|
+
assert_equal(GL_FRAMEBUFFER_COMPLETE_EXT, status)
|
114
|
+
status = glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT)
|
115
|
+
assert_equal(GL_FRAMEBUFFER_COMPLETE_EXT, status)
|
116
|
+
|
117
|
+
glBlitFramebufferEXT(0, 0, 2, 2,
|
118
|
+
0, 0, 2, 2,
|
119
|
+
GL_COLOR_BUFFER_BIT,
|
120
|
+
GL_NEAREST)
|
121
|
+
|
122
|
+
glBindTexture(GL_TEXTURE_2D, texture[1])
|
123
|
+
tex = glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE).unpack("C*")
|
124
|
+
assert_equal(data, tex)
|
125
|
+
|
126
|
+
glDeleteTextures(texture)
|
127
|
+
glDeleteFramebuffersEXT(fbo)
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_gl_ext_framebuffer_multisample
|
131
|
+
supported?("GL_EXT_framebuffer_multisample")
|
132
|
+
rb = glGenRenderbuffersEXT(1)[0]
|
133
|
+
|
134
|
+
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb)
|
135
|
+
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 4, GL_RGBA, 2, 2)
|
136
|
+
samples = glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT)
|
137
|
+
assert_equal(4, samples)
|
138
|
+
|
139
|
+
glDeleteRenderbuffersEXT(rb)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_gl_ext_pointparameter
|
143
|
+
supported?("GL_EXT_point_parameters")
|
144
|
+
glPointParameterfEXT(GL_POINT_SIZE_MIN, 1.0)
|
145
|
+
assert_equal(1.0, glGetDoublev(GL_POINT_SIZE_MIN))
|
146
|
+
|
147
|
+
glPointParameterfvEXT(GL_POINT_DISTANCE_ATTENUATION, [1, 0, 1])
|
148
|
+
assert_equal([1, 0, 1], glGetDoublev(GL_POINT_DISTANCE_ATTENUATION))
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_gl_ext_stencil_two_side
|
152
|
+
supported?("GL_EXT_stencil_two_side")
|
153
|
+
glActiveStencilFaceEXT(GL_FRONT)
|
154
|
+
assert_equal(GL_FRONT, glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT))
|
155
|
+
glActiveStencilFaceEXT(GL_BACK)
|
156
|
+
assert_equal(GL_BACK, glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT))
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_gl_ext_stencil_clear_tag
|
160
|
+
supported?("GL_EXT_stencil_clear_tag")
|
161
|
+
glStencilClearTagEXT(1, 2)
|
162
|
+
assert_equal(1, glGetIntegerv(GL_STENCIL_TAG_BITS_EXT))
|
163
|
+
assert_equal(2, glGetIntegerv(GL_STENCIL_CLEAR_TAG_VALUE_EXT))
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_gl_ext_secondary_color
|
167
|
+
supported?("GL_EXT_secondary_color")
|
168
|
+
|
169
|
+
glSecondaryColor3bEXT(2**7-1, 0, 2**7-1)
|
170
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
171
|
+
|
172
|
+
glSecondaryColor3bvEXT([0, 2**7-1, 0])
|
173
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
174
|
+
|
175
|
+
glSecondaryColor3dEXT(1.0, 0.0, 1.0)
|
176
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
177
|
+
|
178
|
+
glSecondaryColor3dvEXT([0.0, 1.0, 0.0])
|
179
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
180
|
+
|
181
|
+
glSecondaryColor3fEXT(1.0, 0.0, 1.0)
|
182
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
183
|
+
|
184
|
+
glSecondaryColor3fvEXT([0.0, 1.0, 0.0])
|
185
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
186
|
+
|
187
|
+
glSecondaryColor3iEXT(2**31-1, 0, 2**31-1)
|
188
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
189
|
+
|
190
|
+
glSecondaryColor3ivEXT([0, 2**31-1, 0])
|
191
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
192
|
+
|
193
|
+
glSecondaryColor3sEXT(2**15-1, 0, 2**15-1)
|
194
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
195
|
+
|
196
|
+
glSecondaryColor3svEXT([0, 2**15-1, 0])
|
197
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
198
|
+
|
199
|
+
glSecondaryColor3ubEXT(2**8-1, 0, 2**8-1)
|
200
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
201
|
+
|
202
|
+
glSecondaryColor3ubvEXT([0, 2**8-1, 0])
|
203
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
204
|
+
|
205
|
+
glSecondaryColor3uiEXT(2**32-1, 0, 2**32-1)
|
206
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
207
|
+
|
208
|
+
glSecondaryColor3uivEXT([0, 2**32-1, 0])
|
209
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
210
|
+
|
211
|
+
glSecondaryColor3usEXT(2**16-1, 0, 2**16-1)
|
212
|
+
assert_each_in_delta [1.0, 0.0, 1.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
213
|
+
|
214
|
+
glSecondaryColor3usvEXT([0, 2**16-1, 0])
|
215
|
+
assert_each_in_delta [0.0, 1.0, 0.0, 1.0], glGetDoublev(GL_CURRENT_SECONDARY_COLOR)
|
216
|
+
|
217
|
+
sc = [0, 1, 0, 1, 0, 1].pack("f*")
|
218
|
+
|
219
|
+
glSecondaryColorPointerEXT(3, GL_FLOAT, 12, sc)
|
220
|
+
assert_equal 3, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE)
|
221
|
+
assert_equal GL_FLOAT, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE)
|
222
|
+
assert_equal 12, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE)
|
223
|
+
assert_equal sc, glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER)
|
224
|
+
glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
|
225
|
+
|
226
|
+
glBegin(GL_TRIANGLES)
|
227
|
+
glArrayElement(0)
|
228
|
+
glEnd()
|
229
|
+
|
230
|
+
assert_equal([0, 1, 0, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
|
231
|
+
|
232
|
+
glBegin(GL_TRIANGLES)
|
233
|
+
glArrayElement(1)
|
234
|
+
glEnd()
|
235
|
+
|
236
|
+
assert_equal([1, 0, 1, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
|
237
|
+
|
238
|
+
glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
|
239
|
+
end
|
240
|
+
|
241
|
+
def test_gl_ext_blend_color
|
242
|
+
supported?("GL_EXT_blend_color")
|
243
|
+
glBlendColorEXT(1.0, 0.0, 1.0, 0.0)
|
244
|
+
assert_equal([1, 0, 1, 0], glGetFloatv(GL_BLEND_COLOR_EXT))
|
245
|
+
glBlendColorEXT(0.0, 1.0, 0.0, 1.0)
|
246
|
+
assert_equal([0, 1, 0, 1], glGetFloatv(GL_BLEND_COLOR_EXT))
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_gl_ext_blend_minmax
|
250
|
+
supported?("GL_EXT_blend_minmax")
|
251
|
+
glBlendEquationEXT(GL_MIN_EXT)
|
252
|
+
assert_equal(GL_MIN_EXT, glGetIntegerv(GL_BLEND_EQUATION_EXT))
|
253
|
+
glBlendEquationEXT(GL_MAX_EXT)
|
254
|
+
assert_equal(GL_MAX_EXT, glGetIntegerv(GL_BLEND_EQUATION_EXT))
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_gl_ext_blend_func_separate
|
258
|
+
supported?("GL_EXT_blend_func_separate")
|
259
|
+
glBlendFuncSeparateEXT(GL_ZERO, GL_ONE, GL_ZERO, GL_ONE)
|
260
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_BLEND_SRC_RGB_EXT))
|
261
|
+
assert_equal(GL_ONE, glGetIntegerv(GL_BLEND_DST_RGB_EXT))
|
262
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_BLEND_SRC_ALPHA_EXT))
|
263
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA_EXT), GL_ONE)
|
264
|
+
glBlendFuncSeparateEXT(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO)
|
265
|
+
assert_equal(GL_ONE, glGetIntegerv(GL_BLEND_SRC_RGB_EXT))
|
266
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_BLEND_DST_RGB_EXT))
|
267
|
+
assert_equal(GL_ONE, glGetIntegerv(GL_BLEND_SRC_ALPHA_EXT))
|
268
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_BLEND_DST_ALPHA_EXT))
|
269
|
+
end
|
270
|
+
|
271
|
+
def test_gl_ext_blend_equation_separate
|
272
|
+
supported?("GL_EXT_blend_equation_separate")
|
273
|
+
glBlendEquationSeparateEXT(GL_FUNC_ADD, GL_FUNC_SUBTRACT)
|
274
|
+
assert_equal(GL_FUNC_ADD, glGetIntegerv(GL_BLEND_EQUATION_RGB_EXT))
|
275
|
+
assert_equal(GL_FUNC_SUBTRACT, glGetIntegerv(GL_BLEND_EQUATION_ALPHA_EXT))
|
276
|
+
glBlendEquationSeparateEXT(GL_FUNC_SUBTRACT, GL_FUNC_ADD)
|
277
|
+
assert_equal(GL_FUNC_SUBTRACT, glGetIntegerv(GL_BLEND_EQUATION_RGB_EXT))
|
278
|
+
assert_equal(GL_FUNC_ADD, glGetIntegerv(GL_BLEND_EQUATION_ALPHA_EXT))
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_gl_ext_depth_bounds_test
|
282
|
+
supported?("GL_EXT_depth_bounds_test")
|
283
|
+
glDepthBoundsEXT(0.2, 0.8)
|
284
|
+
assert_each_in_delta [0.2, 0.8], glGetDoublev(GL_DEPTH_BOUNDS_EXT)
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_gl_ext_timer_query
|
288
|
+
supported?("GL_EXT_timer_query")
|
289
|
+
queries = glGenQueries(2)
|
290
|
+
glBeginQuery(GL_TIME_ELAPSED_EXT, queries[0])
|
291
|
+
glBegin(GL_QUADS)
|
292
|
+
glVertex2i(0, 0)
|
293
|
+
glVertex2i(0, 1)
|
294
|
+
glVertex2i(1, 1)
|
295
|
+
glVertex2i(1, 0)
|
296
|
+
glEnd
|
297
|
+
glEndQuery(GL_TIME_ELAPSED_EXT)
|
298
|
+
|
299
|
+
while glGetQueryObjectiv(queries[0], GL_QUERY_RESULT_AVAILABLE)==GL_FALSE
|
300
|
+
#
|
301
|
+
end
|
302
|
+
assert(glGetQueryObjecti64vEXT(queries[0], GL_QUERY_RESULT)>0)
|
303
|
+
assert(glGetQueryObjectui64vEXT(queries[0], GL_QUERY_RESULT)>0)
|
304
|
+
|
305
|
+
glDeleteQueries(queries)
|
306
|
+
end
|
307
|
+
|
308
|
+
def test_gl_ext_texture_object
|
309
|
+
supported?("GL_EXT_texture_object")
|
310
|
+
textures = glGenTexturesEXT(2)
|
311
|
+
glBindTextureEXT(GL_TEXTURE_1D, textures[0])
|
312
|
+
glBindTextureEXT(GL_TEXTURE_2D, textures[1])
|
313
|
+
assert_equal(true, glIsTextureEXT(textures[0]))
|
314
|
+
assert_equal(2, glAreTexturesResidentEXT(textures).size)
|
315
|
+
|
316
|
+
glPrioritizeTexturesEXT(textures, [0.5, 1.0])
|
317
|
+
assert_equal(0.5, glGetTexParameterfv(GL_TEXTURE_1D, GL_TEXTURE_PRIORITY))
|
318
|
+
assert_equal(1.0, glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY))
|
319
|
+
|
320
|
+
glDeleteTexturesEXT(textures)
|
321
|
+
assert_equal(false, glIsTextureEXT(textures[0]))
|
322
|
+
end
|
323
|
+
|
324
|
+
def test_gl_ext_compiled_vertex_array
|
325
|
+
supported?("GL_EXT_compiled_vertex_array")
|
326
|
+
glLockArraysEXT(1, 2)
|
327
|
+
assert_equal(1, glGetIntegerv(GL_ARRAY_ELEMENT_LOCK_FIRST_EXT))
|
328
|
+
assert_equal(2, glGetIntegerv(GL_ARRAY_ELEMENT_LOCK_COUNT_EXT))
|
329
|
+
glUnlockArraysEXT()
|
330
|
+
end
|
331
|
+
|
332
|
+
def test_gl_ext_fogcoord
|
333
|
+
supported?("GL_EXT_fog_coord")
|
334
|
+
|
335
|
+
glFogCoordfEXT(2.0)
|
336
|
+
assert_equal 2.0, glGetDoublev(GL_CURRENT_FOG_COORD)
|
337
|
+
glFogCoordfvEXT([3.0])
|
338
|
+
assert_equal 3.0, glGetDoublev(GL_CURRENT_FOG_COORD)
|
339
|
+
|
340
|
+
glFogCoorddEXT(2.0)
|
341
|
+
assert_equal 2.0, glGetDoublev(GL_CURRENT_FOG_COORD)
|
342
|
+
glFogCoorddvEXT([3.0])
|
343
|
+
assert_equal 3.0, glGetDoublev(GL_CURRENT_FOG_COORD)
|
344
|
+
|
345
|
+
fc = [1, 0].pack("f*")
|
346
|
+
glFogCoordPointerEXT(GL_FLOAT, 4, fc)
|
347
|
+
assert_equal GL_FLOAT, glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE)
|
348
|
+
assert_equal 4, glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE)
|
349
|
+
assert_equal fc, glGetPointerv(GL_FOG_COORD_ARRAY_POINTER)
|
350
|
+
|
351
|
+
glEnableClientState(GL_FOG_COORD_ARRAY)
|
352
|
+
|
353
|
+
glBegin(GL_TRIANGLES)
|
354
|
+
glArrayElement(0)
|
355
|
+
glEnd()
|
356
|
+
|
357
|
+
assert_equal 1, glGetDoublev(GL_CURRENT_FOG_COORD)
|
358
|
+
|
359
|
+
glBegin(GL_TRIANGLES)
|
360
|
+
glArrayElement(1)
|
361
|
+
glEnd()
|
362
|
+
|
363
|
+
assert_equal 0, glGetDoublev(GL_CURRENT_FOG_COORD)
|
364
|
+
|
365
|
+
glDisableClientState(GL_FOG_COORD_ARRAY)
|
366
|
+
end
|
367
|
+
|
368
|
+
def test_gl_ext_multi_draw_arrays
|
369
|
+
supported?("GL_EXT_multi_draw_arrays")
|
370
|
+
va = [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1].pack("f*")
|
371
|
+
glVertexPointer(2, GL_FLOAT, 0, va)
|
372
|
+
|
373
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
374
|
+
|
375
|
+
buf = glFeedbackBuffer(256, GL_3D)
|
376
|
+
glRenderMode(GL_FEEDBACK)
|
377
|
+
|
378
|
+
glMultiDrawArraysEXT(GL_POLYGON, [0, 3], [3, 3])
|
379
|
+
|
380
|
+
i1 = [0, 1, 2].pack("C*")
|
381
|
+
i2 = [3, 4, 5].pack("C*")
|
382
|
+
glMultiDrawElementsEXT(GL_TRIANGLES, GL_UNSIGNED_BYTE, [i1, i2])
|
383
|
+
|
384
|
+
count = glRenderMode(GL_RENDER)
|
385
|
+
assert_equal(count, (3*3+2)*4)
|
386
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
387
|
+
end
|
388
|
+
|
389
|
+
def test_gl_ext_drawrangeelements
|
390
|
+
supported?("GL_EXT_draw_range_elements")
|
391
|
+
va = [0, 0, 0, 1, 1, 1].pack("f*")
|
392
|
+
glVertexPointer(2, GL_FLOAT, 0, va)
|
393
|
+
|
394
|
+
buf = glFeedbackBuffer(256, GL_3D)
|
395
|
+
glRenderMode(GL_FEEDBACK)
|
396
|
+
|
397
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
398
|
+
|
399
|
+
glDrawRangeElementsEXT(GL_POINTS, 0, 2, 3, GL_UNSIGNED_BYTE, [0, 1, 2].pack("C*"))
|
400
|
+
count = glRenderMode(GL_RENDER)
|
401
|
+
assert_equal(12, count)
|
402
|
+
|
403
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
404
|
+
end
|
405
|
+
|
406
|
+
def test_gl_ext_geometry_shader4
|
407
|
+
supported?("GL_EXT_geometry_shader4")
|
408
|
+
program = glCreateProgramObjectARB()
|
409
|
+
|
410
|
+
glProgramParameteriEXT(program, GL_GEOMETRY_INPUT_TYPE_EXT , GL_LINES_ADJACENCY_EXT)
|
411
|
+
assert_equal(GL_LINES_ADJACENCY_EXT, glGetObjectParameterivARB(program, GL_GEOMETRY_INPUT_TYPE_EXT))
|
412
|
+
|
413
|
+
glDeleteObjectARB(program)
|
414
|
+
end
|
415
|
+
|
416
|
+
def test_gl_ext_gpu_shader4
|
417
|
+
supported?(["GL_EXT_gpu_shader4", "GL_ARB_vertex_program"])
|
418
|
+
|
419
|
+
programs = glGenProgramsARB(1)
|
420
|
+
program = "!!ARBvp1.0\nTEMP vv;\nEND"
|
421
|
+
|
422
|
+
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, programs[0])
|
423
|
+
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, program)
|
424
|
+
|
425
|
+
glVertexAttribI1iEXT(1, 1)
|
426
|
+
assert_equal(1, glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0])
|
427
|
+
glVertexAttribI1uiEXT(1, 2)
|
428
|
+
assert_equal(2, glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0])
|
429
|
+
glVertexAttribI1ivEXT(1, [3])
|
430
|
+
assert_equal(3, glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0])
|
431
|
+
glVertexAttribI1uivEXT(1, [4])
|
432
|
+
assert_equal(4, glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0])
|
433
|
+
|
434
|
+
glVertexAttribI2iEXT(1, 1, 2)
|
435
|
+
assert_equal([1, 2], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
436
|
+
glVertexAttribI2uiEXT(1, 2, 3)
|
437
|
+
assert_equal([2, 3], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
438
|
+
glVertexAttribI2ivEXT(1, [3, 4])
|
439
|
+
assert_equal([3, 4], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
440
|
+
glVertexAttribI2uivEXT(1, [4, 5])
|
441
|
+
assert_equal([4, 5], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 2])
|
442
|
+
|
443
|
+
glVertexAttribI3iEXT(1, 1, 2, 3)
|
444
|
+
assert_equal([1, 2, 3], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
445
|
+
glVertexAttribI3uiEXT(1, 2, 3, 4)
|
446
|
+
assert_equal([2, 3, 4], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
447
|
+
glVertexAttribI3ivEXT(1, [3, 4, 5])
|
448
|
+
assert_equal([3, 4, 5], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
449
|
+
glVertexAttribI3uivEXT(1, [4, 5, 6])
|
450
|
+
assert_equal([4, 5, 6], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)[0, 3])
|
451
|
+
|
452
|
+
glVertexAttribI4iEXT(1, 1, 2, 3, 4)
|
453
|
+
assert_equal [1, 2, 3, 4], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
454
|
+
glVertexAttribI4uiEXT(1, 2, 3, 4, 5)
|
455
|
+
assert_equal [2, 3, 4, 5], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
456
|
+
glVertexAttribI4ivEXT(1, [3, 4, 5, 6])
|
457
|
+
assert_equal [3, 4, 5, 6], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
458
|
+
glVertexAttribI4uivEXT(1, [4, 5, 6, 7])
|
459
|
+
assert_equal [4, 5, 6, 7], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
460
|
+
|
461
|
+
glVertexAttribI4bvEXT(1, [1, 2, 3, 4])
|
462
|
+
assert_equal [1, 2, 3, 4], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
463
|
+
glVertexAttribI4svEXT(1, [2, 3, 4, 5])
|
464
|
+
assert_equal [2, 3, 4, 5], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
465
|
+
glVertexAttribI4ubvEXT(1, [1, 2, 3, 4])
|
466
|
+
assert_equal [1, 2, 3, 4], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
467
|
+
glVertexAttribI4usvEXT(1, [2, 3, 4, 5])
|
468
|
+
assert_equal [2, 3, 4, 5], glGetVertexAttribIivEXT(1, GL_CURRENT_VERTEX_ATTRIB_ARB)
|
469
|
+
|
470
|
+
glVertexAttribIPointerEXT(1, 2, GL_INT, 0, [1, 1].pack("i*"))
|
471
|
+
assert_equal [1, 1].pack("i*"), glGetVertexAttribPointervARB(1)
|
472
|
+
|
473
|
+
glDeleteProgramsARB(programs)
|
474
|
+
end
|
475
|
+
|
476
|
+
def test_gl_ext_gpu_shader4_2
|
477
|
+
supported?(["GL_EXT_gpu_shader4", "GL_ARB_shader_objects"])
|
478
|
+
|
479
|
+
vertex_shader_source = <<-SHADER
|
480
|
+
uniform int testivec1;
|
481
|
+
uniform ivec2 testivec2;
|
482
|
+
uniform ivec3 testivec3;
|
483
|
+
uniform ivec4 testivec4;
|
484
|
+
void main() {
|
485
|
+
testivec1;
|
486
|
+
testivec2;
|
487
|
+
testivec3;
|
488
|
+
testivec4;
|
489
|
+
|
490
|
+
gl_Position = ftransform();
|
491
|
+
}
|
492
|
+
SHADER
|
493
|
+
|
494
|
+
program = glCreateProgramObjectARB()
|
495
|
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
496
|
+
glShaderSourceARB(vs, vertex_shader_source)
|
497
|
+
|
498
|
+
glCompileShaderARB(vs)
|
499
|
+
assert(glGetObjectParameterivARB(vs, GL_OBJECT_COMPILE_STATUS_ARB),
|
500
|
+
glGetInfoLogARB(vs))
|
501
|
+
|
502
|
+
glAttachObjectARB(program, vs)
|
503
|
+
glLinkProgramARB(program)
|
504
|
+
assert glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB)
|
505
|
+
glUseProgramObjectARB(program)
|
506
|
+
|
507
|
+
tv1il = glGetUniformLocation program, "testivec1"
|
508
|
+
refute_equal(-1, tv1il, "testivec1 missing!")
|
509
|
+
|
510
|
+
tv2il = glGetUniformLocation program, "testivec2"
|
511
|
+
refute_equal(-1, tv2il, "testivec2 missing!")
|
512
|
+
|
513
|
+
tv3il = glGetUniformLocation program, "testivec3"
|
514
|
+
refute_equal(-1, tv3il, "testivec3 missing!")
|
515
|
+
|
516
|
+
tv4il = glGetUniformLocation program, "testivec4"
|
517
|
+
refute_equal(-1, tv4il, "testivec4 missing!")
|
518
|
+
|
519
|
+
skip "glGetUniformLocation is broken" if
|
520
|
+
glGetActiveUniform(program, tv1il).last != "testivec1"
|
521
|
+
|
522
|
+
skip "glGetUniformLocation is broken" if
|
523
|
+
glGetActiveUniform(program, tv2il).last != "testivec2"
|
524
|
+
|
525
|
+
skip "glGetUniformLocation is broken" if
|
526
|
+
glGetActiveUniform(program, tv3il).last != "testivec3"
|
527
|
+
|
528
|
+
skip "glGetUniformLocation is broken" if
|
529
|
+
glGetActiveUniform(program, tv4il).last != "testivec4"
|
530
|
+
|
531
|
+
skip "can't find documentation for glUniform1uiEXT"
|
532
|
+
glUniform1uiEXT(tv1il, 3)
|
533
|
+
assert_equal 3, glGetUniformuivEXT(program, tv1il)
|
534
|
+
|
535
|
+
glUniform1uivEXT(tv1il, [4])
|
536
|
+
assert_equal 4, glGetUniformuivEXT(program, tv1il)
|
537
|
+
|
538
|
+
glUniform2uiEXT(tv2il, 1, 2)
|
539
|
+
assert_equal [1, 2], glGetUniformuivEXT(program, tv2il)
|
540
|
+
|
541
|
+
glUniform2uivEXT(tv2il, [3, 4])
|
542
|
+
assert_equal [3, 4], glGetUniformuivEXT(program, tv2il)
|
543
|
+
|
544
|
+
glUniform3uiEXT(tv3il, 1, 2, 3)
|
545
|
+
assert_equal [1, 2, 3], glGetUniformuivEXT(program, tv3il)
|
546
|
+
|
547
|
+
glUniform3uivEXT(tv3il, [3, 4, 5])
|
548
|
+
assert_equal [3, 4, 5], glGetUniformuivEXT(program, tv3il)
|
549
|
+
|
550
|
+
glUniform4uiEXT(tv4il, 1, 2, 3, 4)
|
551
|
+
assert_equal [1, 2, 3, 4], glGetUniformuivEXT(program, tv4il)
|
552
|
+
|
553
|
+
glUniform4uivEXT(tv4il, [3, 4, 5, 6])
|
554
|
+
assert_equal [3, 4, 5, 6], glGetUniformuivEXT(program, tv4il)
|
555
|
+
|
556
|
+
glBindFragDataLocationEXT(program, 1, "test")
|
557
|
+
assert_equal(-1, glGetFragDataLocationEXT(program, "test"))
|
558
|
+
end
|
559
|
+
|
560
|
+
def test_gl_ext_draw_instanced
|
561
|
+
supported?("GL_EXT_draw_instanced")
|
562
|
+
|
563
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
564
|
+
|
565
|
+
va = [0, 0, 0, 1, 1, 1].pack("f*")
|
566
|
+
glVertexPointer(2, GL_FLOAT, 0, va)
|
567
|
+
|
568
|
+
buf = glFeedbackBuffer(256, GL_3D)
|
569
|
+
glRenderMode(GL_FEEDBACK)
|
570
|
+
|
571
|
+
glDrawArraysInstancedEXT(GL_TRIANGLES, 0, 3, 2)
|
572
|
+
|
573
|
+
glDrawElementsInstancedEXT(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, [0, 1, 2].pack("C*"), 2)
|
574
|
+
count = glRenderMode(GL_RENDER)
|
575
|
+
assert_equal(2*2*11, count)
|
576
|
+
|
577
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
578
|
+
end
|
579
|
+
|
580
|
+
def test_gl_ext_texture_buffer_object
|
581
|
+
supported?("GL_EXT_texture_buffer_object")
|
582
|
+
|
583
|
+
buf = glGenBuffers(1)[0]
|
584
|
+
glBindBuffer(GL_TEXTURE_BUFFER_EXT, buf)
|
585
|
+
|
586
|
+
tex = glGenTextures(1)[0]
|
587
|
+
glBindTexture(GL_TEXTURE_BUFFER_EXT, tex)
|
588
|
+
glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA32F_ARB, buf)
|
589
|
+
|
590
|
+
assert_equal(tex, glGetIntegerv(GL_TEXTURE_BINDING_BUFFER_EXT))
|
591
|
+
assert_equal(GL_RGBA32F_ARB, glGetIntegerv(GL_TEXTURE_BUFFER_FORMAT_EXT))
|
592
|
+
|
593
|
+
glDeleteBuffers(buf)
|
594
|
+
glDeleteTextures(tex)
|
595
|
+
end
|
596
|
+
|
597
|
+
def test_gl_ext_texture_integer
|
598
|
+
supported?("GL_EXT_texture_integer")
|
599
|
+
|
600
|
+
glClearColorIiEXT(1, 2, 3, 4)
|
601
|
+
glClearColorIuiEXT(1, 2, 3, 4)
|
602
|
+
|
603
|
+
glTexParameterIivEXT(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, [1, 2, 3, 4])
|
604
|
+
assert_equal([1, 2, 3, 4], glGetTexParameterIivEXT(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR))
|
605
|
+
glTexParameterIuivEXT(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, [5, 6, 7, 8])
|
606
|
+
assert_equal([5, 6, 7, 8], glGetTexParameterIuivEXT(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR))
|
607
|
+
end
|
608
|
+
end
|