opengl 0.8.0-x86-mingw32 → 0.9.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +2 -0
  4. data/.gitignore +2 -1
  5. data/.travis.yml +19 -0
  6. data/History.rdoc +26 -0
  7. data/Manifest.txt +3 -23
  8. data/README.rdoc +43 -37
  9. data/Rakefile +6 -62
  10. data/examples/NeHe/nehe_lesson02.rb +3 -2
  11. data/examples/NeHe/nehe_lesson03.rb +3 -2
  12. data/examples/NeHe/nehe_lesson04.rb +3 -1
  13. data/examples/NeHe/nehe_lesson05.rb +4 -1
  14. data/examples/NeHe/nehe_lesson06.rb +9 -6
  15. data/examples/NeHe/nehe_lesson07.rb +9 -6
  16. data/examples/NeHe/nehe_lesson08.rb +9 -6
  17. data/examples/NeHe/nehe_lesson09.rb +10 -6
  18. data/examples/NeHe/nehe_lesson11.rb +9 -6
  19. data/examples/NeHe/nehe_lesson12.rb +9 -6
  20. data/examples/NeHe/nehe_lesson16.rb +50 -47
  21. data/examples/NeHe/nehe_lesson19.rb +10 -7
  22. data/examples/NeHe/nehe_lesson36.rb +234 -229
  23. data/examples/OrangeBook/brick.rb +227 -225
  24. data/examples/OrangeBook/particle.rb +233 -231
  25. data/examples/RedBook/aapoly.rb +71 -70
  26. data/examples/RedBook/aargb.rb +54 -52
  27. data/examples/RedBook/accanti.rb +96 -94
  28. data/examples/RedBook/accpersp.rb +106 -104
  29. data/examples/RedBook/alpha.rb +54 -52
  30. data/examples/RedBook/alpha3D.rb +90 -88
  31. data/examples/RedBook/bezcurve.rb +48 -46
  32. data/examples/RedBook/bezmesh.rb +71 -69
  33. data/examples/RedBook/checker.rb +57 -55
  34. data/examples/RedBook/clip.rb +41 -39
  35. data/examples/RedBook/colormat.rb +72 -70
  36. data/examples/RedBook/cube.rb +39 -37
  37. data/examples/RedBook/depthcue.rb +37 -35
  38. data/examples/RedBook/dof.rb +110 -109
  39. data/examples/RedBook/double.rb +40 -38
  40. data/examples/RedBook/drawf.rb +30 -28
  41. data/examples/RedBook/feedback.rb +79 -77
  42. data/examples/RedBook/fog.rb +90 -89
  43. data/examples/RedBook/font.rb +78 -76
  44. data/examples/RedBook/hello.rb +29 -27
  45. data/examples/RedBook/image.rb +57 -55
  46. data/examples/RedBook/jitter.rb +131 -131
  47. data/examples/RedBook/light.rb +2 -1
  48. data/examples/RedBook/lines.rb +70 -68
  49. data/examples/RedBook/list.rb +48 -46
  50. data/examples/RedBook/material.rb +200 -199
  51. data/examples/RedBook/mipmap.rb +84 -82
  52. data/examples/RedBook/model.rb +55 -53
  53. data/examples/RedBook/movelight.rb +52 -50
  54. data/examples/RedBook/pickdepth.rb +103 -101
  55. data/examples/RedBook/planet.rb +46 -44
  56. data/examples/RedBook/quadric.rb +97 -95
  57. data/examples/RedBook/robot.rb +55 -53
  58. data/examples/RedBook/select.rb +118 -116
  59. data/examples/RedBook/smooth.rb +35 -33
  60. data/examples/RedBook/stencil.rb +96 -94
  61. data/examples/RedBook/stroke.rb +75 -73
  62. data/examples/RedBook/surface.rb +93 -91
  63. data/examples/RedBook/teaambient.rb +71 -69
  64. data/examples/RedBook/teapots.rb +105 -103
  65. data/examples/RedBook/tess.rb +96 -94
  66. data/examples/RedBook/texbind.rb +79 -77
  67. data/examples/RedBook/texgen.rb +88 -86
  68. data/examples/RedBook/texturesurf.rb +57 -55
  69. data/examples/RedBook/varray.rb +85 -83
  70. data/examples/RedBook/wrap.rb +76 -74
  71. data/examples/misc/OGLBench.rb +114 -113
  72. data/examples/misc/anisotropic.rb +154 -152
  73. data/examples/misc/fbo_test.rb +37 -36
  74. data/examples/misc/font-glut.rb +47 -46
  75. data/examples/misc/glfwtest.rb +16 -16
  76. data/examples/misc/plane.rb +13 -13
  77. data/examples/misc/readpixel.rb +66 -65
  78. data/examples/misc/sdltest.rb +21 -19
  79. data/examples/misc/trislam.rb +548 -547
  80. data/ext/opengl/common.h +16 -38
  81. data/ext/opengl/conv.h +39 -41
  82. data/ext/opengl/extconf.rb +4 -31
  83. data/ext/opengl/funcdef.h +126 -124
  84. data/ext/opengl/gl-1.0-1.1.c +1917 -1917
  85. data/ext/opengl/gl-1.2.c +4 -667
  86. data/ext/opengl/gl-1.3.c +9 -9
  87. data/ext/opengl/gl-1.4.c +8 -8
  88. data/ext/opengl/gl-1.5.c +1 -1
  89. data/ext/opengl/gl-2.0.c +392 -388
  90. data/ext/opengl/gl-3.0.c +493 -0
  91. data/ext/opengl/gl-enums.c +1523 -5
  92. data/ext/opengl/gl-enums.h +4679 -122
  93. data/ext/opengl/gl-error.c +7 -7
  94. data/ext/opengl/gl-error.h +4 -4
  95. data/ext/opengl/gl-ext-arb.c +468 -464
  96. data/ext/opengl/gl-ext-ext.c +18 -18
  97. data/ext/opengl/gl-ext-nv.c +15 -15
  98. data/ext/opengl/gl.c +2 -0
  99. data/ext/opengl/gl_buffer.c +92 -92
  100. data/ext/opengl/opengl.c +1 -7
  101. data/lib/opengl.rb +23 -59
  102. data/lib/opengl/1.9/opengl.so +0 -0
  103. data/lib/opengl/2.0/opengl.so +0 -0
  104. data/lib/opengl/2.1/opengl.so +0 -0
  105. data/lib/opengl/test_case.rb +1 -2
  106. data/test/dummy.xorg.conf +140 -0
  107. data/test/test_gl.rb +18 -22
  108. data/test/test_gl_10_11.rb +220 -220
  109. data/test/test_gl_12.rb +11 -122
  110. data/test/test_gl_13.rb +202 -210
  111. data/test/test_gl_14.rb +16 -19
  112. data/test/test_gl_15.rb +2 -4
  113. data/test/test_gl_20.rb +45 -58
  114. data/test/test_gl_21.rb +46 -163
  115. data/test/test_gl_ext_arb.rb +54 -72
  116. data/test/test_gl_ext_ati.rb +0 -2
  117. data/test/test_gl_ext_ext.rb +66 -66
  118. data/test/test_gl_ext_gremedy.rb +8 -15
  119. data/test/test_gl_ext_nv.rb +109 -112
  120. data/test/test_opengl_buffer.rb +8 -25
  121. data/utils/README +0 -5
  122. data/utils/enumgen.rb +72 -76
  123. data/utils/extlistgen.rb +55 -55
  124. metadata +90 -67
  125. metadata.gz.sig +0 -0
  126. data/Rakefile.cross +0 -107
  127. data/docs/build_install.txt +0 -119
  128. data/docs/extensions.txt.in +0 -348
  129. data/docs/history.txt +0 -66
  130. data/docs/requirements_and_design.txt +0 -117
  131. data/docs/roadmap.txt +0 -28
  132. data/docs/scientific_use.txt +0 -35
  133. data/docs/supplies/page_template.html +0 -71
  134. data/docs/thanks.txt +0 -29
  135. data/docs/tutorial.txt +0 -469
  136. data/ext/opengl/glu-enums.c +0 -164
  137. data/ext/opengl/glu-enums.h +0 -463
  138. data/ext/opengl/glu.c +0 -1534
  139. data/ext/opengl/glut.c +0 -1145
  140. data/ext/opengl/glut_callbacks.c +0 -845
  141. data/lib/glu.rb +0 -1
  142. data/lib/glut.rb +0 -1
  143. data/lib/opengl/opengl.so +0 -0
  144. data/test/test_glu.rb +0 -309
  145. data/utils/mkdn2html.rb +0 -59
  146. data/utils/post-mkdn2html.rb +0 -91
  147. data/website/images/ogl.jpg +0 -0
  148. data/website/images/tab_bottom.gif +0 -0
  149. data/website/style.css +0 -198
