opengl 0.7.0.pre1-x86-mingw32

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