ruby-opengl 0.50.0 → 0.60.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +15 -11
- data/doc/build_install.txt +10 -6
- data/doc/extensions.txt.in +348 -0
- data/doc/history.txt +4 -0
- data/doc/roadmap.txt +4 -6
- data/doc/scientific_use.txt +7 -0
- data/doc/supplies/page_template.html +2 -1
- data/doc/thanks.txt +5 -0
- data/doc/tutorial.txt +431 -121
- data/examples/NeHe/nehe_lesson02.rb +1 -1
- data/examples/NeHe/nehe_lesson03.rb +1 -1
- data/examples/NeHe/nehe_lesson04.rb +1 -1
- data/examples/NeHe/nehe_lesson05.rb +1 -1
- data/examples/NeHe/nehe_lesson36.rb +1 -1
- data/examples/OrangeBook/brick.rb +3 -15
- data/examples/OrangeBook/particle.rb +2 -20
- data/examples/RedBook/aapoly.rb +1 -1
- data/examples/RedBook/aargb.rb +2 -2
- data/examples/RedBook/accanti.rb +1 -1
- data/examples/RedBook/accpersp.rb +1 -1
- data/examples/RedBook/alpha.rb +2 -2
- data/examples/RedBook/alpha3D.rb +1 -1
- data/examples/RedBook/bezcurve.rb +1 -1
- data/examples/RedBook/bezmesh.rb +1 -1
- data/examples/RedBook/checker.rb +1 -1
- data/examples/RedBook/clip.rb +1 -1
- data/examples/RedBook/colormat.rb +1 -1
- data/examples/RedBook/cube.rb +1 -1
- data/examples/RedBook/depthcue.rb +1 -1
- data/examples/RedBook/dof.rb +1 -1
- data/examples/RedBook/double.rb +1 -1
- data/examples/RedBook/drawf.rb +1 -1
- data/examples/RedBook/feedback.rb +1 -1
- data/examples/RedBook/fog.rb +1 -1
- data/examples/RedBook/font.rb +2 -2
- data/examples/RedBook/hello.rb +1 -1
- data/examples/RedBook/image.rb +4 -4
- data/examples/RedBook/lines.rb +1 -1
- data/examples/RedBook/list.rb +1 -1
- data/examples/RedBook/material.rb +1 -1
- data/examples/RedBook/mipmap.rb +1 -1
- data/examples/RedBook/model.rb +1 -1
- data/examples/RedBook/movelight.rb +1 -1
- data/examples/RedBook/pickdepth.rb +1 -1
- data/examples/RedBook/planet.rb +5 -5
- data/examples/RedBook/quadric.rb +1 -1
- data/examples/RedBook/robot.rb +5 -5
- data/examples/RedBook/select.rb +1 -1
- data/examples/RedBook/smooth.rb +1 -1
- data/examples/RedBook/stencil.rb +1 -1
- data/examples/RedBook/stroke.rb +2 -2
- data/examples/RedBook/surface.rb +1 -1
- data/examples/RedBook/teaambient.rb +1 -1
- data/examples/RedBook/teapots.rb +1 -1
- data/examples/RedBook/tess.rb +1 -1
- data/examples/RedBook/texbind.rb +1 -1
- data/examples/RedBook/texgen.rb +5 -5
- data/examples/RedBook/texturesurf.rb +1 -1
- data/examples/RedBook/varray.rb +1 -1
- data/examples/RedBook/wrap.rb +5 -5
- data/examples/misc/OGLBench.rb +337 -0
- data/examples/misc/anisotropic.rb +1 -1
- data/examples/misc/fbo_test.rb +356 -0
- data/examples/misc/font-glut.rb +1 -1
- data/examples/misc/glfwtest.rb +30 -0
- data/examples/misc/md2model.rb +15 -0
- data/examples/misc/plane.rb +1 -1
- data/examples/misc/readpixel.rb +1 -1
- data/examples/misc/sdltest.rb +34 -0
- data/examples/misc/trislam.rb +828 -0
- data/ext/common/common.h +126 -218
- data/ext/common/conv.h +244 -0
- data/ext/common/funcdef.h +280 -0
- data/ext/common/gl-error.h +23 -0
- data/ext/common/gl-types.h +14 -0
- data/ext/gl/gl-1.0-1.1.c +497 -1255
- data/ext/gl/gl-1.2.c +121 -304
- data/ext/gl/gl-1.3.c +78 -339
- data/ext/gl/gl-1.4.c +102 -164
- data/ext/gl/gl-1.5.c +42 -173
- data/ext/gl/gl-2.0.c +273 -1039
- data/ext/gl/gl-2.1.c +15 -19
- data/ext/gl/gl-enums.c +3 -2
- data/ext/gl/gl-error.c +104 -0
- data/ext/gl/gl-ext-3dfx.c +27 -0
- data/ext/gl/gl-ext-arb.c +812 -12
- data/ext/gl/gl-ext-ati.c +41 -0
- data/ext/gl/gl-ext-ext.c +791 -119
- data/ext/gl/gl-ext-gremedy.c +41 -0
- data/ext/gl/gl-ext-nv.c +679 -0
- data/ext/gl/gl.c +48 -28
- data/ext/gl/mkrf_conf.rb +13 -10
- data/ext/glu/glu-enums.c +3 -2
- data/ext/glu/glu.c +136 -41
- data/ext/glu/mkrf_conf.rb +15 -12
- data/ext/glut/glut.c +37 -80
- data/ext/glut/mkrf_conf.rb +17 -13
- data/lib/opengl.rb +29 -53
- data/test/tc_common.rb +9 -3
- data/test/tc_ext_arb.rb +397 -3
- data/test/tc_ext_ati.rb +33 -0
- data/test/tc_ext_ext.rb +479 -2
- data/test/tc_ext_gremedy.rb +36 -0
- data/test/tc_ext_nv.rb +357 -0
- data/test/tc_func_10_11.rb +93 -67
- data/test/tc_func_12.rb +11 -11
- data/test/tc_func_13.rb +38 -18
- data/test/tc_func_14.rb +2 -2
- data/test/tc_func_15.rb +10 -10
- data/test/tc_func_20.rb +20 -20
- data/test/tc_func_21.rb +53 -22
- data/test/tc_glu.rb +9 -4
- data/test/tc_misc.rb +15 -2
- metadata +22 -8
- data/doc/extensions.txt +0 -361
- data/examples/RedBook/aaindex.rb +0 -97
- data/examples/misc/smooth.rb +0 -42
- data/examples/misc/test.rb +0 -65
data/test/tc_ext_ext.rb
CHANGED
@@ -21,9 +21,21 @@ class Test_EXT_EXT < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def teardown
|
24
|
+
if Gl.is_available?("GL_EXT_framebuffer_object")
|
25
|
+
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0)
|
26
|
+
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0)
|
27
|
+
end
|
24
28
|
common_teardown()
|
25
29
|
end
|
26
30
|
|
31
|
+
def test_gl_ext_polygon_offset
|
32
|
+
return if not supported?("GL_EXT_polygon_offset")
|
33
|
+
|
34
|
+
glPolygonOffsetEXT(1.0,2.0)
|
35
|
+
assert_equal(glGetIntegerv(GL_POLYGON_OFFSET_FACTOR_EXT),1.0)
|
36
|
+
assert_equal(glGetIntegerv(GL_POLYGON_OFFSET_BIAS_EXT),2.0)
|
37
|
+
end
|
38
|
+
|
27
39
|
def test_gl_ext_framebuffer_object
|
28
40
|
return if not supported?("GL_EXT_framebuffer_object")
|
29
41
|
t = glGenTextures(3)
|
@@ -39,12 +51,12 @@ class Test_EXT_EXT < Test::Unit::TestCase
|
|
39
51
|
fb = glGenFramebuffersEXT(1)
|
40
52
|
assert(fb.size==1)
|
41
53
|
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fb[0])
|
42
|
-
assert_equal(glIsFramebufferEXT(fb[0]),
|
54
|
+
assert_equal(glIsFramebufferEXT(fb[0]),true)
|
43
55
|
|
44
56
|
rb = glGenRenderbuffersEXT(1)
|
45
57
|
assert(rb.size==1)
|
46
58
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,rb[0])
|
47
|
-
assert_equal(glIsRenderbufferEXT(rb[0]),
|
59
|
+
assert_equal(glIsRenderbufferEXT(rb[0]),true)
|
48
60
|
|
49
61
|
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, $window_size, $window_size)
|
50
62
|
|
@@ -71,4 +83,469 @@ class Test_EXT_EXT < Test::Unit::TestCase
|
|
71
83
|
glDeleteTextures(t)
|
72
84
|
end
|
73
85
|
|
86
|
+
def test_gl_ext_gpu_program_parameters
|
87
|
+
return if not supported?("GL_EXT_gpu_program_parameters")
|
88
|
+
|
89
|
+
glProgramEnvParameters4fvEXT(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4,5,6,7,8])
|
90
|
+
assert_equal(glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB,1),[1,2,3,4])
|
91
|
+
assert_equal(glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB,2),[5,6,7,8])
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_gl_ext_framebuffer_blit
|
95
|
+
return if not supported?("GL_EXT_framebuffer_blit")
|
96
|
+
fbo = glGenFramebuffersEXT(2)
|
97
|
+
texture = glGenTextures(2)
|
98
|
+
data = [1,1,1,1, 0,0,0,0, 1,1,1,1, 0,0,0,0]
|
99
|
+
|
100
|
+
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo[0])
|
101
|
+
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo[1])
|
102
|
+
|
103
|
+
glBindTexture(GL_TEXTURE_2D, texture[0])
|
104
|
+
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,2,2,0,GL_RGBA,GL_UNSIGNED_BYTE,data.pack("C*"))
|
105
|
+
glGenerateMipmapEXT(GL_TEXTURE_2D);
|
106
|
+
|
107
|
+
glBindTexture(GL_TEXTURE_2D, texture[1])
|
108
|
+
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,2,2,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
|
109
|
+
glGenerateMipmapEXT(GL_TEXTURE_2D);
|
110
|
+
|
111
|
+
glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture[0], 0)
|
112
|
+
glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture[1], 0)
|
113
|
+
|
114
|
+
status = glCheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER_EXT)
|
115
|
+
assert_equal(status,GL_FRAMEBUFFER_COMPLETE_EXT)
|
116
|
+
status = glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT)
|
117
|
+
assert_equal(status,GL_FRAMEBUFFER_COMPLETE_EXT)
|
118
|
+
|
119
|
+
glBlitFramebufferEXT(0, 0, 2, 2,
|
120
|
+
0, 0, 2, 2,
|
121
|
+
GL_COLOR_BUFFER_BIT,
|
122
|
+
GL_NEAREST)
|
123
|
+
|
124
|
+
glBindTexture(GL_TEXTURE_2D, texture[1])
|
125
|
+
tex = glGetTexImage(GL_TEXTURE_2D,0,GL_RGBA,GL_UNSIGNED_BYTE).unpack("C*")
|
126
|
+
assert_equal(tex,data)
|
127
|
+
|
128
|
+
glDeleteTextures(texture)
|
129
|
+
glDeleteFramebuffersEXT(fbo)
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_gl_ext_framebuffer_multisample
|
133
|
+
return if not supported?("GL_EXT_framebuffer_multisample")
|
134
|
+
rb = glGenRenderbuffersEXT(1)[0]
|
135
|
+
|
136
|
+
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,rb)
|
137
|
+
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,4,GL_RGBA,2,2)
|
138
|
+
samples = glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_SAMPLES_EXT)
|
139
|
+
assert_equal(samples,4)
|
140
|
+
|
141
|
+
glDeleteRenderbuffersEXT(rb)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_gl_ext_pointparameter
|
145
|
+
return if not supported?("GL_EXT_point_parameters")
|
146
|
+
glPointParameterfEXT(GL_POINT_SIZE_MIN,1.0)
|
147
|
+
assert_equal(glGetDoublev(GL_POINT_SIZE_MIN),1.0)
|
148
|
+
|
149
|
+
glPointParameterfvEXT(GL_POINT_DISTANCE_ATTENUATION,[1,0,1])
|
150
|
+
assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[1,0,1])
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_gl_ext_stencil_two_side
|
154
|
+
return if not supported?("GL_EXT_stencil_two_side")
|
155
|
+
glActiveStencilFaceEXT(GL_FRONT)
|
156
|
+
assert_equal(glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT),GL_FRONT)
|
157
|
+
glActiveStencilFaceEXT(GL_BACK)
|
158
|
+
assert_equal(glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT),GL_BACK)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_gl_ext_stencil_clear_tag
|
162
|
+
return if not supported?("GL_EXT_stencil_clear_tag")
|
163
|
+
glStencilClearTagEXT(1,2)
|
164
|
+
assert_equal(glGetIntegerv(GL_STENCIL_TAG_BITS_EXT),1)
|
165
|
+
assert_equal(glGetIntegerv(GL_STENCIL_CLEAR_TAG_VALUE_EXT),2)
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_gl_ext_secondary_color
|
169
|
+
return if not supported?("GL_EXT_secondary_color")
|
170
|
+
|
171
|
+
glSecondaryColor3bEXT(2**7-1,0,2**7-1)
|
172
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
173
|
+
glSecondaryColor3bvEXT([0,2**7-1,0])
|
174
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
175
|
+
glSecondaryColor3dEXT(1.0,0.0,1.0)
|
176
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
177
|
+
glSecondaryColor3dvEXT([0.0,1.0,0.0])
|
178
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
179
|
+
glSecondaryColor3fEXT(1.0,0.0,1.0)
|
180
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
181
|
+
glSecondaryColor3fvEXT([0.0,1.0,0.0])
|
182
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
183
|
+
glSecondaryColor3iEXT(2**31-1,0,2**31-1)
|
184
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
185
|
+
glSecondaryColor3ivEXT([0,2**31-1,0])
|
186
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
187
|
+
glSecondaryColor3sEXT(2**15-1,0,2**15-1)
|
188
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
189
|
+
glSecondaryColor3svEXT([0,2**15-1,0])
|
190
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
191
|
+
glSecondaryColor3ubEXT(2**8-1,0,2**8-1)
|
192
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
193
|
+
glSecondaryColor3ubvEXT([0,2**8-1,0])
|
194
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
195
|
+
glSecondaryColor3uiEXT(2**32-1,0,2**32-1)
|
196
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
197
|
+
glSecondaryColor3uivEXT([0,2**32-1,0])
|
198
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
199
|
+
glSecondaryColor3usEXT(2**16-1,0,2**16-1)
|
200
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
|
201
|
+
glSecondaryColor3usvEXT([0,2**16-1,0])
|
202
|
+
assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
|
203
|
+
|
204
|
+
sc = [0,1,0, 1,0,1].pack("f*")
|
205
|
+
|
206
|
+
glSecondaryColorPointerEXT(3,GL_FLOAT,0,sc)
|
207
|
+
assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE),3)
|
208
|
+
assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE),GL_FLOAT)
|
209
|
+
assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE),0)
|
210
|
+
assert_equal(glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER),sc)
|
211
|
+
glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
|
212
|
+
|
213
|
+
glBegin(GL_TRIANGLES)
|
214
|
+
glArrayElement(0)
|
215
|
+
glEnd()
|
216
|
+
|
217
|
+
assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0,1,0,1])
|
218
|
+
|
219
|
+
glBegin(GL_TRIANGLES)
|
220
|
+
glArrayElement(1)
|
221
|
+
glEnd()
|
222
|
+
|
223
|
+
assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1,0,1,1])
|
224
|
+
|
225
|
+
glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
|
226
|
+
end
|
227
|
+
|
228
|
+
def test_gl_ext_blend_color
|
229
|
+
return if not supported?("GL_EXT_blend_color")
|
230
|
+
glBlendColorEXT(1.0,0.0,1.0,0.0)
|
231
|
+
assert_equal(glGetFloatv(GL_BLEND_COLOR_EXT),[1,0,1,0])
|
232
|
+
glBlendColorEXT(0.0,1.0,0.0,1.0)
|
233
|
+
assert_equal(glGetFloatv(GL_BLEND_COLOR_EXT),[0,1,0,1])
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_gl_ext_blend_minmax
|
237
|
+
return if not supported?("GL_EXT_blend_minmax")
|
238
|
+
glBlendEquationEXT(GL_MIN_EXT)
|
239
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_EXT),GL_MIN_EXT)
|
240
|
+
glBlendEquationEXT(GL_MAX_EXT)
|
241
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_EXT),GL_MAX_EXT)
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_gl_ext_blend_func_separate
|
245
|
+
return if not supported?("GL_EXT_blend_func_separate")
|
246
|
+
glBlendFuncSeparateEXT(GL_ZERO,GL_ONE,GL_ZERO,GL_ONE)
|
247
|
+
assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB_EXT),GL_ZERO)
|
248
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_RGB_EXT),GL_ONE)
|
249
|
+
assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA_EXT),GL_ZERO)
|
250
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA_EXT),GL_ONE)
|
251
|
+
glBlendFuncSeparateEXT(GL_ONE,GL_ZERO,GL_ONE,GL_ZERO)
|
252
|
+
assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB_EXT),GL_ONE)
|
253
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_RGB_EXT),GL_ZERO)
|
254
|
+
assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA_EXT),GL_ONE)
|
255
|
+
assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA_EXT),GL_ZERO)
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_gl_ext_blend_equation_separate
|
259
|
+
return if not supported?("GL_EXT_blend_equation_separate")
|
260
|
+
glBlendEquationSeparateEXT(GL_FUNC_ADD,GL_FUNC_SUBTRACT)
|
261
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB_EXT),GL_FUNC_ADD)
|
262
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA_EXT),GL_FUNC_SUBTRACT)
|
263
|
+
glBlendEquationSeparateEXT(GL_FUNC_SUBTRACT,GL_FUNC_ADD)
|
264
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB_EXT),GL_FUNC_SUBTRACT)
|
265
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA_EXT),GL_FUNC_ADD)
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_gl_ext_depth_bounds_test
|
269
|
+
return if not supported?("GL_EXT_depth_bounds_test")
|
270
|
+
glDepthBoundsEXT(0.2,0.8)
|
271
|
+
assert(approx_equal(glGetDoublev(GL_DEPTH_BOUNDS_EXT),[0.2,0.8]))
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_gl_ext_timer_query
|
275
|
+
return if not supported?("GL_EXT_timer_query")
|
276
|
+
queries = glGenQueries(2)
|
277
|
+
glBeginQuery(GL_TIME_ELAPSED_EXT,queries[0])
|
278
|
+
glBegin(GL_QUADS)
|
279
|
+
glVertex2i(0,0)
|
280
|
+
glVertex2i(0,1)
|
281
|
+
glVertex2i(1,1)
|
282
|
+
glVertex2i(1,0)
|
283
|
+
glEnd
|
284
|
+
glEndQuery(GL_TIME_ELAPSED_EXT)
|
285
|
+
|
286
|
+
while glGetQueryObjectiv(queries[0], GL_QUERY_RESULT_AVAILABLE)==GL_FALSE
|
287
|
+
#
|
288
|
+
end
|
289
|
+
assert(glGetQueryObjecti64vEXT(queries[0], GL_QUERY_RESULT)>0)
|
290
|
+
assert(glGetQueryObjectui64vEXT(queries[0], GL_QUERY_RESULT)>0)
|
291
|
+
|
292
|
+
glDeleteQueries(queries)
|
293
|
+
end
|
294
|
+
|
295
|
+
def test_gl_ext_texture_object
|
296
|
+
return if not supported?("GL_EXT_texture_object")
|
297
|
+
textures = glGenTexturesEXT(2)
|
298
|
+
glBindTextureEXT(GL_TEXTURE_1D,textures[0])
|
299
|
+
glBindTextureEXT(GL_TEXTURE_2D,textures[1])
|
300
|
+
assert_equal(glIsTextureEXT(textures[0]),true)
|
301
|
+
assert_equal(glAreTexturesResidentEXT(textures).size,2)
|
302
|
+
|
303
|
+
glPrioritizeTexturesEXT(textures,[0.5,1.0])
|
304
|
+
assert_equal(glGetTexParameterfv(GL_TEXTURE_1D,GL_TEXTURE_PRIORITY),0.5)
|
305
|
+
assert_equal(glGetTexParameterfv(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY),1.0)
|
306
|
+
|
307
|
+
glDeleteTexturesEXT(textures)
|
308
|
+
assert_equal(glIsTextureEXT(textures[0]),false)
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_gl_ext_compiled_vertex_array
|
312
|
+
return if not supported?("GL_EXT_compiled_vertex_array")
|
313
|
+
glLockArraysEXT(1,2)
|
314
|
+
assert_equal(glGetIntegerv(GL_ARRAY_ELEMENT_LOCK_FIRST_EXT),1)
|
315
|
+
assert_equal(glGetIntegerv(GL_ARRAY_ELEMENT_LOCK_COUNT_EXT),2)
|
316
|
+
glUnlockArraysEXT()
|
317
|
+
end
|
318
|
+
|
319
|
+
def test_gl_ext_fogcoord
|
320
|
+
return if not supported?("GL_EXT_fog_coord")
|
321
|
+
|
322
|
+
glFogCoordfEXT(2.0)
|
323
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
|
324
|
+
glFogCoordfvEXT([3.0])
|
325
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
|
326
|
+
|
327
|
+
glFogCoorddEXT(2.0)
|
328
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
|
329
|
+
glFogCoorddvEXT([3.0])
|
330
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
|
331
|
+
|
332
|
+
fc = [1, 0].pack("f*")
|
333
|
+
glFogCoordPointerEXT(GL_FLOAT,0,fc)
|
334
|
+
assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE),GL_FLOAT)
|
335
|
+
assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE),0)
|
336
|
+
assert_equal(glGetPointerv(GL_FOG_COORD_ARRAY_POINTER),fc)
|
337
|
+
|
338
|
+
glEnableClientState(GL_FOG_COORD_ARRAY)
|
339
|
+
|
340
|
+
glBegin(GL_TRIANGLES)
|
341
|
+
glArrayElement(0)
|
342
|
+
glEnd()
|
343
|
+
|
344
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),1)
|
345
|
+
|
346
|
+
glBegin(GL_TRIANGLES)
|
347
|
+
glArrayElement(1)
|
348
|
+
glEnd()
|
349
|
+
|
350
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),0)
|
351
|
+
|
352
|
+
glDisableClientState(GL_FOG_COORD_ARRAY)
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_gl_ext_multi_draw_arrays
|
356
|
+
return if not supported?("GL_EXT_multi_draw_arrays")
|
357
|
+
va = [0,0, 1,0, 1,1, 0,0, 1,0, 0,1].pack("f*")
|
358
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
359
|
+
|
360
|
+
glEnable(GL_VERTEX_ARRAY)
|
361
|
+
|
362
|
+
buf = glFeedbackBuffer(256,GL_3D)
|
363
|
+
glRenderMode(GL_FEEDBACK)
|
364
|
+
|
365
|
+
glMultiDrawArraysEXT(GL_POLYGON, [0,3], [3,3])
|
366
|
+
|
367
|
+
i1 = [0,1,2].pack("C*")
|
368
|
+
i2 = [3,4,5].pack("C*")
|
369
|
+
glMultiDrawElementsEXT(GL_TRIANGLES,GL_UNSIGNED_BYTE,[i1,i2])
|
370
|
+
|
371
|
+
count = glRenderMode(GL_RENDER)
|
372
|
+
assert_equal(count,(3*3+2)*4)
|
373
|
+
glDisable(GL_VERTEX_ARRAY)
|
374
|
+
end
|
375
|
+
|
376
|
+
def test_gl_ext_drawrangeelements
|
377
|
+
return if not supported?("GL_EXT_draw_range_elements")
|
378
|
+
va = [0,0, 0,1, 1,1].pack("f*")
|
379
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
380
|
+
|
381
|
+
buf = glFeedbackBuffer(256,GL_3D)
|
382
|
+
glRenderMode(GL_FEEDBACK)
|
383
|
+
|
384
|
+
glEnable(GL_VERTEX_ARRAY)
|
385
|
+
|
386
|
+
glDrawRangeElementsEXT(GL_POINTS,0,2,3,GL_UNSIGNED_BYTE,[0,1,2].pack("C*"))
|
387
|
+
count = glRenderMode(GL_RENDER)
|
388
|
+
assert_equal(count,12)
|
389
|
+
|
390
|
+
glDisable(GL_VERTEX_ARRAY)
|
391
|
+
end
|
392
|
+
|
393
|
+
def test_gl_ext_geometry_shader4
|
394
|
+
return if not supported?("GL_EXT_geometry_shader4")
|
395
|
+
program = glCreateProgramObjectARB()
|
396
|
+
|
397
|
+
glProgramParameteriEXT(program,GL_GEOMETRY_INPUT_TYPE_EXT ,GL_LINES_ADJACENCY_EXT)
|
398
|
+
assert_equal(glGetObjectParameterivARB(program,GL_GEOMETRY_INPUT_TYPE_EXT),GL_LINES_ADJACENCY_EXT)
|
399
|
+
|
400
|
+
glDeleteObjectARB(program)
|
401
|
+
end
|
402
|
+
|
403
|
+
def test_gl_ext_gpu_shader4
|
404
|
+
return if not supported?(["GL_EXT_gpu_shader4","GL_ARB_vertex_program"])
|
405
|
+
|
406
|
+
programs = glGenProgramsARB(1)
|
407
|
+
program = "!!ARBvp1.0\nTEMP vv;\nEND"
|
408
|
+
|
409
|
+
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, programs[0])
|
410
|
+
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, program)
|
411
|
+
|
412
|
+
glVertexAttribI1iEXT(1,1)
|
413
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],1)
|
414
|
+
glVertexAttribI1uiEXT(1,2)
|
415
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],2)
|
416
|
+
glVertexAttribI1ivEXT(1,[3])
|
417
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],3)
|
418
|
+
glVertexAttribI1uivEXT(1,[4])
|
419
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],4)
|
420
|
+
|
421
|
+
glVertexAttribI2iEXT(1,1,2)
|
422
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[1,2])
|
423
|
+
glVertexAttribI2uiEXT(1,2,3)
|
424
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[2,3])
|
425
|
+
glVertexAttribI2ivEXT(1,[3,4])
|
426
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[3,4])
|
427
|
+
glVertexAttribI2uivEXT(1,[4,5])
|
428
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[4,5])
|
429
|
+
|
430
|
+
glVertexAttribI3iEXT(1,1,2,3)
|
431
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[1,2,3])
|
432
|
+
glVertexAttribI3uiEXT(1,2,3,4)
|
433
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[2,3,4])
|
434
|
+
glVertexAttribI3ivEXT(1,[3,4,5])
|
435
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[3,4,5])
|
436
|
+
glVertexAttribI3uivEXT(1,[4,5,6])
|
437
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[4,5,6])
|
438
|
+
|
439
|
+
glVertexAttribI4iEXT(1,1,2,3,4)
|
440
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[1,2,3,4])
|
441
|
+
glVertexAttribI4uiEXT(1,2,3,4,5)
|
442
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[2,3,4,5])
|
443
|
+
glVertexAttribI4ivEXT(1,[3,4,5,6])
|
444
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[3,4,5,6])
|
445
|
+
glVertexAttribI4uivEXT(1,[4,5,6,7])
|
446
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[4,5,6,7])
|
447
|
+
|
448
|
+
glVertexAttribI4bvEXT(1,[1,2,3,4])
|
449
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[1,2,3,4])
|
450
|
+
glVertexAttribI4svEXT(1,[2,3,4,5])
|
451
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[2,3,4,5])
|
452
|
+
glVertexAttribI4ubvEXT(1,[1,2,3,4])
|
453
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[1,2,3,4])
|
454
|
+
glVertexAttribI4usvEXT(1,[2,3,4,5])
|
455
|
+
assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[2,3,4,5])
|
456
|
+
|
457
|
+
glVertexAttribIPointerEXT(1,2,GL_INT,0,[1,1].pack("i*"))
|
458
|
+
assert_equal(glGetVertexAttribPointervARB(1),[1,1].pack("i*"))
|
459
|
+
|
460
|
+
glDeleteProgramsARB(programs)
|
461
|
+
end
|
462
|
+
|
463
|
+
def test_gl_ext_gpu_shader4_2
|
464
|
+
return if not supported?(["GL_EXT_gpu_shader4","GL_ARB_shader_objects"])
|
465
|
+
|
466
|
+
vertex_shader_source = "attribute vec4 test; uniform float testvec1; uniform vec2 testvec2; uniform vec3 testvec3; uniform vec4 testvec4; uniform unsigned int testivec1; uniform uvec2 testivec2; uniform uvec3 testivec3; uniform uvec4 testivec4; void main() { gl_Position = testvec1 * test * testvec2.x * testvec3.x * testivec1 * testivec2.x * testivec3.x * testivec4.x + testvec4;}"
|
467
|
+
|
468
|
+
program = glCreateProgramObjectARB()
|
469
|
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
|
470
|
+
glShaderSourceARB(vs,vertex_shader_source)
|
471
|
+
|
472
|
+
glCompileShaderARB(vs)
|
473
|
+
glAttachObjectARB(program,vs)
|
474
|
+
glLinkProgramARB(program)
|
475
|
+
glUseProgramObjectARB(program)
|
476
|
+
|
477
|
+
assert((tv1il = glGetUniformLocationARB(program,"testivec1"))>=0)
|
478
|
+
assert((tv2il = glGetUniformLocationARB(program,"testivec2"))>=0)
|
479
|
+
assert((tv3il = glGetUniformLocationARB(program,"testivec3"))>=0)
|
480
|
+
assert((tv4il = glGetUniformLocationARB(program,"testivec4"))>=0)
|
481
|
+
|
482
|
+
glUniform1uiEXT(tv1il,3)
|
483
|
+
assert_equal(glGetUniformuivEXT(program,tv1il),3)
|
484
|
+
glUniform1uivEXT(tv1il,[4])
|
485
|
+
assert_equal(glGetUniformuivEXT(program,tv1il),4)
|
486
|
+
glUniform2uiEXT(tv2il,1,2)
|
487
|
+
assert_equal(glGetUniformuivEXT(program,tv2il),[1,2])
|
488
|
+
glUniform2uivEXT(tv2il,[3,4])
|
489
|
+
assert_equal(glGetUniformuivEXT(program,tv2il),[3,4])
|
490
|
+
glUniform3uiEXT(tv3il,1,2,3)
|
491
|
+
assert_equal(glGetUniformuivEXT(program,tv3il),[1,2,3])
|
492
|
+
glUniform3uivEXT(tv3il,[3,4,5])
|
493
|
+
assert_equal(glGetUniformuivEXT(program,tv3il),[3,4,5])
|
494
|
+
glUniform4uiEXT(tv4il,1,2,3,4)
|
495
|
+
assert_equal(glGetUniformuivEXT(program,tv4il),[1,2,3,4])
|
496
|
+
glUniform4uivEXT(tv4il,[3,4,5,6])
|
497
|
+
assert_equal(glGetUniformuivEXT(program,tv4il),[3,4,5,6])
|
498
|
+
|
499
|
+
glBindFragDataLocationEXT(program,1,"test")
|
500
|
+
assert_equal(glGetFragDataLocationEXT(program,"test"),-1)
|
501
|
+
end
|
502
|
+
|
503
|
+
def test_gl_ext_draw_instanced
|
504
|
+
return if not supported?("GL_EXT_draw_instanced")
|
505
|
+
|
506
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
507
|
+
|
508
|
+
va = [0,0, 0,1, 1,1].pack("f*")
|
509
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
510
|
+
|
511
|
+
buf = glFeedbackBuffer(256,GL_3D)
|
512
|
+
glRenderMode(GL_FEEDBACK)
|
513
|
+
|
514
|
+
glDrawArraysInstancedEXT(GL_TRIANGLES,0,3,2)
|
515
|
+
|
516
|
+
glDrawElementsInstancedEXT(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,[0,1,2].pack("C*"),2)
|
517
|
+
count = glRenderMode(GL_RENDER)
|
518
|
+
assert_equal(count,2*2*11)
|
519
|
+
|
520
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
521
|
+
end
|
522
|
+
|
523
|
+
def test_gl_ext_texture_buffer_object
|
524
|
+
return if not supported?("GL_EXT_texture_buffer_object")
|
525
|
+
|
526
|
+
buf = glGenBuffers(1)[0]
|
527
|
+
glBindBuffer(GL_TEXTURE_BUFFER_EXT, buf)
|
528
|
+
|
529
|
+
tex = glGenTextures(1)[0]
|
530
|
+
glBindTexture(GL_TEXTURE_BUFFER_EXT, tex)
|
531
|
+
glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA32F_ARB, buf)
|
532
|
+
|
533
|
+
assert_equal(glGetIntegerv(GL_TEXTURE_BINDING_BUFFER_EXT),tex)
|
534
|
+
assert_equal(glGetIntegerv(GL_TEXTURE_BUFFER_FORMAT_EXT),GL_RGBA32F_ARB)
|
535
|
+
|
536
|
+
glDeleteBuffers(buf)
|
537
|
+
glDeleteTextures(tex)
|
538
|
+
end
|
539
|
+
|
540
|
+
def test_gl_ext_texture_integer
|
541
|
+
return if not supported?("GL_EXT_texture_integer")
|
542
|
+
|
543
|
+
glClearColorIiEXT(1,2,3,4)
|
544
|
+
glClearColorIuiEXT(1,2,3,4)
|
545
|
+
|
546
|
+
glTexParameterIivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,[1,2,3,4])
|
547
|
+
assert_equal(glGetTexParameterIivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR),[1,2,3,4])
|
548
|
+
glTexParameterIuivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,[5,6,7,8])
|
549
|
+
assert_equal(glGetTexParameterIuivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR),[5,6,7,8])
|
550
|
+
end
|
74
551
|
end
|