@@ -1,13 +1,13 @@
1
1
  #
2
2
  # Copyright (c) 1993-1997, Silicon Graphics, Inc.
3
- # ALL RIGHTS RESERVED
4
- # Permission to use, copy, modify, and distribute this software for
3
+ # ALL RIGHTS RESERVED
4
+ # Permission to use, copy, modify, and distribute this software for
5
5
  # any purpose and without fee is hereby granted, provided that the above
6
6
  # copyright notice appear in all copies and that both the copyright notice
7
- # and this permission notice appear in supporting documentation, and that
7
+ # and this permission notice appear in supporting documentation, and that
8
8
  # the name of Silicon Graphics, Inc. not be used in advertising
9
9
  # or publicity pertaining to distribution of the software without specific,
10
- # written prior permission.
10
+ # written prior permission.
11
11
  #
12
12
  # THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
13
13
  # AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
21
21
  # ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
22
22
  # ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
23
23
  # POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
24
- #
25
- # US Government Users Restricted Rights
24
+ #
25
+ # US Government Users Restricted Rights
26
26
  # Use, duplication, or disclosure by the Government is subject to
27
27
  # restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
28
28
  # (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -37,59 +37,61 @@
37
37
  # clip.c
38
38
  # This program demonstrates arbitrary clipping planes.
