ruby-opengl 0.60.1 → 0.61.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. metadata +36 -186
  2. data/Rakefile +0 -168
  3. data/doc/build_install.txt +0 -122
  4. data/doc/extensions.txt +0 -556
  5. data/doc/extensions.txt.in +0 -348
  6. data/doc/history.txt +0 -66
  7. data/doc/requirements_and_design.txt +0 -117
  8. data/doc/roadmap.txt +0 -28
  9. data/doc/scientific_use.txt +0 -35
  10. data/doc/supplies/page_template.html +0 -71
  11. data/doc/thanks.txt +0 -29
  12. data/doc/tutorial.txt +0 -469
  13. data/examples/NeHe/nehe_lesson02.rb +0 -117
  14. data/examples/NeHe/nehe_lesson03.rb +0 -122
  15. data/examples/NeHe/nehe_lesson04.rb +0 -133
  16. data/examples/NeHe/nehe_lesson05.rb +0 -186
  17. data/examples/NeHe/nehe_lesson36.rb +0 -303
  18. data/examples/OrangeBook/3Dlabs-License.txt +0 -33
  19. data/examples/OrangeBook/brick.frag +0 -36
  20. data/examples/OrangeBook/brick.rb +0 -376
  21. data/examples/OrangeBook/brick.vert +0 -41
  22. data/examples/OrangeBook/particle.frag +0 -17
  23. data/examples/OrangeBook/particle.rb +0 -406
  24. data/examples/OrangeBook/particle.vert +0 -38
  25. data/examples/README +0 -16
  26. data/examples/RedBook/aapoly.rb +0 -142
  27. data/examples/RedBook/aargb.rb +0 -119
  28. data/examples/RedBook/accanti.rb +0 -162
  29. data/examples/RedBook/accpersp.rb +0 -215
  30. data/examples/RedBook/alpha.rb +0 -123
  31. data/examples/RedBook/alpha3D.rb +0 -158
  32. data/examples/RedBook/bezcurve.rb +0 -105
  33. data/examples/RedBook/bezmesh.rb +0 -137
  34. data/examples/RedBook/checker.rb +0 -124
  35. data/examples/RedBook/clip.rb +0 -95
  36. data/examples/RedBook/colormat.rb +0 -135
  37. data/examples/RedBook/cube.rb +0 -69
  38. data/examples/RedBook/depthcue.rb +0 -99
  39. data/examples/RedBook/dof.rb +0 -205
  40. data/examples/RedBook/double.rb +0 -105
  41. data/examples/RedBook/drawf.rb +0 -91
  42. data/examples/RedBook/feedback.rb +0 -145
  43. data/examples/RedBook/fog.rb +0 -167
  44. data/examples/RedBook/font.rb +0 -151
  45. data/examples/RedBook/hello.rb +0 -79
  46. data/examples/RedBook/image.rb +0 -137
  47. data/examples/RedBook/jitter.rb +0 -207
  48. data/examples/RedBook/lines.rb +0 -128
  49. data/examples/RedBook/list.rb +0 -111
  50. data/examples/RedBook/material.rb +0 -275
  51. data/examples/RedBook/mipmap.rb +0 -156
  52. data/examples/RedBook/model.rb +0 -113
  53. data/examples/RedBook/movelight.rb +0 -132
  54. data/examples/RedBook/pickdepth.rb +0 -179
  55. data/examples/RedBook/planet.rb +0 -108
  56. data/examples/RedBook/quadric.rb +0 -158
  57. data/examples/RedBook/robot.rb +0 -115
  58. data/examples/RedBook/select.rb +0 -196
  59. data/examples/RedBook/smooth.rb +0 -95
  60. data/examples/RedBook/stencil.rb +0 -163
  61. data/examples/RedBook/stroke.rb +0 -167
  62. data/examples/RedBook/surface.rb +0 -166
  63. data/examples/RedBook/teaambient.rb +0 -132
  64. data/examples/RedBook/teapots.rb +0 -182
  65. data/examples/RedBook/tess.rb +0 -183
  66. data/examples/RedBook/texbind.rb +0 -147
  67. data/examples/RedBook/texgen.rb +0 -169
  68. data/examples/RedBook/texturesurf.rb +0 -128
  69. data/examples/RedBook/varray.rb +0 -159
  70. data/examples/RedBook/wrap.rb +0 -148
  71. data/examples/misc/OGLBench.rb +0 -337
  72. data/examples/misc/anisotropic.rb +0 -194
  73. data/examples/misc/fbo_test.rb +0 -356
  74. data/examples/misc/font-glut.rb +0 -46
  75. data/examples/misc/glfwtest.rb +0 -30
  76. data/examples/misc/plane.rb +0 -161
  77. data/examples/misc/readpixel.rb +0 -65
  78. data/examples/misc/sdltest.rb +0 -34
  79. data/examples/misc/trislam.rb +0 -828
  80. data/ext/common/common.h +0 -423
  81. data/ext/common/conv.h +0 -244
  82. data/ext/common/funcdef.h +0 -280
  83. data/ext/common/gl-enums.h +0 -10031
  84. data/ext/common/gl-error.h +0 -23
  85. data/ext/common/gl-types.h +0 -61
  86. data/ext/common/glu-enums.h +0 -463
  87. data/ext/gl/gl-1.0-1.1.c +0 -2817
  88. data/ext/gl/gl-1.2.c +0 -814
  89. data/ext/gl/gl-1.3.c +0 -444
  90. data/ext/gl/gl-1.4.c +0 -349
  91. data/ext/gl/gl-1.5.c +0 -225
  92. data/ext/gl/gl-2.0.c +0 -657
  93. data/ext/gl/gl-2.1.c +0 -57
  94. data/ext/gl/gl-enums.c +0 -3354
  95. data/ext/gl/gl-error.c +0 -104
  96. data/ext/gl/gl-ext-3dfx.c +0 -27
  97. data/ext/gl/gl-ext-arb.c +0 -866
  98. data/ext/gl/gl-ext-ati.c +0 -41
  99. data/ext/gl/gl-ext-ext.c +0 -890
  100. data/ext/gl/gl-ext-gremedy.c +0 -41
  101. data/ext/gl/gl-ext-nv.c +0 -679
  102. data/ext/gl/gl.c +0 -214
  103. data/ext/gl/mkrf_conf.rb +0 -34
  104. data/ext/glu/glu-enums.c +0 -164
  105. data/ext/glu/glu.c +0 -1530
  106. data/ext/glu/mkrf_conf.rb +0 -35
  107. data/ext/glut/glut.c +0 -1623
  108. data/ext/glut/mkrf_conf.rb +0 -37
  109. data/lib/opengl.rb +0 -84
  110. data/test/README +0 -10
  111. data/test/tc_common.rb +0 -98
  112. data/test/tc_ext_arb.rb +0 -467
  113. data/test/tc_ext_ati.rb +0 -33
  114. data/test/tc_ext_ext.rb +0 -551
  115. data/test/tc_ext_gremedy.rb +0 -36
  116. data/test/tc_ext_nv.rb +0 -357
  117. data/test/tc_func_10_11.rb +0 -1281
  118. data/test/tc_func_12.rb +0 -186
  119. data/test/tc_func_13.rb +0 -229
  120. data/test/tc_func_14.rb +0 -197
  121. data/test/tc_func_15.rb +0 -270
  122. data/test/tc_func_20.rb +0 -346
  123. data/test/tc_func_21.rb +0 -541
  124. data/test/tc_glu.rb +0 -310
  125. data/test/tc_include_gl.rb +0 -35
  126. data/test/tc_misc.rb +0 -54
  127. data/test/tc_require_gl.rb +0 -34
@@ -1,270 +0,0 @@
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
@@ -1,346 +0,0 @@
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