opengl 0.7.0.pre1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +8 -0
- data/History.txt +36 -0
- data/MIT-LICENSE +18 -0
- data/Manifest.txt +140 -0
- data/README.rdoc +51 -0
- data/Rakefile +129 -0
- data/Rakefile.cross +104 -0
- data/doc/build_install.txt +119 -0
- data/doc/extensions.txt.in +348 -0
- data/doc/history.txt +66 -0
- data/doc/requirements_and_design.txt +117 -0
- data/doc/roadmap.txt +28 -0
- data/doc/scientific_use.txt +35 -0
- data/doc/supplies/page_template.html +71 -0
- data/doc/thanks.txt +29 -0
- data/doc/tutorial.txt +469 -0
- data/examples/NeHe/nehe_lesson02.rb +117 -0
- data/examples/NeHe/nehe_lesson03.rb +122 -0
- data/examples/NeHe/nehe_lesson04.rb +133 -0
- data/examples/NeHe/nehe_lesson05.rb +186 -0
- data/examples/NeHe/nehe_lesson36.rb +303 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +376 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +406 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +16 -0
- data/examples/RedBook/aapoly.rb +142 -0
- data/examples/RedBook/aargb.rb +119 -0
- data/examples/RedBook/accanti.rb +162 -0
- data/examples/RedBook/accpersp.rb +215 -0
- data/examples/RedBook/alpha.rb +123 -0
- data/examples/RedBook/alpha3D.rb +158 -0
- data/examples/RedBook/bezcurve.rb +105 -0
- data/examples/RedBook/bezmesh.rb +137 -0
- data/examples/RedBook/checker.rb +124 -0
- data/examples/RedBook/clip.rb +95 -0
- data/examples/RedBook/colormat.rb +135 -0
- data/examples/RedBook/cube.rb +69 -0
- data/examples/RedBook/depthcue.rb +99 -0
- data/examples/RedBook/dof.rb +205 -0
- data/examples/RedBook/double.rb +105 -0
- data/examples/RedBook/drawf.rb +91 -0
- data/examples/RedBook/feedback.rb +145 -0
- data/examples/RedBook/fog.rb +167 -0
- data/examples/RedBook/font.rb +151 -0
- data/examples/RedBook/hello.rb +79 -0
- data/examples/RedBook/image.rb +137 -0
- data/examples/RedBook/jitter.rb +207 -0
- data/examples/RedBook/lines.rb +128 -0
- data/examples/RedBook/list.rb +111 -0
- data/examples/RedBook/material.rb +275 -0
- data/examples/RedBook/mipmap.rb +156 -0
- data/examples/RedBook/model.rb +113 -0
- data/examples/RedBook/movelight.rb +132 -0
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/RedBook/planet.rb +108 -0
- data/examples/RedBook/quadric.rb +158 -0
- data/examples/RedBook/robot.rb +115 -0
- data/examples/RedBook/select.rb +196 -0
- data/examples/RedBook/smooth.rb +95 -0
- data/examples/RedBook/stencil.rb +163 -0
- data/examples/RedBook/stroke.rb +167 -0
- data/examples/RedBook/surface.rb +166 -0
- data/examples/RedBook/teaambient.rb +132 -0
- data/examples/RedBook/teapots.rb +182 -0
- data/examples/RedBook/tess.rb +183 -0
- data/examples/RedBook/texbind.rb +147 -0
- data/examples/RedBook/texgen.rb +169 -0
- data/examples/RedBook/texturesurf.rb +128 -0
- data/examples/RedBook/varray.rb +159 -0
- data/examples/RedBook/wrap.rb +148 -0
- data/examples/misc/OGLBench.rb +337 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/fbo_test.rb +356 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/misc/glfwtest.rb +30 -0
- data/examples/misc/plane.rb +161 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/misc/sdltest.rb +34 -0
- data/examples/misc/trislam.rb +828 -0
- data/ext/common/common.h +448 -0
- data/ext/common/conv.h +234 -0
- data/ext/common/funcdef.h +280 -0
- data/ext/common/gl-enums.h +10031 -0
- data/ext/common/gl-error.h +23 -0
- data/ext/common/gl-types.h +67 -0
- data/ext/common/glu-enums.h +463 -0
- data/ext/gl/extconf.rb +43 -0
- data/ext/gl/gl-1.0-1.1.c +2811 -0
- data/ext/gl/gl-1.2.c +814 -0
- data/ext/gl/gl-1.3.c +443 -0
- data/ext/gl/gl-1.4.c +348 -0
- data/ext/gl/gl-1.5.c +225 -0
- data/ext/gl/gl-2.0.c +657 -0
- data/ext/gl/gl-2.1.c +57 -0
- data/ext/gl/gl-enums.c +3354 -0
- data/ext/gl/gl-error.c +104 -0
- data/ext/gl/gl-ext-3dfx.c +27 -0
- data/ext/gl/gl-ext-arb.c +866 -0
- data/ext/gl/gl-ext-ati.c +41 -0
- data/ext/gl/gl-ext-ext.c +889 -0
- data/ext/gl/gl-ext-gremedy.c +41 -0
- data/ext/gl/gl-ext-nv.c +679 -0
- data/ext/gl/gl.c +216 -0
- data/ext/glu/extconf.rb +51 -0
- data/ext/glu/glu-enums.c +164 -0
- data/ext/glu/glu.c +1530 -0
- data/ext/glut/extconf.rb +67 -0
- data/ext/glut/glut.c +1624 -0
- data/lib/opengl.rb +89 -0
- data/test/README +10 -0
- data/test/tc_common.rb +98 -0
- data/test/tc_ext_arb.rb +467 -0
- data/test/tc_ext_ati.rb +33 -0
- data/test/tc_ext_ext.rb +551 -0
- data/test/tc_ext_gremedy.rb +36 -0
- data/test/tc_ext_nv.rb +357 -0
- data/test/tc_func_10_11.rb +1281 -0
- data/test/tc_func_12.rb +186 -0
- data/test/tc_func_13.rb +229 -0
- data/test/tc_func_14.rb +197 -0
- data/test/tc_func_15.rb +270 -0
- data/test/tc_func_20.rb +346 -0
- data/test/tc_func_21.rb +541 -0
- data/test/tc_glu.rb +310 -0
- data/test/tc_include_gl.rb +35 -0
- data/test/tc_misc.rb +54 -0
- data/test/tc_require_gl.rb +34 -0
- data/utils/README +11 -0
- data/utils/enumgen.rb +112 -0
- data/utils/extlistgen.rb +90 -0
- data/utils/mkdn2html.rb +59 -0
- data/utils/post-mkdn2html.rb +91 -0
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +198 -0
- metadata +274 -0
data/test/tc_func_15.rb
ADDED
@@ -0,0 +1,270 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
3
|
+
#
|
4
|
+
# This program is distributed under the terms of the MIT license.
|
5
|
+
# See the included MIT-LICENSE file for the terms of this license.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
9
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
10
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
11
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
12
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
13
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
|
+
#
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class Test_15 < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_query
|
28
|
+
return if not supported?(1.5)
|
29
|
+
queries = glGenQueries(2)
|
30
|
+
assert_equal(queries.size,2)
|
31
|
+
|
32
|
+
glBeginQuery(GL_SAMPLES_PASSED,queries[1])
|
33
|
+
assert_equal(glIsQuery(queries[1]),true)
|
34
|
+
|
35
|
+
glBegin(GL_TRIANGLES)
|
36
|
+
glVertex2i(0,0)
|
37
|
+
glVertex2i(1,0)
|
38
|
+
glVertex2i(1,1)
|
39
|
+
glEnd()
|
40
|
+
|
41
|
+
assert_equal(glGetQueryiv(GL_SAMPLES_PASSED,GL_CURRENT_QUERY),queries[1])
|
42
|
+
|
43
|
+
glEndQuery(GL_SAMPLES_PASSED)
|
44
|
+
|
45
|
+
r = glGetQueryObjectiv(queries[1],GL_QUERY_RESULT_AVAILABLE)
|
46
|
+
assert((r==GL_TRUE || r==GL_FALSE))
|
47
|
+
|
48
|
+
if (r==GL_TRUE)
|
49
|
+
assert(glGetQueryObjectiv(queries[1],GL_QUERY_RESULT)[0] > 0)
|
50
|
+
assert(glGetQueryObjectuiv(queries[1],GL_QUERY_RESULT)[0] > 0)
|
51
|
+
end
|
52
|
+
|
53
|
+
glDeleteQueries(queries)
|
54
|
+
assert_equal(glIsQuery(queries[1]),false)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_buffers
|
58
|
+
return if not supported?(1.5)
|
59
|
+
buffers = glGenBuffers(2)
|
60
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffers[0])
|
61
|
+
assert_equal(glIsBuffer(buffers[0]),true)
|
62
|
+
|
63
|
+
data = [0,1,2,3].pack("C*")
|
64
|
+
data2 = [4,5,6,7].pack("C*")
|
65
|
+
|
66
|
+
glBufferData(GL_ARRAY_BUFFER,4,data,GL_STREAM_READ)
|
67
|
+
assert_equal(glGetBufferSubData(GL_ARRAY_BUFFER,0,4),data)
|
68
|
+
|
69
|
+
assert_equal(glGetBufferParameteriv(GL_ARRAY_BUFFER,GL_BUFFER_USAGE),GL_STREAM_READ)
|
70
|
+
|
71
|
+
glBufferSubData(GL_ARRAY_BUFFER,0,4,data2)
|
72
|
+
assert_equal(glGetBufferSubData(GL_ARRAY_BUFFER,0,4),data2)
|
73
|
+
|
74
|
+
assert_equal(glMapBuffer(GL_ARRAY_BUFFER,GL_READ_ONLY),data2)
|
75
|
+
r = glUnmapBuffer(GL_ARRAY_BUFFER)
|
76
|
+
assert(r == true || r == false)
|
77
|
+
glDeleteBuffers(buffers)
|
78
|
+
assert_equal(glIsBuffer(buffers[0]),false)
|
79
|
+
|
80
|
+
# FIXME: GetBufferPointerv not yet implemented
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_buffer_binding_element_array
|
84
|
+
return if not supported?(1.5)
|
85
|
+
|
86
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
87
|
+
va = [0,0, 0,1, 1,1].pack("f*")
|
88
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
89
|
+
|
90
|
+
#
|
91
|
+
data = [0,1,2].pack("C*")
|
92
|
+
buffers = glGenBuffers(1)
|
93
|
+
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,buffers[0])
|
94
|
+
glBufferData(GL_ELEMENT_ARRAY_BUFFER,3,data,GL_DYNAMIC_DRAW)
|
95
|
+
|
96
|
+
#
|
97
|
+
feedback = glFeedbackBuffer(256,GL_3D)
|
98
|
+
glRenderMode(GL_FEEDBACK)
|
99
|
+
|
100
|
+
glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,0)
|
101
|
+
glDrawRangeElements(GL_TRIANGLES,0,3,3,GL_UNSIGNED_BYTE,0)
|
102
|
+
|
103
|
+
count = glRenderMode(GL_RENDER)
|
104
|
+
assert_equal(count,22)
|
105
|
+
|
106
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
107
|
+
glDeleteBuffers(buffers)
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_buffer_binding_array_1
|
111
|
+
return if not supported?(1.5)
|
112
|
+
|
113
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
114
|
+
va = [0,0, 0,1, 1,1].pack("f*")
|
115
|
+
|
116
|
+
#
|
117
|
+
buffers = glGenBuffers(1)
|
118
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffers[0])
|
119
|
+
glBufferData(GL_ARRAY_BUFFER,6*4,va,GL_DYNAMIC_DRAW)
|
120
|
+
|
121
|
+
glVertexPointer(2,GL_FLOAT,0,0)
|
122
|
+
assert_equal(glGetPointerv(GL_VERTEX_ARRAY_POINTER),0)
|
123
|
+
#
|
124
|
+
feedback = glFeedbackBuffer(256,GL_3D)
|
125
|
+
glRenderMode(GL_FEEDBACK)
|
126
|
+
|
127
|
+
glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,[0,1,2].pack("f*"))
|
128
|
+
|
129
|
+
count = glRenderMode(GL_RENDER)
|
130
|
+
assert_equal(count,11)
|
131
|
+
|
132
|
+
glDeleteBuffers(buffers)
|
133
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_buffer_binding_array_2
|
137
|
+
return if not supported?(1.5)
|
138
|
+
|
139
|
+
efa = [0].pack("C*")
|
140
|
+
na = [0,1,0].pack("f*")
|
141
|
+
ca = [1,0,1,0].pack("f*")
|
142
|
+
ta = [1,0,1,0].pack("f*")
|
143
|
+
|
144
|
+
buffers = glGenBuffers(4)
|
145
|
+
# load data into buffers
|
146
|
+
buffer_efa,buffer_na,buffer_ca,buffer_ta = buffers
|
147
|
+
|
148
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_efa)
|
149
|
+
glBufferData(GL_ARRAY_BUFFER,1,efa,GL_DYNAMIC_DRAW)
|
150
|
+
|
151
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_na)
|
152
|
+
glBufferData(GL_ARRAY_BUFFER,3*4,na,GL_DYNAMIC_DRAW)
|
153
|
+
|
154
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_ca)
|
155
|
+
glBufferData(GL_ARRAY_BUFFER,4*4,ca,GL_DYNAMIC_DRAW)
|
156
|
+
|
157
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_ta)
|
158
|
+
glBufferData(GL_ARRAY_BUFFER,4*4,ta,GL_DYNAMIC_DRAW)
|
159
|
+
|
160
|
+
# load buffers into arrays
|
161
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_na)
|
162
|
+
glEdgeFlagPointer(0,0)
|
163
|
+
assert_equal(glGetPointerv(GL_EDGE_FLAG_ARRAY_POINTER),0)
|
164
|
+
|
165
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_na)
|
166
|
+
glNormalPointer(GL_FLOAT,0,0)
|
167
|
+
assert_equal(glGetPointerv(GL_NORMAL_ARRAY_POINTER),0)
|
168
|
+
|
169
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_ca)
|
170
|
+
glColorPointer(4,GL_FLOAT,0,0)
|
171
|
+
assert_equal(glGetPointerv(GL_COLOR_ARRAY_POINTER),0)
|
172
|
+
|
173
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_ta)
|
174
|
+
glTexCoordPointer(4,GL_FLOAT,0,0)
|
175
|
+
assert_equal(glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER),0)
|
176
|
+
|
177
|
+
# not really testing index
|
178
|
+
glIndexPointer(GL_INT,2,0)
|
179
|
+
assert_equal(glGetPointerv(GL_INDEX_ARRAY_POINTER),0)
|
180
|
+
|
181
|
+
# draw arrays
|
182
|
+
glEnable(GL_NORMAL_ARRAY)
|
183
|
+
glEnable(GL_COLOR_ARRAY)
|
184
|
+
glEnable(GL_TEXTURE_COORD_ARRAY)
|
185
|
+
glEnable(GL_EDGE_FLAG_ARRAY)
|
186
|
+
|
187
|
+
glBegin(GL_TRIANGLES)
|
188
|
+
glArrayElement(0)
|
189
|
+
glEnd()
|
190
|
+
|
191
|
+
assert_equal(glGetDoublev(GL_CURRENT_NORMAL),[0,1,0])
|
192
|
+
assert_equal(glGetDoublev(GL_CURRENT_COLOR),[1,0,1,0])
|
193
|
+
assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS),[1,0,1,0])
|
194
|
+
assert_equal(glGetBooleanv(GL_EDGE_FLAG),GL_FALSE)
|
195
|
+
|
196
|
+
glDisable(GL_EDGE_FLAG_ARRAY)
|
197
|
+
glDisable(GL_TEXTURE_COORD_ARRAY)
|
198
|
+
glDisable(GL_COLOR_ARRAY)
|
199
|
+
glDisable(GL_NORMAL_ARRAY)
|
200
|
+
|
201
|
+
glDeleteBuffers(buffers)
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_buffer_binding_array_3
|
205
|
+
return if not supported?(1.5)
|
206
|
+
|
207
|
+
sc = [0,1,0].pack("f*")
|
208
|
+
fc = [1].pack("f*")
|
209
|
+
|
210
|
+
buffers = glGenBuffers(2)
|
211
|
+
# load data into buffers
|
212
|
+
buffer_sc,buffer_fc = buffers
|
213
|
+
|
214
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_sc)
|
215
|
+
glBufferData(GL_ARRAY_BUFFER,3*4,sc,GL_DYNAMIC_DRAW)
|
216
|
+
|
217
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_fc)
|
218
|
+
glBufferData(GL_ARRAY_BUFFER,1*4,fc,GL_DYNAMIC_DRAW)
|
219
|
+
|
220
|
+
# load buffers into arrays
|
221
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_sc)
|
222
|
+
glSecondaryColorPointer(3,GL_FLOAT,0,0)
|
223
|
+
assert_equal(glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER),0)
|
224
|
+
|
225
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffer_fc)
|
226
|
+
glFogCoordPointer(GL_FLOAT,0,0)
|
227
|
+
assert_equal(glGetPointerv(GL_FOG_COORD_ARRAY_POINTER),0)
|
228
|
+
|
229
|
+
# draw arrays
|
230
|
+
glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
|
231
|
+
glEnableClientState(GL_FOG_COORD_ARRAY)
|
232
|
+
|
233
|
+
glBegin(GL_TRIANGLES)
|
234
|
+
glArrayElement(0)
|
235
|
+
glEnd()
|
236
|
+
|
237
|
+
assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0,1,0,1])
|
238
|
+
assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),1)
|
239
|
+
|
240
|
+
glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
|
241
|
+
glDisableClientState(GL_FOG_COORD_ARRAY)
|
242
|
+
|
243
|
+
glDeleteBuffers(buffers)
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_buffer_binding_array_4
|
247
|
+
return if not supported?(1.5)
|
248
|
+
va = [0,0, 1,0, 1,1, 0,0, 1,0, 0,1].pack("f*")
|
249
|
+
glVertexPointer(2,GL_FLOAT,0,va)
|
250
|
+
|
251
|
+
glEnable(GL_VERTEX_ARRAY)
|
252
|
+
|
253
|
+
buf = glFeedbackBuffer(256,GL_3D)
|
254
|
+
glRenderMode(GL_FEEDBACK)
|
255
|
+
|
256
|
+
data = [0,1,2,3,4,5]
|
257
|
+
buffers = glGenBuffers(3)
|
258
|
+
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,buffers[0])
|
259
|
+
glBufferData(GL_ELEMENT_ARRAY_BUFFER,6,data.pack("C*"),GL_DYNAMIC_DRAW)
|
260
|
+
|
261
|
+
glMultiDrawElements(GL_TRIANGLES,GL_UNSIGNED_BYTE,[3,3],[0,3])
|
262
|
+
|
263
|
+
count = glRenderMode(GL_RENDER)
|
264
|
+
assert_equal(count,(3*3+2)*2)
|
265
|
+
|
266
|
+
glDisable(GL_VERTEX_ARRAY)
|
267
|
+
glDeleteBuffers(buffers)
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
data/test/tc_func_20.rb
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
3
|
+
#
|
4
|
+
# This program is distributed under the terms of the MIT license.
|
5
|
+
# See the included MIT-LICENSE file for the terms of this license.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
8
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
9
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
10
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
11
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
12
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
13
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
|
+
#
|
15
|
+
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
class Test_20 < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
common_setup()
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
common_teardown()
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_glblendequationseparate
|
28
|
+
return if not supported?(2.0)
|
29
|
+
glBlendEquationSeparate(GL_MIN,GL_MAX)
|
30
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB),GL_MIN)
|
31
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA),GL_MAX)
|
32
|
+
glBlendEquationSeparate(GL_MAX,GL_MIN)
|
33
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB),GL_MAX)
|
34
|
+
assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA),GL_MIN)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_stencilops
|
38
|
+
return if not supported?(2.0)
|
39
|
+
|
40
|
+
glStencilOpSeparate(GL_FRONT, GL_ZERO, GL_INCR, GL_DECR)
|
41
|
+
assert_equal(glGetIntegerv(GL_STENCIL_FAIL), GL_ZERO)
|
42
|
+
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL), GL_INCR)
|
43
|
+
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS), GL_DECR)
|
44
|
+
glStencilOpSeparate(GL_FRONT, GL_INCR, GL_DECR, GL_ZERO)
|
45
|
+
assert_equal(glGetIntegerv(GL_STENCIL_FAIL), GL_INCR)
|
46
|
+
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL), GL_DECR)
|
47
|
+
assert_equal(glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS), GL_ZERO)
|
48
|
+
|
49
|
+
glStencilFuncSeparate(GL_FRONT, GL_LEQUAL, 1, 0)
|
50
|
+
assert_equal(glGetIntegerv(GL_STENCIL_FUNC),GL_LEQUAL)
|
51
|
+
assert_equal(glGetIntegerv(GL_STENCIL_REF),1)
|
52
|
+
assert_equal(glGetIntegerv(GL_STENCIL_VALUE_MASK),0)
|
53
|
+
glStencilFuncSeparate(GL_FRONT, GL_GEQUAL, 0, 1)
|
54
|
+
assert_equal(glGetIntegerv(GL_STENCIL_FUNC),GL_GEQUAL)
|
55
|
+
assert_equal(glGetIntegerv(GL_STENCIL_REF),0)
|
56
|
+
assert_equal(glGetIntegerv(GL_STENCIL_VALUE_MASK),1)
|
57
|
+
|
58
|
+
glStencilMaskSeparate(GL_FRONT,1)
|
59
|
+
assert_equal(glGetIntegerv( GL_STENCIL_WRITEMASK),1)
|
60
|
+
glStencilMaskSeparate(GL_FRONT,0)
|
61
|
+
assert_equal(glGetIntegerv(GL_STENCIL_WRITEMASK),0)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_gldrawbuf
|
65
|
+
return if not supported?(2.0)
|
66
|
+
glDrawBuffers([GL_FRONT_LEFT,GL_BACK_LEFT])
|
67
|
+
assert_equal(glGetIntegerv(GL_DRAW_BUFFER0),GL_FRONT_LEFT)
|
68
|
+
assert_equal(glGetIntegerv(GL_DRAW_BUFFER1),GL_BACK_LEFT)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_glvertexattrib
|
72
|
+
return if not supported?(2.0)
|
73
|
+
# 1
|
74
|
+
glVertexAttrib1d(1,2.0)
|
75
|
+
assert_equal(glGetVertexAttribdv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,0.0,0.0,1.0])
|
76
|
+
glVertexAttrib1dv(1,[3.0])
|
77
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,0.0,0.0,1.0])
|
78
|
+
glVertexAttrib1f(1,2.0)
|
79
|
+
assert_equal(glGetVertexAttribiv(1,GL_CURRENT_VERTEX_ATTRIB), [2,0,0,1])
|
80
|
+
glVertexAttrib1fv(1,[3.0])
|
81
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,0.0,0.0,1.0])
|
82
|
+
glVertexAttrib1s(1,2)
|
83
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,0.0,0.0,1.0])
|
84
|
+
glVertexAttrib1sv(1,[3])
|
85
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,0.0,0.0,1.0])
|
86
|
+
# 2
|
87
|
+
glVertexAttrib2d(1,2.0,2.0)
|
88
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,2.0,0.0,1.0])
|
89
|
+
glVertexAttrib2dv(1,[3.0,3.0])
|
90
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,3.0,0.0,1.0])
|
91
|
+
glVertexAttrib2f(1,2.0,2.0)
|
92
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,2.0,0.0,1.0])
|
93
|
+
glVertexAttrib2fv(1,[3.0,3.0])
|
94
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,3.0,0.0,1.0])
|
95
|
+
glVertexAttrib2s(1,2,2)
|
96
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,2.0,0.0,1.0])
|
97
|
+
glVertexAttrib2sv(1,[3,3])
|
98
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,3.0,0.0,1.0])
|
99
|
+
# 3
|
100
|
+
glVertexAttrib3d(1,2.0,2.0,2.0)
|
101
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,2.0,2.0,1.0])
|
102
|
+
glVertexAttrib3dv(1,[3.0,3.0,3.0])
|
103
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,3.0,3.0,1.0])
|
104
|
+
glVertexAttrib3f(1,2.0,2.0,2.0)
|
105
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,2.0,2.0,1.0])
|
106
|
+
glVertexAttrib3fv(1,[3.0,3.0,3.0])
|
107
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,3.0,3.0,1.0])
|
108
|
+
glVertexAttrib3s(1,2,2,2)
|
109
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [2.0,2.0,2.0,1.0])
|
110
|
+
glVertexAttrib3sv(1,[3,3,3])
|
111
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [3.0,3.0,3.0,1.0])
|
112
|
+
# 4N
|
113
|
+
glVertexAttrib4Nbv(1,[2**7-1,2**7-1,2**7-1,2**7-1])
|
114
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
115
|
+
glVertexAttrib4Niv(1,[0,0,0,0])
|
116
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
117
|
+
glVertexAttrib4Nsv(1,[2**15-1,2**15-1,2**15-1,2**15-1])
|
118
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
119
|
+
glVertexAttrib4Nub(1,0,0,0,0)
|
120
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
121
|
+
glVertexAttrib4Nubv(1,[2**8-1,2**8-1,2**8-1,2**8-1])
|
122
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
123
|
+
glVertexAttrib4Nuiv(1,[0,0,0,0])
|
124
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
125
|
+
glVertexAttrib4Nusv(1,[2**16-1,2**16-1,2**16-1,2**16-1])
|
126
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
127
|
+
# 4
|
128
|
+
glVertexAttrib4bv(1,[0,0,0,0])
|
129
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
130
|
+
glVertexAttrib4d(1,1,1,1,1)
|
131
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
132
|
+
glVertexAttrib4dv(1,[0,0,0,0])
|
133
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
134
|
+
glVertexAttrib4f(1,1,1,1,1)
|
135
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
136
|
+
glVertexAttrib4fv(1,[0,0,0,0])
|
137
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
138
|
+
glVertexAttrib4iv(1,[1,1,1,1])
|
139
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
140
|
+
glVertexAttrib4s(1,0,0,0,0)
|
141
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
142
|
+
glVertexAttrib4sv(1,[1,1,1,1])
|
143
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
144
|
+
glVertexAttrib4ubv(1,[0,0,0,0])
|
145
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
146
|
+
glVertexAttrib4uiv(1,[1,1,1,1])
|
147
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [1,1,1,1]))
|
148
|
+
glVertexAttrib4usv(1,[0,0,0,0])
|
149
|
+
assert(approx_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB), [0,0,0,0]))
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_vertexattribpointer
|
153
|
+
return if not supported?(2.0)
|
154
|
+
|
155
|
+
vaa = [1,1,1,1, 2,2,2,2].pack("f*")
|
156
|
+
glVertexAttribPointer(1,4,GL_FLOAT,GL_FALSE,0,vaa)
|
157
|
+
assert_equal(glGetVertexAttribPointerv(1),vaa)
|
158
|
+
|
159
|
+
glEnableVertexAttribArray(1)
|
160
|
+
|
161
|
+
glBegin(GL_POINTS)
|
162
|
+
glArrayElement(1)
|
163
|
+
glEnd()
|
164
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB),[2,2,2,2])
|
165
|
+
|
166
|
+
glDisableVertexAttribArray(1)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_shaders
|
170
|
+
return if not supported?(2.0)
|
171
|
+
|
172
|
+
vertex_shader_source = "void main() { gl_Position = ftransform();}"
|
173
|
+
|
174
|
+
program = glCreateProgram()
|
175
|
+
assert_equal(glIsProgram(program),true)
|
176
|
+
|
177
|
+
vs = glCreateShader(GL_VERTEX_SHADER)
|
178
|
+
assert_equal(glIsShader(vs),true)
|
179
|
+
|
180
|
+
glShaderSource(vs,vertex_shader_source)
|
181
|
+
assert_equal(glGetShaderSource(vs),vertex_shader_source)
|
182
|
+
|
183
|
+
assert_equal(glGetShaderiv(vs, GL_SHADER_TYPE),GL_VERTEX_SHADER)
|
184
|
+
glCompileShader(vs)
|
185
|
+
assert_equal(glGetShaderiv(vs,GL_COMPILE_STATUS),GL_TRUE)
|
186
|
+
|
187
|
+
vslog = glGetShaderInfoLog(vs)
|
188
|
+
assert_equal(vslog.class,String)
|
189
|
+
|
190
|
+
glAttachShader(program,vs)
|
191
|
+
assert_equal(glGetAttachedShaders(program),vs)
|
192
|
+
glDetachShader(program,vs)
|
193
|
+
assert_equal(glGetAttachedShaders(program),nil)
|
194
|
+
glAttachShader(program,vs)
|
195
|
+
|
196
|
+
glValidateProgram(program)
|
197
|
+
assert_equal(glGetProgramiv(program,GL_VALIDATE_STATUS),GL_TRUE)
|
198
|
+
prlog = glGetProgramInfoLog(program)
|
199
|
+
assert_equal(prlog.class,String)
|
200
|
+
|
201
|
+
glLinkProgram(program)
|
202
|
+
assert_equal(glGetProgramiv(program,GL_LINK_STATUS),GL_TRUE)
|
203
|
+
|
204
|
+
glUseProgram(program)
|
205
|
+
assert_equal(glGetIntegerv(GL_CURRENT_PROGRAM),program)
|
206
|
+
|
207
|
+
glUseProgram(0)
|
208
|
+
|
209
|
+
glDetachShader(program,vs)
|
210
|
+
glDeleteShader(vs)
|
211
|
+
assert_equal(glIsShader(vs),false)
|
212
|
+
|
213
|
+
glDeleteProgram(program)
|
214
|
+
assert_equal(glIsProgram(program),false)
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_shaders_2
|
218
|
+
return if not supported?(2.0)
|
219
|
+
|
220
|
+
vertex_shader_source = "attribute vec4 test; uniform float testvec1; uniform vec2 testvec2; uniform vec3 testvec3; uniform vec4 testvec4; uniform int testivec1; uniform ivec2 testivec2; uniform ivec3 testivec3; uniform ivec4 testivec4; void main() { gl_Position = testvec1 * test * testvec2.x * testvec3.x * testivec1 * testivec2.x * testivec3.x * testivec4.x + testvec4;}"
|
221
|
+
program = glCreateProgram()
|
222
|
+
vs = glCreateShader(GL_VERTEX_SHADER)
|
223
|
+
|
224
|
+
glShaderSource(vs,vertex_shader_source)
|
225
|
+
glCompileShader(vs)
|
226
|
+
|
227
|
+
assert_equal(glGetShaderiv(vs,GL_COMPILE_STATUS),GL_TRUE)
|
228
|
+
glAttachShader(program,vs)
|
229
|
+
|
230
|
+
glBindAttribLocation(program,2,"test")
|
231
|
+
glLinkProgram(program)
|
232
|
+
assert_equal(glGetProgramiv(program,GL_LINK_STATUS),GL_TRUE)
|
233
|
+
glUseProgram(program)
|
234
|
+
|
235
|
+
assert_equal(glGetAttribLocation(program,"test"),2)
|
236
|
+
assert((tv1l = glGetUniformLocation(program,"testvec1"))>=0)
|
237
|
+
assert((tv2l = glGetUniformLocation(program,"testvec2"))>=0)
|
238
|
+
assert((tv3l = glGetUniformLocation(program,"testvec3"))>=0)
|
239
|
+
assert((tv4l = glGetUniformLocation(program,"testvec4"))>=0)
|
240
|
+
assert((tv1il = glGetUniformLocation(program,"testivec1"))>=0)
|
241
|
+
assert((tv2il = glGetUniformLocation(program,"testivec2"))>=0)
|
242
|
+
assert((tv3il = glGetUniformLocation(program,"testivec3"))>=0)
|
243
|
+
assert((tv4il = glGetUniformLocation(program,"testivec4"))>=0)
|
244
|
+
|
245
|
+
##
|
246
|
+
assert_equal(glGetActiveAttrib(program,0),[1,GL_FLOAT_VEC4,"test"])
|
247
|
+
assert_equal(glGetActiveUniform(program,tv1il),[1,GL_INT,"testivec1"])
|
248
|
+
|
249
|
+
# f
|
250
|
+
glUniform1f(tv1l,2.0)
|
251
|
+
assert_equal(glGetUniformfv(program,tv1l),2.0)
|
252
|
+
glUniform2f(tv2l,2.0,2.0)
|
253
|
+
assert_equal(glGetUniformfv(program,tv2l),[2.0,2.0])
|
254
|
+
glUniform3f(tv3l,2.0,2.0,2.0)
|
255
|
+
assert_equal(glGetUniformfv(program,tv3l),[2.0,2.0,2.0])
|
256
|
+
glUniform4f(tv4l,2.0,2.0,2.0,2.0)
|
257
|
+
assert_equal(glGetUniformfv(program,tv4l),[2.0,2.0,2.0,2.0])
|
258
|
+
# i
|
259
|
+
glUniform1i(tv1il,3)
|
260
|
+
assert_equal(glGetUniformiv(program,tv1il),3)
|
261
|
+
glUniform2i(tv2il,3,3)
|
262
|
+
assert_equal(glGetUniformiv(program,tv2il),[3,3])
|
263
|
+
glUniform3i(tv3il,3,3,3)
|
264
|
+
assert_equal(glGetUniformiv(program,tv3il),[3,3,3])
|
265
|
+
glUniform4i(tv4il,3,3,3,3)
|
266
|
+
assert_equal(glGetUniformiv(program,tv4il),[3,3,3,3])
|
267
|
+
# fv
|
268
|
+
glUniform1fv(tv1l,[3.0])
|
269
|
+
assert_equal(glGetUniformfv(program,tv1l),3.0)
|
270
|
+
glUniform2fv(tv2l,[3.0,3.0])
|
271
|
+
assert_equal(glGetUniformfv(program,tv2l),[3.0,3.0])
|
272
|
+
glUniform3fv(tv3l,[3.0,3.0,3.0])
|
273
|
+
assert_equal(glGetUniformfv(program,tv3l),[3.0,3.0,3.0])
|
274
|
+
glUniform4fv(tv4l,[3.0,3.0,3.0,3.0])
|
275
|
+
assert_equal(glGetUniformfv(program,tv4l),[3.0,3.0,3.0,3.0])
|
276
|
+
# iv
|
277
|
+
glUniform1iv(tv1il,[2])
|
278
|
+
assert_equal(glGetUniformiv(program,tv1il),2)
|
279
|
+
glUniform2iv(tv2il,[2,2])
|
280
|
+
assert_equal(glGetUniformiv(program,tv2il),[2,2])
|
281
|
+
glUniform3iv(tv3il,[2,2,2])
|
282
|
+
assert_equal(glGetUniformiv(program,tv3il),[2,2,2])
|
283
|
+
glUniform4iv(tv4il,[2,2,2,2])
|
284
|
+
assert_equal(glGetUniformiv(program,tv4il),[2,2,2,2])
|
285
|
+
|
286
|
+
glDeleteShader(vs)
|
287
|
+
glDeleteProgram(program)
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_shaders_3
|
291
|
+
return if not supported?(2.0)
|
292
|
+
|
293
|
+
vertex_shader_source = "uniform mat2 testmat2; uniform mat3 testmat3; uniform mat4 testmat4; void main() { gl_Position = gl_Vertex * testmat4[0].x * testmat3[0].x * testmat2[0].x;}"
|
294
|
+
|
295
|
+
program = glCreateProgram()
|
296
|
+
vs = glCreateShader(GL_VERTEX_SHADER)
|
297
|
+
|
298
|
+
glShaderSource(vs,vertex_shader_source)
|
299
|
+
glCompileShader(vs)
|
300
|
+
|
301
|
+
assert_equal(glGetShaderiv(vs,GL_COMPILE_STATUS),GL_TRUE)
|
302
|
+
glAttachShader(program,vs)
|
303
|
+
|
304
|
+
glLinkProgram(program)
|
305
|
+
assert_equal(glGetProgramiv(program,GL_LINK_STATUS),GL_TRUE)
|
306
|
+
glUseProgram(program)
|
307
|
+
#
|
308
|
+
assert((tm2l = glGetUniformLocation(program,"testmat2"))>=0)
|
309
|
+
assert((tm3l = glGetUniformLocation(program,"testmat3"))>=0)
|
310
|
+
assert((tm4l = glGetUniformLocation(program,"testmat4"))>=0)
|
311
|
+
|
312
|
+
glUniformMatrix2fv(tm2l, GL_TRUE, [0,1, 1,0])
|
313
|
+
assert_equal(glGetUniformfv(program,tm2l),[0,1,1,0])
|
314
|
+
|
315
|
+
glUniformMatrix3fv(tm3l, GL_TRUE, [0,1,0, 1,0,1, 0,1,0])
|
316
|
+
assert_equal(glGetUniformfv(program,tm3l),[0,1,0, 1,0,1, 0,1,0])
|
317
|
+
|
318
|
+
glUniformMatrix4fv(tm4l, GL_TRUE, [0,1,0,1, 1,0,1,0, 0,1,0,1, 1,0,1,0])
|
319
|
+
assert_equal(glGetUniformfv(program,tm4l),[0,1,0,1, 1,0,1,0, 0,1,0,1, 1,0,1,0])
|
320
|
+
end
|
321
|
+
|
322
|
+
|
323
|
+
def test_buffered_vertexattribpointer
|
324
|
+
return if not supported?(2.0)
|
325
|
+
|
326
|
+
vaa = [1,1,1,1, 2,2,2,2].pack("f*")
|
327
|
+
|
328
|
+
buffers = glGenBuffers(1)
|
329
|
+
|
330
|
+
glBindBuffer(GL_ARRAY_BUFFER,buffers[0])
|
331
|
+
glBufferData(GL_ARRAY_BUFFER,8*4,vaa,GL_DYNAMIC_DRAW)
|
332
|
+
|
333
|
+
glVertexAttribPointer(1,4,GL_FLOAT,GL_FALSE,0,0)
|
334
|
+
assert_equal(glGetVertexAttribPointerv(1),0)
|
335
|
+
|
336
|
+
glEnableVertexAttribArray(1)
|
337
|
+
|
338
|
+
glBegin(GL_POINTS)
|
339
|
+
glArrayElement(1)
|
340
|
+
glEnd()
|
341
|
+
assert_equal(glGetVertexAttribfv(1,GL_CURRENT_VERTEX_ATTRIB),[2,2,2,2])
|
342
|
+
|
343
|
+
glDisableVertexAttribArray(1)
|
344
|
+
glDeleteBuffers(buffers)
|
345
|
+
end
|
346
|
+
end
|