39
39
  require 'opengl'
40
+ require 'glu'
41
+ require 'glut'
40
42
  require 'mathn'
41
43
  include Gl,Glu,Glut
42
44
 
43
45
  def init
44
- glClearColor(0.0, 0.0, 0.0, 0.0)
45
- glShadeModel(GL_FLAT)
46
+ glClearColor(0.0, 0.0, 0.0, 0.0)
47
+ glShadeModel(GL_FLAT)
46
48
  end
47
49
 
48
50
  display = Proc.new do
49
- eqn = [0.0, 1.0, 0.0, 0.0]
50
- eqn2 = [1.0, 0.0, 0.0, 0.0]
51
-
52
- glClear(GL_COLOR_BUFFER_BIT)
53
-
54
- glColor(1.0, 1.0, 1.0)
55
- glPushMatrix()
56
- glTranslate(0.0, 0.0, -5.0)
57
-
58
- # clip lower half -- y < 0
59
- glClipPlane(GL_CLIP_PLANE0, eqn)
60
- glEnable(GL_CLIP_PLANE0)
61
- # clip left half -- x < 0
62
- glClipPlane(GL_CLIP_PLANE1, eqn2)
63
- glEnable(GL_CLIP_PLANE1)
64
-
65
- glRotate(90.0, 1.0, 0.0, 0.0)
66
- glutWireSphere(1.0, 20, 16)
67
- glPopMatrix()
68
- glutSwapBuffers()
51
+ eqn = [0.0, 1.0, 0.0, 0.0]
52
+ eqn2 = [1.0, 0.0, 0.0, 0.0]
53
+
54
+ glClear(GL_COLOR_BUFFER_BIT)
55
+
56
+ glColor(1.0, 1.0, 1.0)
57
+ glPushMatrix()
58
+ glTranslate(0.0, 0.0, -5.0)
59
+
60
+ # clip lower half -- y < 0
61
+ glClipPlane(GL_CLIP_PLANE0, eqn)
62
+ glEnable(GL_CLIP_PLANE0)
63
+ # clip left half -- x < 0
64
+ glClipPlane(GL_CLIP_PLANE1, eqn2)
65
+ glEnable(GL_CLIP_PLANE1)
66
+
67
+ glRotate(90.0, 1.0, 0.0, 0.0)
68
+ glutWireSphere(1.0, 20, 16)
69
+ glPopMatrix()
70
+ glutSwapBuffers()
69
71
  end
