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,310 +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
- require 'glu'
18
- include Glu
19
-
20
- class Test_GLU < Test::Unit::TestCase
21
- def setup
22
- common_setup()
23
- end
24
-
25
- def teardown
26
- common_teardown()
27
- end
28
-
29
- def test_gluortho
30
- res = [ [2.0/$window_size, 0, 0, 0],
31
- [0, 2.0/$window_size, 0, 0],
32
- [0, 0, -1, 0],
33
- [-1,-1,0,1] ]
34
-
35
- glMatrixMode(GL_PROJECTION)
36
- glLoadIdentity()
37
- gluOrtho2D(0,$window_size,0,$window_size)
38
- assert_equal(glGetDoublev(GL_PROJECTION_MATRIX),res)
39
- end
40
-
41
- def test_glugetstring
42
- ver = gluGetString(GLU_VERSION)
43
- assert(ver.to_f > 1.1)
44
- end
45
-
46
- def test_gluerrorstring
47
- error = gluErrorString(GL_INVALID_VALUE)
48
- assert(error.class == String)
49
- assert(error.length > 2)
50
- end
51
-
52
- def test_glubuild2dmipmaps
53
- textures = glGenTextures(1)
54
- glBindTexture(GL_TEXTURE_2D,textures[0])
55
-
56
- image = ([0,0,0,1,1,1] * 8).pack("f*") # 16 RGB pixels
57
-
58
- gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGB8,4,4,GL_RGB,GL_FLOAT,image)
59
- im = glGetTexImage(GL_TEXTURE_2D,0,GL_RGB,GL_FLOAT)
60
- assert_equal(im,image)
61
- assert_equal(im.unpack("f*").size,4*4*3)
62
- im = glGetTexImage(GL_TEXTURE_2D,1,GL_RGB,GL_FLOAT)
63
- assert_equal(im.unpack("f*").size,2*2*3)
64
- im = glGetTexImage(GL_TEXTURE_2D,2,GL_RGB,GL_FLOAT)
65
- assert_equal(im.unpack("f*").size,1*1*3)
66
-
67
- glDeleteTextures(textures)
68
- end
69
-
70
- def test_glubuild1dmipmaps
71
- textures = glGenTextures(1)
72
- glBindTexture(GL_TEXTURE_1D,textures[0])
73
-
74
- image = ([0,0,0,1,1,1] * 2).pack("f*") # 4 RGB pixels
75
-
76
- gluBuild1DMipmaps(GL_TEXTURE_1D,GL_RGB8,4,GL_RGB,GL_FLOAT,image)
77
-
78
- im = glGetTexImage(GL_TEXTURE_1D,0,GL_RGB,GL_FLOAT)
79
- assert_equal(im,image)
80
- assert_equal(im.unpack("f*").size,4*3)
81
- im = glGetTexImage(GL_TEXTURE_1D,1,GL_RGB,GL_FLOAT)
82
- assert_equal(im.unpack("f*").size,2*3)
83
- im = glGetTexImage(GL_TEXTURE_1D,2,GL_RGB,GL_FLOAT)
84
- assert_equal(im.unpack("f*").size,1*3)
85
-
86
- glDeleteTextures(textures)
87
- end
88
-
89
- def test_glulookat
90
- m = [[0,0,1,0], [0,1,0,0], [-1,0,0,0], [0,0,-1, 1]]
91
- gluLookAt(1,0,0, 0,0,0, 0,1,0)
92
- assert_equal(glGetDoublev(GL_PROJECTION_MATRIX),m)
93
- end
94
-
95
- def test_gluproject
96
- pos = gluProject(1,1,1)
97
- assert_equal(pos,[$window_size,$window_size,1])
98
-
99
- mp = glGetDoublev(GL_PROJECTION_MATRIX)
100
- mm = Matrix.rows(glGetDoublev(GL_MODELVIEW_MATRIX))
101
- view = glGetDoublev(GL_VIEWPORT)
102
- pos = gluProject(1,1,1,mp,mm,view)
103
- assert_equal(pos,[$window_size,$window_size,1])
104
-
105
- assert_raise ArgumentError do pos = gluProject(1,1,1,mp,[1,2,3,4],view) end
106
- end
107
-
108
- def test_gluunproject
109
- pos = gluUnProject($window_size,$window_size,1)
110
- assert_equal(pos,[1,1,1])
111
-
112
- mp = glGetDoublev(GL_PROJECTION_MATRIX)
113
- mm = Matrix.rows(glGetDoublev(GL_MODELVIEW_MATRIX))
114
- view = glGetDoublev(GL_VIEWPORT)
115
- pos = gluUnProject($window_size,$window_size,1,mp,mm,view)
116
- assert_equal(pos,[1,1,1])
117
- assert_raise ArgumentError do pos = gluUnProject($window_size,$window_size,1,mp,[1,2,3,4],view) end
118
- end
119
-
120
- def test_glupickmatrix
121
- t = $window_size / 5.0
122
- m = [[t, 0.0, 0.0, 0.0], [0.0, t, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [t,t, 0.0, 1.0]]
123
- glMatrixMode(GL_PROJECTION)
124
- glLoadIdentity()
125
- gluPickMatrix(0,0)
126
- assert(approx_equal(glGetDoublev(GL_PROJECTION_MATRIX).flatten,m.flatten))
127
- glLoadIdentity()
128
- gluPickMatrix(0,0,5,5)
129
- assert(approx_equal(glGetDoublev(GL_PROJECTION_MATRIX).flatten,m.flatten))
130
- glLoadIdentity()
131
- gluPickMatrix(0,0,5,5,glGetDoublev(GL_VIEWPORT))
132
- assert(approx_equal(glGetDoublev(GL_PROJECTION_MATRIX).flatten,m.flatten))
133
- end
134
-
135
- def test_gluperspective
136
- m = [[1,0,0,0], [0,1,0,0], [0,0,-3,-1], [0,0,-4,0]]
137
- gluPerspective(90,1,1,2)
138
- assert_equal(glGetDoublev(GL_PROJECTION_MATRIX),m)
139
- end
140
-
141
- def test_gluscaleimage
142
- image = ([0,0,0,1,1,1] * 8).pack("f*") # 16 RGB pixels
143
- scaled = gluScaleImage(GL_RGB,4,4,GL_FLOAT,image, 2,2,GL_FLOAT)
144
- assert_equal(scaled.unpack("f*").length,2*2*3)
145
- end
146
-
147
- def test_gluquadrics
148
- ecount = 0
149
- error_func = lambda do |error|
150
- ecount+=1
151
- end
152
-
153
- q = gluNewQuadric()
154
- gluQuadricDrawStyle(q,GL_LINE)
155
- gluQuadricNormals(q,GL_SMOOTH)
156
- gluQuadricOrientation(q,GLU_OUTSIDE)
157
- gluQuadricTexture(q,GL_FALSE)
158
- gluQuadricCallback(q,GLU_ERROR,error_func)
159
-
160
- buf = glFeedbackBuffer(1024,GL_3D)
161
- glRenderMode(GL_FEEDBACK)
162
- gluSphere(q,1.0,4,3)
163
- count = glRenderMode(GL_RENDER)
164
- assert(count % 11 == 0)
165
-
166
- glRenderMode(GL_FEEDBACK)
167
- gluCylinder(q,1.0,1.0,1.0,4,3)
168
- count = glRenderMode(GL_RENDER)
169
- assert(count % 11 == 0)
170
-
171
- glRenderMode(GL_FEEDBACK)
172
- gluDisk(q,1.0,2.0,4,3)
173
- count = glRenderMode(GL_RENDER)
174
- assert(count % 11 == 0)
175
-
176
- glRenderMode(GL_FEEDBACK)
177
- gluPartialDisk(q,1.0,2.0,4,3,0,360)
178
- count = glRenderMode(GL_RENDER)
179
- assert(count % 11 == 0)
180
-
181
- gluSphere(q,0.0,0,0)
182
- assert_equal(ecount,1)
183
- gluDeleteQuadric(q)
184
- end
185
-
186
- def test_glunurbs
187
- ecount = 0
188
-
189
- glViewport(0, 0, $window_size, $window_size)
190
- glMatrixMode(GL_PROJECTION)
191
- glOrtho(0, $window_size, 0, $window_size, -1, 1)
192
-
193
- n_error = lambda do |error|
194
- ecount += 1
195
- end
196
-
197
- m = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
198
- m2 = Matrix.rows(m)
199
-
200
- n = gluNewNurbsRenderer()
201
- gluNurbsCallback(n,GLU_ERROR,n_error)
202
- gluNurbsProperty(n,GLU_SAMPLING_TOLERANCE,40)
203
- assert_equal(gluGetNurbsProperty(n,GLU_SAMPLING_TOLERANCE),40)
204
-
205
- gluLoadSamplingMatrices(n,m,m2,glGetIntegerv(GL_VIEWPORT))
206
- assert_raise ArgumentError do gluLoadSamplingMatrices(n,m,[1,2,3,4],glGetIntegerv(GL_VIEWPORT)) end
207
-
208
- knots = [0,0,0,0,1,1,1,1]
209
- ctlpoints_curve = [[50,50,0],[400,50,0],[400,400,0],[50,400,0]]
210
-
211
- # generate surface control points
212
- ctlpoints = Array.new(4).collect { Array.new(4).collect { Array.new(3, nil) } } # 4*4*3 array
213
- 0.upto(3) do |u|
214
- 0.upto(3) do |v|
215
- ctlpoints[u][v][0]=2.0*(u-1.5)
216
- ctlpoints[u][v][1]=2.0*(v-1.5)
217
-
218
- if ((u==1 || u==2) && (v==1 || v==2))
219
- ctlpoints[u][v][2]=6.0
220
- else
221
- ctlpoints[u][v][2]=0.0
222
- end
223
- end
224
- end
225
-
226
- buf = glFeedbackBuffer(1024*1024*8,GL_3D) # large enough buffer for tesselated surface
227
- glRenderMode(GL_FEEDBACK)
228
- gluBeginCurve(n)
229
- gluNurbsCurve(n,knots,ctlpoints_curve,4,GL_MAP1_VERTEX_3)
230
- gluEndCurve(n)
231
-
232
- gluBeginSurface(n)
233
- gluNurbsSurface(n,knots,knots,ctlpoints,4,4,GL_MAP2_VERTEX_3)
234
- gluEndSurface(n)
235
-
236
- gluBeginTrim(n)
237
- gluPwlCurve(n,[[0,0],[1,0],[1,1],[0,1],[0,0]],GLU_MAP1_TRIM_2)
238
- gluEndTrim(n)
239
- count = glRenderMode(GL_RENDER)
240
- assert(count>1)
241
-
242
- gluDeleteNurbsRenderer(n)
243
- assert(ecount>=1)
244
- end
245
-
246
- def test_glutess
247
- glViewport(0, 0, $window_size, $window_size)
248
- glMatrixMode(GL_PROJECTION)
249
- glOrtho(0, $window_size, 0, $window_size, -1, 1)
250
- vcount,bcount,ecount = 0,0,0
251
-
252
- cb_begin = lambda do |type|
253
- bcount += 1
254
- end
255
- cb_end = lambda do
256
- ecount += 1
257
- end
258
- cb_vertex = lambda do |data|
259
- vcount += 1
260
- end
261
- cb_error = lambda do |error|
262
- p gluErrorString(error)
263
- end
264
-
265
- t = gluNewTess()
266
- gluTessCallback(t,GLU_TESS_BEGIN,cb_begin)
267
- gluTessCallback(t,GLU_TESS_END,cb_end)
268
- gluTessCallback(t,GLU_TESS_ERROR,cb_error)
269
- gluTessCallback(t,GLU_TESS_VERTEX,cb_vertex)
270
- gluTessProperty(t,GLU_TESS_BOUNDARY_ONLY,GL_TRUE)
271
- assert_equal(gluGetTessProperty(t,GLU_TESS_BOUNDARY_ONLY),GL_TRUE)
272
- gluTessProperty(t,GLU_TESS_BOUNDARY_ONLY,GL_FALSE)
273
- assert_equal(gluGetTessProperty(t,GLU_TESS_BOUNDARY_ONLY),GL_FALSE)
274
-
275
- gluTessNormal(t, 0.0, 0.0, 0.0)
276
-
277
- rect = [[50.0, 50.0, 0.0],
278
- [200.0, 50.0, 0.0],
279
- [200.0, 200.0, 0.0],
280
- [50.0, 200.0, 0.0]]
281
- tri = [[75.0, 75.0, 0.0],
282
- [125.0, 175.0, 0.0],
283
- [175.0, 75.0, 0.0]]
284
-
285
- gluTessBeginPolygon(t, nil)
286
- gluTessBeginContour(t)
287
- gluTessVertex(t, rect[0], rect[0])
288
- gluTessVertex(t, rect[1], rect[1])
289
- gluTessVertex(t, rect[2], rect[2])
290
- gluTessVertex(t, rect[3], rect[3])
291
- gluTessEndContour(t)
292
- gluTessBeginContour(t)
293
- gluTessVertex(t, tri[0], tri[0])
294
- gluTessVertex(t, tri[1], tri[1])
295
- gluTessVertex(t, tri[2], tri[2])
296
- gluTessEndContour(t)
297
- gluTessEndPolygon(t)
298
-
299
- gluTessCallback(t,GLU_TESS_BEGIN,nil)
300
- gluTessCallback(t,GLU_TESS_END,nil)
301
- gluTessCallback(t,GLU_TESS_ERROR,nil)
302
- gluTessCallback(t,GLU_TESS_VERTEX,nil)
303
-
304
- gluDeleteTess(t)
305
-
306
- assert_equal(bcount,1)
307
- assert_equal(ecount,1)
308
- assert_equal(vcount,3*3)
309
- end
310
- end
@@ -1,35 +0,0 @@
1
- #--
2
- # Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
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
- if __FILE__ == $0
17
- # If we are being called from the command line, e.g., ruby foo.rb, then
18
- # fixup the load path so we can find the OpenGL extension libs
19
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
20
- end
21
-
22
- require 'test/unit'
23
- require 'gl'
24
- include Gl
25
-
26
- # Test that an include of Gl forces makes the OpenGL namespace available in
27
- # the current module.
28
- # include Gl
29
- # ...
30
- # Gl::VERSION exists
31
- class GlIncludeTest < Test::Unit::TestCase
32
- def test_require_of_gl
33
- assert Gl::GL_VERSION
34
- end
35
- end
@@ -1,54 +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
- if __FILE__ == $0
17
- # If we are being called from the command line, e.g., ruby foo.rb, then
18
- # fixup the load path so we can find the OpenGL extension libs
19
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
20
- end
21
-
22
- require 'test/unit'
23
- require 'gl'
24
- require 'glut'
25
- include Gl
26
- include Glut
27
-
28
- class Test_misc < Test::Unit::TestCase
29
- def setup
30
- return if $glut_initialized
31
- glut_init()
32
- $glut_initialized = true
33
- end
34
-
35
- def test_isavailable
36
- assert_equal(is_available?(1.1),true)
37
- assert_equal(is_available?("GL_ARB_multitexture"),true)
38
- assert_equal(is_available?("GL_NON_EXISTENT"),false)
39
- end
40
-
41
- def test_errorchecking
42
- Gl.disable_error_checking
43
- assert_equal(Gl.is_error_checking_enabled?,false)
44
- Gl.enable_error_checking
45
- assert_equal(Gl.is_error_checking_enabled?,true)
46
- begin
47
- glEnable(0)
48
- rescue Gl::Error => err
49
- assert_equal(err.id,GL_INVALID_ENUM)
50
- else
51
- assert(false) # error not detected
52
- end
53
- end
54
- end
@@ -1,34 +0,0 @@
1
- #--
2
- # Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
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
- if __FILE__ == $0
17
- # If we are being called from the command line, e.g., ruby foo.rb, then
18
- # fixup the load path so we can find the OpenGL extension libs
19
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
20
- end
21
-
22
- require 'test/unit'
23
- require 'gl'
24
-
25
- # Test that a require but not include of GL forces the use of the full
26
- # namespace qualifiers:
27
- # require Gl
28
- # ...
29
- # Gl::VERSION exists
30
- class GLRequireTest < Test::Unit::TestCase
31
- def test_require_of_gl
32
- assert Gl::GL_VERSION
33
- end
34
- end