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,29 @@
|
|
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 TestGlExtGremedy < OpenGL::TestCase
|
19
|
+
|
20
|
+
def test_gl_gremedy_string_marker
|
21
|
+
supported?("GL_GREMEDY_string_marker")
|
22
|
+
glStringMarkerGREMEDY("test")
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_gl_gremedy_frame_terminator
|
26
|
+
supported?("GL_GREMEDY_frame_terminator")
|
27
|
+
glFrameTerminatorGREMEDY()
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,349 @@
|
|
1
|
+
# Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
2
|
+
#
|
3
|
+
# This program is distributed under the terms of the MIT license.
|
4
|
+
# See the included MIT-LICENSE file for the terms of this license.
|
5
|
+
#
|
6
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
7
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
9
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
10
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
11
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
12
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
13
|
+
#
|
14
|
+
|
15
|
+
require 'opengl/test_case'
|
16
|
+
|
17
|
+
class TestGlExtNv < OpenGL::TestCase
|
18
|
+
|
19
|
+
def test_gl_nv_vertex_program
|
20
|
+
supported?("GL_NV_vertex_program")
|
21
|
+
|
22
|
+
assert_equal(false, glIsProgramNV(0))
|
23
|
+
programs = glGenProgramsNV(2)
|
24
|
+
assert_equal(2, programs.size)
|
25
|
+
|
26
|
+
program = "!!VSP1.0\nEND"
|
27
|
+
|
28
|
+
glBindProgramNV(GL_VERTEX_PROGRAM_NV, programs[1])
|
29
|
+
glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, programs[0], program)
|
30
|
+
assert_equal(program, glGetProgramStringNV(programs[0], GL_PROGRAM_STRING_NV))
|
31
|
+
assert_equal(true, glIsProgramNV(programs[0]))
|
32
|
+
|
33
|
+
assert_equal(program.size, glGetProgramivNV(programs[0],GL_PROGRAM_LENGTH_NV))
|
34
|
+
|
35
|
+
glVertexAttribPointerNV(1,2,GL_FLOAT,0,[1,1].pack("f*"))
|
36
|
+
assert_equal([1,1].pack("f*"), glGetVertexAttribPointervNV(1))
|
37
|
+
|
38
|
+
glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV,programs[0],[1,1,1,1])
|
39
|
+
|
40
|
+
glProgramParameter4dNV(GL_VERTEX_PROGRAM_NV,1, 1,2,3,4)
|
41
|
+
assert_equal([1,2,3,4], glGetProgramParameterdvNV(GL_VERTEX_PROGRAM_NV,1,GL_PROGRAM_PARAMETER_NV))
|
42
|
+
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV,1, 5,6,7,8)
|
43
|
+
assert_equal([5,6,7,8], glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV,1,GL_PROGRAM_PARAMETER_NV))
|
44
|
+
glProgramParameter4dvNV(GL_VERTEX_PROGRAM_NV,1, [1,2,3,4])
|
45
|
+
assert_equal([1,2,3,4], glGetProgramParameterdvNV(GL_VERTEX_PROGRAM_NV,1,GL_PROGRAM_PARAMETER_NV))
|
46
|
+
glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV,1, [5,6,7,8])
|
47
|
+
assert_equal([5,6,7,8], glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV,1,GL_PROGRAM_PARAMETER_NV))
|
48
|
+
|
49
|
+
glProgramParameters4fvNV(GL_VERTEX_PROGRAM_NV,1, [1,2,3,4,5,6,7,8])
|
50
|
+
assert_equal([1,2,3,4], glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV,1,GL_PROGRAM_PARAMETER_NV))
|
51
|
+
assert_equal([5,6,7,8], glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV,2,GL_PROGRAM_PARAMETER_NV))
|
52
|
+
|
53
|
+
glProgramParameters4dvNV(GL_VERTEX_PROGRAM_NV,1, [8,7,6,5,4,3,2,1])
|
54
|
+
assert_equal([8,7,6,5], glGetProgramParameterdvNV(GL_VERTEX_PROGRAM_NV,1,GL_PROGRAM_PARAMETER_NV))
|
55
|
+
assert_equal([4,3,2,1], glGetProgramParameterdvNV(GL_VERTEX_PROGRAM_NV,2,GL_PROGRAM_PARAMETER_NV))
|
56
|
+
|
57
|
+
|
58
|
+
glVertexAttrib1dNV(1,1)
|
59
|
+
assert_equal(1, glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
60
|
+
glVertexAttrib1fNV(1,2)
|
61
|
+
assert_equal(2, glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
62
|
+
glVertexAttrib1sNV(1,3)
|
63
|
+
assert_equal(3, glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
64
|
+
glVertexAttrib1dvNV(1,[1])
|
65
|
+
assert_equal(1, glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
66
|
+
glVertexAttrib1fvNV(1,[2])
|
67
|
+
assert_equal(2, glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
68
|
+
glVertexAttrib1svNV(1,[3])
|
69
|
+
assert_equal(3, glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
70
|
+
|
71
|
+
glVertexAttrib2dNV(1,1,2)
|
72
|
+
assert_equal([1,2], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
73
|
+
glVertexAttrib2fNV(1,2,3)
|
74
|
+
assert_equal([2,3], glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
75
|
+
glVertexAttrib2sNV(1,3,4)
|
76
|
+
assert_equal([3,4], glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
77
|
+
glVertexAttrib2dvNV(1,[1,2])
|
78
|
+
assert_equal([1,2], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
79
|
+
glVertexAttrib2fvNV(1,[2,3])
|
80
|
+
assert_equal([2,3], glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
81
|
+
glVertexAttrib2svNV(1,[3,4])
|
82
|
+
assert_equal([3,4], glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
83
|
+
|
84
|
+
glVertexAttrib3dNV(1,1,2,3)
|
85
|
+
assert_equal([1,2,3], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
86
|
+
glVertexAttrib3fNV(1,2,3,4)
|
87
|
+
assert_equal([2,3,4], glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
88
|
+
glVertexAttrib3sNV(1,3,4,5)
|
89
|
+
assert_equal([3,4,5], glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
90
|
+
glVertexAttrib3dvNV(1,[1,2,3])
|
91
|
+
assert_equal([1,2,3], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
92
|
+
glVertexAttrib3fvNV(1,[2,3,4])
|
93
|
+
assert_equal([2,3,4], glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
94
|
+
glVertexAttrib3svNV(1,[3,4,5])
|
95
|
+
assert_equal([3,4,5], glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
96
|
+
|
97
|
+
glVertexAttrib4dNV(1,1,2,3,4)
|
98
|
+
assert_equal([1,2,3,4], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
99
|
+
glVertexAttrib4fNV(1,2,3,4,5)
|
100
|
+
assert_equal([2,3,4,5], glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
101
|
+
glVertexAttrib4sNV(1,3,4,5,6)
|
102
|
+
assert_equal([3,4,5,6], glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
103
|
+
glVertexAttrib4dvNV(1,[1,2,3,4])
|
104
|
+
assert_equal([1,2,3,4], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
105
|
+
glVertexAttrib4fvNV(1,[2,3,4,5])
|
106
|
+
assert_equal([2,3,4,5], glGetVertexAttribfvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
107
|
+
glVertexAttrib4svNV(1,[3,4,5,6])
|
108
|
+
assert_equal([3,4,5,6], glGetVertexAttribivNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
109
|
+
|
110
|
+
glVertexAttrib4ubNV(1,2**8-1,0,2**8-1,0)
|
111
|
+
assert_equal([1,0,1,0], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
112
|
+
glVertexAttrib4ubvNV(1,[0,2**8-1,0,2**8-1])
|
113
|
+
assert_equal([0,1,0,1], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
114
|
+
|
115
|
+
glVertexAttribs1dvNV(1,[1,2])
|
116
|
+
assert_equal(1, glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
117
|
+
assert_equal(2, glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0])
|
118
|
+
glVertexAttribs1fvNV(1,[3,4])
|
119
|
+
assert_equal(3, glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
120
|
+
assert_equal(4, glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0])
|
121
|
+
glVertexAttribs1svNV(1,[5,6])
|
122
|
+
assert_equal(5, glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0])
|
123
|
+
assert_equal(6, glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0])
|
124
|
+
|
125
|
+
glVertexAttribs2dvNV(1,[1,2,3,4])
|
126
|
+
assert_equal([1,2], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
127
|
+
assert_equal([3,4], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,2])
|
128
|
+
glVertexAttribs2fvNV(1,[3,4,5,6])
|
129
|
+
assert_equal([3,4], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
130
|
+
assert_equal([5,6], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,2])
|
131
|
+
glVertexAttribs2svNV(1,[5,6,7,8])
|
132
|
+
assert_equal([5,6], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,2])
|
133
|
+
assert_equal([7,8], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,2])
|
134
|
+
|
135
|
+
glVertexAttribs3dvNV(1,[1,2,3,4,5,6])
|
136
|
+
assert_equal([1,2,3], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
137
|
+
assert_equal([4,5,6], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,3])
|
138
|
+
glVertexAttribs3fvNV(1,[3,4,5,6,7,8])
|
139
|
+
assert_equal([3,4,5], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
140
|
+
assert_equal([6,7,8], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,3])
|
141
|
+
glVertexAttribs3svNV(1,[5,6,7,8,9,10])
|
142
|
+
assert_equal([5,6,7], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,3])
|
143
|
+
assert_equal([8,9,10], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,3])
|
144
|
+
|
145
|
+
glVertexAttribs4dvNV(1,[1,2,3,4,5,6,7,8])
|
146
|
+
assert_equal([1,2,3,4], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
147
|
+
assert_equal([5,6,7,8], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,4])
|
148
|
+
glVertexAttribs4fvNV(1,[3,4,5,6,7,8,9,10])
|
149
|
+
assert_equal([3,4,5,6], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
150
|
+
assert_equal([7,8,9,10], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,4])
|
151
|
+
glVertexAttribs4svNV(1,[5,6,7,8,9,10,11,12])
|
152
|
+
assert_equal([5,6,7,8], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
153
|
+
assert_equal([9,10,11,12], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,4])
|
154
|
+
glVertexAttribs4ubvNV(1,[2**8-1,0,2**8-1,0,2**8-1,0,2**8-1,0])
|
155
|
+
assert_equal([1,0,1,0], glGetVertexAttribdvNV(1,GL_CURRENT_ATTRIB_NV)[0,4])
|
156
|
+
assert_equal([1,0,1,0], glGetVertexAttribdvNV(2,GL_CURRENT_ATTRIB_NV)[0,4])
|
157
|
+
|
158
|
+
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MATRIX0_NV, GL_IDENTITY_NV);
|
159
|
+
assert_equal(GL_MATRIX0_NV, glGetTrackMatrixivNV(GL_VERTEX_PROGRAM_NV, 4, GL_TRACK_MATRIX_NV))
|
160
|
+
|
161
|
+
glRequestResidentProgramsNV(programs[0])
|
162
|
+
res = glAreProgramsResidentNV(programs[0])
|
163
|
+
assert_equal(res.size,1)
|
164
|
+
|
165
|
+
glDeleteProgramsNV(programs)
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_gl_nv_fragment_program
|
169
|
+
supported?("GL_NV_fragment_program")
|
170
|
+
programs = glGenProgramsNV(1)
|
171
|
+
program = "!!FP1.0\nDECLARE test = {0,0,0,0};\nEND"
|
172
|
+
glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, programs[0])
|
173
|
+
glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, programs[0], program)
|
174
|
+
|
175
|
+
glProgramNamedParameter4fNV(programs[0],"test",1,2,3,4)
|
176
|
+
assert_equal([1,2,3,4], glGetProgramNamedParameterfvNV(programs[0],"test"))
|
177
|
+
glProgramNamedParameter4dNV(programs[0],"test",5,6,7,8)
|
178
|
+
assert_equal([5,6,7,8], glGetProgramNamedParameterdvNV(programs[0],"test"))
|
179
|
+
glProgramNamedParameter4fvNV(programs[0],"test",[1,2,3,4])
|
180
|
+
assert_equal([1,2,3,4], glGetProgramNamedParameterfvNV(programs[0],"test"))
|
181
|
+
glProgramNamedParameter4dvNV(programs[0],"test",[5,6,7,8])
|
182
|
+
assert_equal([5,6,7,8], glGetProgramNamedParameterdvNV(programs[0],"test"))
|
183
|
+
|
184
|
+
glDeleteProgramsNV(programs)
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_gl_nv_framebuffer_multisample_coverage
|
188
|
+
supported?("GL_NV_framebuffer_multisample_coverage")
|
189
|
+
rb = glGenRenderbuffersEXT(1)[0]
|
190
|
+
|
191
|
+
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,rb)
|
192
|
+
glRenderbufferStorageMultisampleCoverageNV(GL_RENDERBUFFER_EXT,4,4, GL_RGBA,2,2)
|
193
|
+
samples = glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_COVERAGE_SAMPLES_NV)
|
194
|
+
assert_equal(4, samples)
|
195
|
+
samples = glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_COLOR_SAMPLES_NV)
|
196
|
+
assert_equal(4, samples)
|
197
|
+
|
198
|
+
glDeleteRenderbuffersEXT(rb)
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_gl_nv_fence
|
202
|
+
supported?("GL_NV_fence")
|
203
|
+
fences = glGenFencesNV(2)
|
204
|
+
assert_equal(fences.size,2)
|
205
|
+
|
206
|
+
glSetFenceNV(fences[0],GL_ALL_COMPLETED_NV)
|
207
|
+
assert_equal(GL_ALL_COMPLETED_NV, glGetFenceivNV(fences[0],GL_FENCE_CONDITION_NV))
|
208
|
+
assert_equal(true, glIsFenceNV(fences[0]))
|
209
|
+
|
210
|
+
glFinishFenceNV(fences[0])
|
211
|
+
assert_equal(true, glTestFenceNV(fences[0]))
|
212
|
+
|
213
|
+
glDeleteFencesNV(fences)
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_gl_nv_depth_buffer_float
|
217
|
+
supported?("GL_NV_depth_buffer_float")
|
218
|
+
glDepthRangedNV(0.1,0.2)
|
219
|
+
assert_in_delta([0.1,0.2], glGetFloatv(GL_DEPTH_RANGE))
|
220
|
+
glDepthBoundsdNV(0.1,0.2)
|
221
|
+
assert_in_delta([0.1,0.2], glGetFloatv(GL_DEPTH_BOUNDS_EXT))
|
222
|
+
glClearDepthdNV(0.3)
|
223
|
+
assert_in_delta([0.3], [glGetDoublev(GL_DEPTH_CLEAR_VALUE)])
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_gl_nv_occlusion_query
|
227
|
+
supported?("GL_NV_occlusion_query")
|
228
|
+
|
229
|
+
queries = glGenOcclusionQueriesNV(2)
|
230
|
+
assert_equal(queries.size,2)
|
231
|
+
|
232
|
+
glBeginOcclusionQueryNV(queries[0])
|
233
|
+
assert_equal(true, glIsOcclusionQueryNV(queries[0]))
|
234
|
+
|
235
|
+
glEndOcclusionQueryNV()
|
236
|
+
r = glGetOcclusionQueryivNV(queries[0],GL_PIXEL_COUNT_AVAILABLE_NV)
|
237
|
+
assert(r==GL_TRUE || r==GL_FALSE)
|
238
|
+
assert(glGetOcclusionQueryuivNV(queries[0],GL_PIXEL_COUNT_NV)>=0)
|
239
|
+
|
240
|
+
glDeleteOcclusionQueriesNV(queries)
|
241
|
+
assert_equal(false, glIsOcclusionQueryNV(queries[1]))
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_gl_nv_gpu_program4
|
245
|
+
supported?(["GL_NV_gpu_program4","GL_ARB_vertex_program"])
|
246
|
+
|
247
|
+
programs = glGenProgramsARB(1)
|
248
|
+
program = "!!ARBvp1.0\nTEMP vv;\nEND"
|
249
|
+
|
250
|
+
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, programs[0])
|
251
|
+
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, program)
|
252
|
+
|
253
|
+
glProgramLocalParameterI4iNV(GL_VERTEX_PROGRAM_ARB,1, 1,2,3,4)
|
254
|
+
assert_equal([1,2,3,4], glGetProgramLocalParameterIivNV(GL_VERTEX_PROGRAM_ARB,1))
|
255
|
+
glProgramLocalParameterI4uiNV(GL_VERTEX_PROGRAM_ARB,1, 5,6,7,8)
|
256
|
+
assert_equal([5,6,7,8], glGetProgramLocalParameterIuivNV(GL_VERTEX_PROGRAM_ARB,1))
|
257
|
+
glProgramLocalParameterI4ivNV(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4])
|
258
|
+
assert_equal([1,2,3,4], glGetProgramLocalParameterIivNV(GL_VERTEX_PROGRAM_ARB,1))
|
259
|
+
glProgramLocalParameterI4uivNV(GL_VERTEX_PROGRAM_ARB,1, [5,6,7,8])
|
260
|
+
assert_equal([5,6,7,8], glGetProgramLocalParameterIuivNV(GL_VERTEX_PROGRAM_ARB,1))
|
261
|
+
glProgramLocalParametersI4ivNV(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4])
|
262
|
+
assert_equal([1,2,3,4], glGetProgramLocalParameterIivNV(GL_VERTEX_PROGRAM_ARB,1))
|
263
|
+
glProgramLocalParametersI4uivNV(GL_VERTEX_PROGRAM_ARB,1, [5,6,7,8])
|
264
|
+
assert_equal([5,6,7,8], glGetProgramLocalParameterIuivNV(GL_VERTEX_PROGRAM_ARB,1))
|
265
|
+
|
266
|
+
glProgramEnvParameterI4iNV(GL_VERTEX_PROGRAM_ARB,1, 1,2,3,4)
|
267
|
+
assert_equal([1,2,3,4], glGetProgramEnvParameterIivNV(GL_VERTEX_PROGRAM_ARB,1))
|
268
|
+
glProgramEnvParameterI4uiNV(GL_VERTEX_PROGRAM_ARB,1, 5,6,7,8)
|
269
|
+
assert_equal([5,6,7,8], glGetProgramEnvParameterIuivNV(GL_VERTEX_PROGRAM_ARB,1))
|
270
|
+
glProgramEnvParameterI4ivNV(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4])
|
271
|
+
assert_equal([1,2,3,4], glGetProgramEnvParameterIivNV(GL_VERTEX_PROGRAM_ARB,1))
|
272
|
+
glProgramEnvParameterI4uivNV(GL_VERTEX_PROGRAM_ARB,1, [5,6,7,8])
|
273
|
+
assert_equal([5,6,7,8], glGetProgramEnvParameterIuivNV(GL_VERTEX_PROGRAM_ARB,1))
|
274
|
+
glProgramEnvParametersI4ivNV(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4])
|
275
|
+
assert_equal([1,2,3,4], glGetProgramEnvParameterIivNV(GL_VERTEX_PROGRAM_ARB,1))
|
276
|
+
glProgramEnvParametersI4uivNV(GL_VERTEX_PROGRAM_ARB,1, [5,6,7,8])
|
277
|
+
assert_equal([5,6,7,8], glGetProgramEnvParameterIuivNV(GL_VERTEX_PROGRAM_ARB,1))
|
278
|
+
|
279
|
+
glDeleteProgramsARB(programs)
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_gl_nv_gpu_program4
|
283
|
+
supported?(["GL_NV_gpu_program4","GL_EXT_framebuffer_object"])
|
284
|
+
geometry_program = <<-EOP
|
285
|
+
!!NVgp4.0
|
286
|
+
PRIMITIVE_IN TRIANGLES;
|
287
|
+
PRIMITIVE_OUT TRIANGLE_STRIP;
|
288
|
+
VERTICES_OUT 1;
|
289
|
+
END
|
290
|
+
EOP
|
291
|
+
|
292
|
+
program_id = glGenProgramsARB(1)[0]
|
293
|
+
glBindProgramARB(GL_GEOMETRY_PROGRAM_NV, program_id)
|
294
|
+
glProgramStringARB(GL_GEOMETRY_PROGRAM_NV, GL_PROGRAM_FORMAT_ASCII_ARB, geometry_program);
|
295
|
+
|
296
|
+
assert_equal(1, glGetProgramivARB(GL_GEOMETRY_PROGRAM_NV,GL_GEOMETRY_VERTICES_OUT_EXT))
|
297
|
+
glProgramVertexLimitNV(GL_GEOMETRY_PROGRAM_NV, 2)
|
298
|
+
assert_equal(2, glGetProgramivARB(GL_GEOMETRY_PROGRAM_NV,GL_GEOMETRY_VERTICES_OUT_EXT))
|
299
|
+
|
300
|
+
#
|
301
|
+
|
302
|
+
fbo = glGenFramebuffersEXT(1)[0]
|
303
|
+
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fbo)
|
304
|
+
|
305
|
+
texture2d,texture3d,texture_cube = glGenTextures(3)
|
306
|
+
glBindTexture(GL_TEXTURE_2D, texture2d)
|
307
|
+
glBindTexture(GL_TEXTURE_3D, texture3d)
|
308
|
+
glBindTexture(GL_TEXTURE_CUBE_MAP, texture_cube)
|
309
|
+
|
310
|
+
glFramebufferTextureEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,texture2d, 0)
|
311
|
+
assert_equal(texture2d, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT))
|
312
|
+
assert_equal(0, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT))
|
313
|
+
glFramebufferTextureLayerEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,texture3d, 0,1)
|
314
|
+
assert_equal(texture3d, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT))
|
315
|
+
assert_equal(0, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT))
|
316
|
+
assert_equal(1, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT))
|
317
|
+
|
318
|
+
glFramebufferTextureFaceEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,texture_cube,0,GL_TEXTURE_CUBE_MAP_POSITIVE_X)
|
319
|
+
assert_equal(texture_cube, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT))
|
320
|
+
assert_equal(0, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT))
|
321
|
+
assert_equal(GL_TEXTURE_CUBE_MAP_POSITIVE_X, glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT))
|
322
|
+
|
323
|
+
glDeleteTextures([texture2d,texture3d])
|
324
|
+
glDeleteFramebuffersEXT(fbo)
|
325
|
+
glDeleteProgramsARB(program_id)
|
326
|
+
end
|
327
|
+
|
328
|
+
def test_gl_nv_primitive_restart
|
329
|
+
supported?("GL_NV_primitive_restart")
|
330
|
+
glBegin(GL_TRIANGLES)
|
331
|
+
glPrimitiveRestartNV()
|
332
|
+
glEnd
|
333
|
+
glPrimitiveRestartIndexNV(2)
|
334
|
+
assert_equal(glGetIntegerv(GL_PRIMITIVE_RESTART_INDEX_NV),2)
|
335
|
+
end
|
336
|
+
|
337
|
+
def test_gl_nv_point_sprite
|
338
|
+
supported?("GL_NV_point_sprite")
|
339
|
+
glPointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, GL_ZERO)
|
340
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_POINT_SPRITE_R_MODE_NV))
|
341
|
+
glPointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, GL_S)
|
342
|
+
assert_equal(GL_S, glGetIntegerv(GL_POINT_SPRITE_R_MODE_NV))
|
343
|
+
|
344
|
+
glPointParameterivNV(GL_POINT_SPRITE_R_MODE_NV, [GL_ZERO])
|
345
|
+
assert_equal(GL_ZERO, glGetIntegerv(GL_POINT_SPRITE_R_MODE_NV))
|
346
|
+
glPointParameterivNV(GL_POINT_SPRITE_R_MODE_NV, [GL_S])
|
347
|
+
assert_equal(GL_S, glGetIntegerv(GL_POINT_SPRITE_R_MODE_NV))
|
348
|
+
end
|
349
|
+
end
|
data/test/test_glimpl.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'opengl/test_case'
|
2
|
+
|
3
|
+
class TestGlimpl < OpenGL::TestCase
|
4
|
+
def test_dl_load_error
|
5
|
+
assert_raises(LoadError){ Gl::Implementation.open("not exist") }
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_GetProcAddress_error
|
9
|
+
assert_raises(NotImplementedError){ Gl::Implementation.open(Gl::DefaultImplementation::DLPATH, "not exist") }
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_close
|
13
|
+
gl = Gl::DefaultImplementation.open
|
14
|
+
assert_nil gl.close
|
15
|
+
assert_nil gl.close
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_instance_methods
|
19
|
+
gl = Gl::DefaultImplementation.open
|
20
|
+
assert_match(/^\d+\.\d+/, gl.glGetString(GL::VERSION))
|
21
|
+
assert_kind_of(Array, gl.glGetIntegerv(GL::VIEWPORT))
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'opengl/test_case'
|
2
|
+
|
3
|
+
class TestOpenGLBuffer < OpenGL::TestCase
|
4
|
+
|
5
|
+
def test_class_map
|
6
|
+
buffer = glGenBuffers(1).first
|
7
|
+
|
8
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
9
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
10
|
+
|
11
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_ONLY
|
12
|
+
assert_equal 'hello', buf.read(5)
|
13
|
+
|
14
|
+
ensure
|
15
|
+
buf.unmap
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_read_length
|
19
|
+
buffer = glGenBuffers(1).first
|
20
|
+
|
21
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
22
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
23
|
+
|
24
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_ONLY
|
25
|
+
assert_equal 'he', buf.read(2)
|
26
|
+
ensure
|
27
|
+
buf.unmap
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_read_offset
|
31
|
+
buffer = glGenBuffers(1).first
|
32
|
+
|
33
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
34
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
35
|
+
|
36
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_ONLY
|
37
|
+
assert_equal 'el', buf.read(2, 1)
|
38
|
+
ensure
|
39
|
+
buf.unmap
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_read_unbounded
|
43
|
+
buffer = glGenBuffers(1).first
|
44
|
+
|
45
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
46
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
47
|
+
|
48
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_ONLY
|
49
|
+
|
50
|
+
e = assert_raises ArgumentError do
|
51
|
+
buf.read
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_equal 'length must be provided for unbounded buffer', e.message
|
55
|
+
ensure
|
56
|
+
buf.unmap
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_write
|
60
|
+
buffer = glGenBuffers(1).first
|
61
|
+
|
62
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
63
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
64
|
+
|
65
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_WRITE
|
66
|
+
|
67
|
+
buf.write 'world'
|
68
|
+
assert_equal 'world', buf.read(5)
|
69
|
+
|
70
|
+
buf.unmap
|
71
|
+
assert_equal 'world', glGetBufferSubData(GL_ARRAY_BUFFER, 0, 5)
|
72
|
+
ensure
|
73
|
+
buf.unmap
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_write_nil
|
77
|
+
buffer = glGenBuffers(1).first
|
78
|
+
|
79
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
80
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
81
|
+
|
82
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_WRITE
|
83
|
+
|
84
|
+
e = assert_raises ArgumentError do
|
85
|
+
buf.write nil
|
86
|
+
end
|
87
|
+
|
88
|
+
assert_equal 'cannot write nil to buffer', e.message
|
89
|
+
ensure
|
90
|
+
buf.unmap
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_write_offset
|
94
|
+
buffer = glGenBuffers(1).first
|
95
|
+
|
96
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
97
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
98
|
+
|
99
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_WRITE
|
100
|
+
|
101
|
+
buf.write 'O', 4
|
102
|
+
assert_equal 'hellO', buf.read(5)
|
103
|
+
ensure
|
104
|
+
buf.unmap
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_write_unmapped
|
108
|
+
buffer = glGenBuffers(1).first
|
109
|
+
|
110
|
+
glBindBuffer GL_ARRAY_BUFFER, buffer
|
111
|
+
glBufferData GL_ARRAY_BUFFER, 5, 'hello', GL_STREAM_READ
|
112
|
+
|
113
|
+
buf = OpenGL::Buffer.map GL_ARRAY_BUFFER, GL_READ_WRITE
|
114
|
+
buf.unmap
|
115
|
+
|
116
|
+
e = assert_raises ArgumentError do
|
117
|
+
buf.write 'hello'
|
118
|
+
end
|
119
|
+
|
120
|
+
assert_equal 'write to unmapped buffer', e.message
|
121
|
+
end
|
122
|
+
end
|