70
72
 
71
73
  reshape = Proc.new do |w, h|
72
- glViewport(0, 0, w, h)
73
- glMatrixMode(GL_PROJECTION)
74
- glLoadIdentity()
75
- gluPerspective(60.0, w/ h, 1.0, 20.0)
76
- glMatrixMode(GL_MODELVIEW)
74
+ glViewport(0, 0, w, h)
75
+ glMatrixMode(GL_PROJECTION)
76
+ glLoadIdentity()
77
+ gluPerspective(60.0, w/ h, 1.0, 20.0)
78
+ glMatrixMode(GL_MODELVIEW)
77
79
  end
78
80
 
79
81
  keyboard = Proc.new do |key, x, y|
80
- case (key)
81
- when ?\e
82
- exit(0)
83
- end
82
+ case (key)
83
+ when ?\e
84
+ exit(0)
85
+ end
84
86
  end
85
87
 
86
88
  glutInit
87
89
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
88
- glutInitWindowSize(500, 500)
90
+ glutInitWindowSize(500, 500)
89
91
  glutInitWindowPosition(100, 100)
90
92
  glutCreateWindow($0)
91
93
  init()
92
- glutDisplayFunc(display)
94
+ glutDisplayFunc(display)
93
95
  glutReshapeFunc(reshape)
94
96
  glutKeyboardFunc(keyboard)
95
97
  glutMainLoop()
@@ -1,13 +1,13 @@
1
1
  #
2
2
  # Copyright (c) 1993-1997, Silicon Graphics, Inc.
3
- # ALL RIGHTS RESERVED
4
- # Permission to use, copy, modify, and distribute this software for
3
+ # ALL RIGHTS RESERVED
4
+ # Permission to use, copy, modify, and distribute this software for
5
5
  # any purpose and without fee is hereby granted, provided that the above
6
6
  # copyright notice appear in all copies and that both the copyright notice
7
- # and this permission notice appear in supporting documentation, and that
7
+ # and this permission notice appear in supporting documentation, and that
8
8
  # the name of Silicon Graphics, Inc. not be used in advertising
9
9
  # or publicity pertaining to distribution of the software without specific,
10
- # written prior permission.
10
+ # written prior permission.
11
11
  #
12
12
  # THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
13
13
  # AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
21
21
  # ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
22
22
  # ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
23
23
  # POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
24
- #
25
- # US Government Users Restricted Rights
24
+ #
25
+ # US Government Users Restricted Rights
26
26
  # Use, duplication, or disclosure by the Government is subject to
27
27
  # restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
28
28
  # (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -36,9 +36,11 @@
36
36
  #
37
37
  # colormat.c
38
38
  # After initialization, the program will be in
39
- # ColorMaterial mode. Interaction: pressing the
39
+ # ColorMaterial mode. Interaction: pressing the
40
40
  # mouse buttons will change the diffuse reflection values.
41
41
  require 'opengl'
42
+ require 'glu'
43
+ require 'glut'
42
44
  require 'mathn'
43
45
  include Gl,Glu,Glut
44
46
 
@@ -47,88 +49,88 @@ $diffuseMaterial = [0.5,0.5,0.5,1.0]
47
49
  # Initialize material property, light source, lighting model,
48
50
  # and depth buffer.
49
51
  def init
50
- mat_specular = [ 1.0, 1.0, 1.0, 1.0 ]
51
- light_position = [ 1.0, 1.0, 1.0, 0.0 ]
52
-
53
- glClearColor(0.0, 0.0, 0.0, 0.0)
54
- glShadeModel(GL_SMOOTH)
55
- glEnable(GL_DEPTH_TEST)
56
- glMaterial(GL_FRONT, GL_DIFFUSE, $diffuseMaterial)
57
- glMaterial(GL_FRONT, GL_SPECULAR, mat_specular)
58
- glMaterial(GL_FRONT, GL_SHININESS, 25.0)
59
- glLight(GL_LIGHT0, GL_POSITION, light_position)
60
- glEnable(GL_LIGHTING)
61
- glEnable(GL_LIGHT0)
62
-
63
- glColorMaterial(GL_FRONT, GL_DIFFUSE)
64
- glEnable(GL_COLOR_MATERIAL)
52
+ mat_specular = [ 1.0, 1.0, 1.0, 1.0 ]
53
+ light_position = [ 1.0, 1.0, 1.0, 0.0 ]
54
+
55
+ glClearColor(0.0, 0.0, 0.0, 0.0)
56
+ glShadeModel(GL_SMOOTH)
57
+ glEnable(GL_DEPTH_TEST)
58
+ glMaterial(GL_FRONT, GL_DIFFUSE, $diffuseMaterial)
59
+ glMaterial(GL_FRONT, GL_SPECULAR, mat_specular)
60
+ glMaterial(GL_FRONT, GL_SHININESS, 25.0)
61
+ glLight(GL_LIGHT0, GL_POSITION, light_position)
62
+ glEnable(GL_LIGHTING)
63
+ glEnable(GL_LIGHT0)
64
+
65
+ glColorMaterial(GL_FRONT, GL_DIFFUSE)
66
+ glEnable(GL_COLOR_MATERIAL)
65
67
  end
66
68
 
67
69
  display = Proc.new do
68
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
69
- glutSolidSphere(1.0, 20, 16)
70
- glutSwapBuffers()
70
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
71
+ glutSolidSphere(1.0, 20, 16)
72
+ glutSwapBuffers()
71
73
  end
72
74
 
73
75
  reshape = Proc.new do |w, h|
74
- glViewport(0, 0, w, h)
75
- glMatrixMode(GL_PROJECTION)
76
- glLoadIdentity()
77
- if (w <= h)
78
- glOrtho(-1.5, 1.5, -1.5*h/w, 1.5*h/w, -10.0, 10.0)
79
- else
80
- glOrtho(-1.5*w/h, 1.5*w/h, -1.5, 1.5, -10.0, 10.0)
81
- end
82
- glMatrixMode(GL_MODELVIEW)
83
- glLoadIdentity()
76
+ glViewport(0, 0, w, h)
77
+ glMatrixMode(GL_PROJECTION)
78
+ glLoadIdentity()
79
+ if (w <= h)
80
+ glOrtho(-1.5, 1.5, -1.5*h/w, 1.5*h/w, -10.0, 10.0)
81
+ else
82
+ glOrtho(-1.5*w/h, 1.5*w/h, -1.5, 1.5, -10.0, 10.0)
83
+ end
84
+ glMatrixMode(GL_MODELVIEW)
85
+ glLoadIdentity()
84
86
  end
85
87
 
86
88
  mouse = Proc.new do |button, state, x, y|
87
- case (button)
88
- when GLUT_LEFT_BUTTON
89
- if (state == GLUT_DOWN)
90
- $diffuseMaterial[0] = $diffuseMaterial[0] + 0.1
91
- if ($diffuseMaterial[0] > 1.0)
92
- $diffuseMaterial[0] = 0.0
93
- end
94
- glColor($diffuseMaterial)
95
- glutPostRedisplay()
96
- end
97
- when GLUT_MIDDLE_BUTTON
98
- if (state == GLUT_DOWN)
99
- $diffuseMaterial[1] = $diffuseMaterial[1] + 0.1
100
- if ($diffuseMaterial[1] > 1.0)
101
- $diffuseMaterial[1] = 0.0
102
- end
103
- glColor($diffuseMaterial)
104
- glutPostRedisplay()
105
- end
106
- when GLUT_RIGHT_BUTTON
107
- if (state == GLUT_DOWN)
108
- $diffuseMaterial[2] = $diffuseMaterial[2] + 0.1
109
- if ($diffuseMaterial[2] > 1.0)
110
- $diffuseMaterial[2] = 0.0
111
- end
112
- glColor($diffuseMaterial)
113
- glutPostRedisplay()
114
- end
115
- end
89
+ case (button)
90
+ when GLUT_LEFT_BUTTON
91
+ if (state == GLUT_DOWN)
92
+ $diffuseMaterial[0] = $diffuseMaterial[0] + 0.1
93
+ if ($diffuseMaterial[0] > 1.0)
94
+ $diffuseMaterial[0] = 0.0
95
+ end
96
+ glColor($diffuseMaterial)
97
+ glutPostRedisplay()
98
+ end
99
+ when GLUT_MIDDLE_BUTTON
100
+ if (state == GLUT_DOWN)
101
+ $diffuseMaterial[1] = $diffuseMaterial[1] + 0.1
102
+ if ($diffuseMaterial[1] > 1.0)
103
+ $diffuseMaterial[1] = 0.0
104
+ end
105
+ glColor($diffuseMaterial)
106
+ glutPostRedisplay()
107
+ end
108
+ when GLUT_RIGHT_BUTTON
109
+ if (state == GLUT_DOWN)
110
+ $diffuseMaterial[2] = $diffuseMaterial[2] + 0.1
111
+ if ($diffuseMaterial[2] > 1.0)
112
+ $diffuseMaterial[2] = 0.0
113
+ end
114
+ glColor($diffuseMaterial)
115
+ glutPostRedisplay()
116
+ end
117
+ end
116
118
  end
117
119
 
118
120
  keyboard = Proc.new do |key, x, y|
119
- case (key)
120
- when ?\e
121
- exit(0)
122
- end
121
+ case (key)
122
+ when ?\e
123
+ exit(0)
124
+ end
123
125
  end
124
126
 
125
127
  glutInit
126
128
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
127
- glutInitWindowSize(500, 500)
129
+ glutInitWindowSize(500, 500)
128
130
  glutInitWindowPosition(100, 100)
129
131
  glutCreateWindow($0)
130
132
  init()
131
- glutDisplayFunc(display)
133
+ glutDisplayFunc(display)
132
134
  glutReshapeFunc(reshape)
133
135
  glutMouseFunc(mouse)
134
136
  glutKeyboardFunc(keyboard)
@@ -1,61 +1,63 @@
1
1
  #!/usr/bin/env ruby -rubygems
2
2
  require 'opengl'
3
+ require 'glu'
4
+ require 'glut'
3
5
  include Gl,Glu,Glut
4
6
 
5
7
  $light_diffuse = [1.0, 0.0, 0.0, 1.0]
6
8
  $light_position = [1.0, 1.0, 1.0, 0.0]
7
- $n = [
8
- [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0],
9
- [0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.0, -1.0] ]
9
+ $n = [
10
+ [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0],
11
+ [0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.0, -1.0] ]
10
12
  $faces = [
11
- [0, 1, 2, 3], [3, 2, 6, 7], [7, 6, 5, 4],
12
- [4, 5, 1, 0], [5, 6, 2, 1], [7, 4, 0, 3] ]
13
+ [0, 1, 2, 3], [3, 2, 6, 7], [7, 6, 5, 4],
14
+ [4, 5, 1, 0], [5, 6, 2, 1], [7, 4, 0, 3] ]
13
15
  $v = 0
14
16
 
15
17
  def drawBox
16
- for i in (0..5)
17
- glBegin(GL_QUADS)
18
- glNormal(*($n[i]))
19
- glVertex($v[$faces[i][0]])
20
- glVertex($v[$faces[i][1]])
21
- glVertex($v[$faces[i][2]])
22
- glVertex($v[$faces[i][3]])
23
- glEnd()
24
- end
18
+ for i in (0..5)
19
+ glBegin(GL_QUADS)
20
+ glNormal(*($n[i]))
21
+ glVertex($v[$faces[i][0]])
22
+ glVertex($v[$faces[i][1]])
23
+ glVertex($v[$faces[i][2]])
24
+ glVertex($v[$faces[i][3]])
25
+ glEnd()
26
+ end
25
27
  end
26
28
 
27
29
  display = Proc.new do
28
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
29
- drawBox
30
- glutSwapBuffers
30
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
31
+ drawBox
32
+ glutSwapBuffers
31
33
  end
32
34
 
33
35
  def myinit
34
36
  $v = [[-1, -1,1],[-1, -1,-1], [-1,1,-1], [-1,1,1], [1, -1,1],
35
- [1, -1,-1], [1, 1,-1], [1,1,1]]
37
+ [1, -1,-1], [1, 1,-1], [1,1,1]]
36
38
 
37
- glLight(GL_LIGHT0, GL_DIFFUSE, $light_diffuse)
38
- glLight(GL_LIGHT0, GL_POSITION, $light_position)
39
- glEnable(GL_LIGHT0)
40
- glEnable(GL_LIGHTING)
41
-
42
- glEnable(GL_DEPTH_TEST)
43
-
44
- glMatrixMode(GL_PROJECTION)
45
- gluPerspective(40.0, 1.0, 1.0, 10.0)
46
- glMatrixMode(GL_MODELVIEW)
47
- gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
48
-
49
- glTranslate(0.0, 0.0, -1.0)
50
- glRotate(60, 1.0, 0.0, 0.0)
51
- glRotate(-20, 0.0, 0.0, 1.0)
39
+ glLight(GL_LIGHT0, GL_DIFFUSE, $light_diffuse)
40
+ glLight(GL_LIGHT0, GL_POSITION, $light_position)
41
+ glEnable(GL_LIGHT0)
42
+ glEnable(GL_LIGHTING)
43
+
44
+ glEnable(GL_DEPTH_TEST)
45
+
46
+ glMatrixMode(GL_PROJECTION)
47
+ gluPerspective(40.0, 1.0, 1.0, 10.0)
48
+ glMatrixMode(GL_MODELVIEW)
49
+ gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
50
+
51
+ glTranslate(0.0, 0.0, -1.0)
52
+ glRotate(60, 1.0, 0.0, 0.0)
53
+ glRotate(-20, 0.0, 0.0, 1.0)
52
54
  end
53
55
 
54
56
  keyboard = Proc.new do |key, x, y|
55
- case (key)
56
- when ?\e
57
- exit(0);
58
- end
57
+ case (key)
58
+ when ?\e
59
+ exit(0);
60
+ end
59
61
  end
60
62
 
61
63
  glutInit
@@ -2,14 +2,14 @@
2
2
  # Copyright (c) Mark J. Kilgard, 1994.
3
3
  #
4
4
  # (c) Copyright 1993, Silicon Graphics, Inc.
5
- # ALL RIGHTS RESERVED
6
- # Permission to use, copy, modify, and distribute this software for
5
+ # ALL RIGHTS RESERVED
6
+ # Permission to use, copy, modify, and distribute this software for
7
7
  # any purpose and without fee is hereby granted, provided that the above
8
8
  # copyright notice appear in all copies and that both the copyright notice
9
- # and this permission notice appear in supporting documentation, and that
9
+ # and this permission notice appear in supporting documentation, and that
10
10
  # the name of Silicon Graphics, Inc. not be used in advertising
11
11
  # or publicity pertaining to distribution of the software without specific,
12
- # written prior permission.
12
+ # written prior permission.
13
13
  #
14
14
  # THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
15
15
  # AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -23,8 +23,8 @@
23
23
  # ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
24
24
  # ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
25
25
  # POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
26
- #
27
- # US Government Users Restricted Rights
26
+ #
27
+ # US Government Users Restricted Rights
28
28
  # Use, duplication, or disclosure by the Government is subject to
29
29
  # restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
30
30
  # (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -37,53 +37,55 @@
37
37
  # OpenGL(TM) is a trademark of Silicon Graphics, Inc.
38
38
  #
39
39
  # depthcue.c
40
- # This program draws a wireframe model, which uses
40
+ # This program draws a wireframe model, which uses
41
41
  # intensity (brightness) to give clues to distance.
42
42
  # Fog is used to achieve this effect.
43
43
  require 'opengl'
44
+ require 'glu'
45
+ require 'glut'
44
46
  require 'mathn'
45
47
  include Gl,Glu,Glut
46
48
 
47
49
  # Initialize linear fog for depth cueing.
48
50
  def myinit
49
- fogColor = [0.0, 0.0, 0.0, 1.0]
50
-
51
- glEnable(GL_FOG)
52
- glFog(GL_FOG_MODE, GL_LINEAR)
53
- glHint(GL_FOG_HINT, GL_NICEST) # per pixel
54
- glFog(GL_FOG_START, 3.0)
55
- glFog(GL_FOG_END, 5.0)
56
- glFog(GL_FOG_COLOR, fogColor)
57
- glClearColor(0.0, 0.0, 0.0, 1.0)
58
-
59
- glDepthFunc(GL_LESS)
60
- glEnable(GL_DEPTH_TEST)
61
- glShadeModel(GL_FLAT)
51
+ fogColor = [0.0, 0.0, 0.0, 1.0]
52
+
53
+ glEnable(GL_FOG)
54
+ glFog(GL_FOG_MODE, GL_LINEAR)
55
+ glHint(GL_FOG_HINT, GL_NICEST) # per pixel
56
+ glFog(GL_FOG_START, 3.0)
57
+ glFog(GL_FOG_END, 5.0)
58
+ glFog(GL_FOG_COLOR, fogColor)
59
+ glClearColor(0.0, 0.0, 0.0, 1.0)
60
+
61
+ glDepthFunc(GL_LESS)
62
+ glEnable(GL_DEPTH_TEST)
63
+ glShadeModel(GL_FLAT)
62
64
  end
63
65
 
64
66
  # display() draws an icosahedron.
65
67
  display = Proc.new do
66
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
67
- glColor(1.0, 1.0, 1.0)
68
- glutWireIcosahedron()
69
- glFlush()
68
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
69
+ glColor(1.0, 1.0, 1.0)
70
+ glutWireIcosahedron()
71
+ glFlush()
70
72
  end
71
73
 
72
74
  myReshape = Proc.new do |w, h|
73
- glViewport(0, 0, w, h)
74
- glMatrixMode(GL_PROJECTION)
75
- glLoadIdentity()
76
- gluPerspective(45.0, w/h, 3.0, 5.0)
77
- glMatrixMode(GL_MODELVIEW)
78
- glLoadIdentity()
79
- glTranslate(0.0, 0.0, -4.0) # move object into view
75
+ glViewport(0, 0, w, h)
76
+ glMatrixMode(GL_PROJECTION)
77
+ glLoadIdentity()
78
+ gluPerspective(45.0, w/h, 3.0, 5.0)
79
+ glMatrixMode(GL_MODELVIEW)
80
+ glLoadIdentity()
81
+ glTranslate(0.0, 0.0, -4.0) # move object into view
80
82
  end
81
83
 
82
84
  keyboard = Proc.new do |key, x, y|
83
- case (key)
84
- when ?\e
85
- exit(0)
86
- end
85
+ case (key)
86
+ when ?\e
87
+ exit(0)
88
+ end
87
89
  end
88
90
 
89
91
  # Main Loop