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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -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
@@ -44,153 +44,155 @@
44
44
  # the viewing volume is at the same position, each time. In
45
45
  # this case, the gold teapot remains in focus.
46
46
  require 'opengl'
47
- require 'jitter'
47
+ require 'glu'
48
+ require 'glut'
49
+ require_relative 'jitter'
48
50
  include Gl,Glu,Glut
49
51
 
50
52
  # accFrustum()
51
53
  # The first 6 arguments are identical to the glFrustum() call.
52
- #
53
- # pixdx and pixdy are anti-alias jitter in pixels.
54
+ #
55
+ # pixdx and pixdy are anti-alias jitter in pixels.
54
56
  # Set both equal to 0.0 for no anti-alias jitter.
55
- # eyedx and eyedy are depth-of field jitter in pixels.
57
+ # eyedx and eyedy are depth-of field jitter in pixels.
56
58
  # Set both equal to 0.0 for no depth of field effects.
57
59
  #
58
- # focus is distance from eye to plane in focus.
60
+ # focus is distance from eye to plane in focus.
59
61
  # focus must be greater than, but not equal to 0.0.
60
62
  #
61
- # Note that accFrustum() calls glTranslatef(). You will
62
- # probably want to insure that your ModelView matrix has been
63
+ # Note that accFrustum() calls glTranslatef(). You will
64
+ # probably want to insure that your ModelView matrix has been
63
65
  # initialized to identity before calling accFrustum().
64
66
  def accFrustum(left, right, bottom, top, nnear, ffar, pixdx, pixdy, eyedx, eyedy, focus)
65
- viewport = glGetDoublev(GL_VIEWPORT)
66
-
67
- xwsize = right - left
68
- ywsize = top - bottom
69
-
70
- dx = -(pixdx*xwsize/viewport[2] + eyedx*nnear/focus)
71
- dy = -(pixdy*ywsize/viewport[3] + eyedy*nnear/focus)
72
-
73
- glMatrixMode(GL_PROJECTION)
74
- glLoadIdentity()
75
- glFrustum(left + dx, right + dx, bottom + dy, top + dy, nnear, ffar)
76
- glMatrixMode(GL_MODELVIEW)
77
- glLoadIdentity()
78
- glTranslate(-eyedx, -eyedy, 0.0)
67
+ viewport = glGetDoublev(GL_VIEWPORT)
68
+
69
+ xwsize = right - left
70
+ ywsize = top - bottom
71
+
72
+ dx = -(pixdx*xwsize/viewport[2] + eyedx*nnear/focus)
73
+ dy = -(pixdy*ywsize/viewport[3] + eyedy*nnear/focus)
74
+
75
+ glMatrixMode(GL_PROJECTION)
76
+ glLoadIdentity()
77
+ glFrustum(left + dx, right + dx, bottom + dy, top + dy, nnear, ffar)
78
+ glMatrixMode(GL_MODELVIEW)
79
+ glLoadIdentity()
80
+ glTranslate(-eyedx, -eyedy, 0.0)
79
81
  end
80
82
 
81
83
  # accPerspective()
82
- #
84
+ #
83
85
  # The first 4 arguments are identical to the gluPerspective() call.
84
- # pixdx and pixdy are anti-alias jitter in pixels.
86
+ # pixdx and pixdy are anti-alias jitter in pixels.
85
87
  # Set both equal to 0.0 for no anti-alias jitter.
86
- # eyedx and eyedy are depth-of field jitter in pixels.
88
+ # eyedx and eyedy are depth-of field jitter in pixels.
87
89
  # Set both equal to 0.0 for no depth of field effects.
88
90
  #
89
- # focus is distance from eye to plane in focus.
91
+ # focus is distance from eye to plane in focus.
90
92
  # focus must be greater than, but not equal to 0.0.
91
93
  #
92
94
  # Note that accPerspective() calls accFrustum().
93
95
  def accPerspective(fovy, aspect, nnear, ffar, pixdx, pixdy, eyedx, eyedy, focus)
94
- fov2 = ((fovy*Math::PI) / 180.0) / 2.0
95
-
96
- top = nnear / (Math::cos(fov2) / Math::sin(fov2))
97
- bottom = -top
98
-
99
- right = top * aspect
100
- left = -right
101
-
102
- accFrustum(left, right, bottom, top, nnear, ffar, pixdx, pixdy, eyedx, eyedy, focus)
96
+ fov2 = ((fovy*Math::PI) / 180.0) / 2.0
97
+
98
+ top = nnear / (Math::cos(fov2) / Math::sin(fov2))
99
+ bottom = -top
100
+
101
+ right = top * aspect
102
+ left = -right
103
+
104
+ accFrustum(left, right, bottom, top, nnear, ffar, pixdx, pixdy, eyedx, eyedy, focus)
103
105
  end
104
106
 
105
107
 
106
108
  def myinit
107
- ambient = [ 0.0, 0.0, 0.0, 1.0 ]
108
- diffuse = [ 1.0, 1.0, 1.0, 1.0 ]
109
- position = [ 0.0, 3.0, 3.0, 0.0 ]
110
-
111
- lmodel_ambient = [ 0.2, 0.2, 0.2, 1.0 ]
112
- local_view = [ 0.0 ]
113
-
114
- glEnable(GL_DEPTH_TEST)
115
- glDepthFunc(GL_LESS)
116
-
117
- glLight(GL_LIGHT0, GL_AMBIENT, ambient)
118
- glLight(GL_LIGHT0, GL_DIFFUSE, diffuse)
119
- glLight(GL_LIGHT0, GL_POSITION, position)
120
-
121
- glLightModel(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient)
122
- glLightModel(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view)
123
-
124
- glFrontFace(GL_CW)
125
- glEnable(GL_LIGHTING)
126
- glEnable(GL_LIGHT0)
127
- glEnable(GL_AUTO_NORMAL)
128
- glEnable(GL_NORMALIZE)
129
-
130
- glMatrixMode(GL_MODELVIEW)
131
- glLoadIdentity()
132
-
133
- glClearColor(0.0, 0.0, 0.0, 0.0)
134
- glClearAccum(0.0, 0.0, 0.0, 0.0)
109
+ ambient = [ 0.0, 0.0, 0.0, 1.0 ]
110
+ diffuse = [ 1.0, 1.0, 1.0, 1.0 ]
111
+ position = [ 0.0, 3.0, 3.0, 0.0 ]
112
+
113
+ lmodel_ambient = [ 0.2, 0.2, 0.2, 1.0 ]
114
+ local_view = [ 0.0 ]
115
+
116
+ glEnable(GL_DEPTH_TEST)
117
+ glDepthFunc(GL_LESS)
118
+
119
+ glLight(GL_LIGHT0, GL_AMBIENT, ambient)
120
+ glLight(GL_LIGHT0, GL_DIFFUSE, diffuse)
121
+ glLight(GL_LIGHT0, GL_POSITION, position)
122
+
123
+ glLightModel(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient)
124
+ glLightModel(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view)
125
+
126
+ glFrontFace(GL_CW)
127
+ glEnable(GL_LIGHTING)
128
+ glEnable(GL_LIGHT0)
129
+ glEnable(GL_AUTO_NORMAL)
130
+ glEnable(GL_NORMALIZE)
131
+
132
+ glMatrixMode(GL_MODELVIEW)
133
+ glLoadIdentity()
134
+
135
+ glClearColor(0.0, 0.0, 0.0, 0.0)
136
+ glClearAccum(0.0, 0.0, 0.0, 0.0)
135
137
  end
136
138
 
137
139
  def renderTeapot (x, y, z, ambr, ambg, ambb, difr, difg, difb, specr, specg, specb, shine)
138
- glPushMatrix()
139
- glTranslate(x, y, z)
140
- mat = []
141
- mat[0] = ambr; mat[1] = ambg; mat[2] = ambb; mat[3] = 1.0
142
- glMaterial(GL_FRONT, GL_AMBIENT, mat)
143
- mat[0] = difr; mat[1] = difg; mat[2] = difb
144
- glMaterial(GL_FRONT, GL_DIFFUSE, mat)
145
- mat[0] = specr; mat[1] = specg; mat[2] = specb
146
- glMaterial(GL_FRONT, GL_SPECULAR, mat)
147
- glMaterial(GL_FRONT, GL_SHININESS, shine*128.0)
148
- glutSolidTeapot(0.5)
149
- glPopMatrix()
140
+ glPushMatrix()
141
+ glTranslate(x, y, z)
142
+ mat = []
143
+ mat[0] = ambr; mat[1] = ambg; mat[2] = ambb; mat[3] = 1.0
144
+ glMaterial(GL_FRONT, GL_AMBIENT, mat)
145
+ mat[0] = difr; mat[1] = difg; mat[2] = difb
146
+ glMaterial(GL_FRONT, GL_DIFFUSE, mat)
147
+ mat[0] = specr; mat[1] = specg; mat[2] = specb
148
+ glMaterial(GL_FRONT, GL_SPECULAR, mat)
149
+ glMaterial(GL_FRONT, GL_SHININESS, shine*128.0)
150
+ glutSolidTeapot(0.5)
151
+ glPopMatrix()
150
152
  end
151
153
 
152
- # display() draws 5 teapots into the accumulation buffer
154
+ # display() draws 5 teapots into the accumulation buffer
153
155
  # several times each time with a jittered perspective.
154
- # The focal point is at z = 5.0, so the gold teapot will
156
+ # The focal point is at z = 5.0, so the gold teapot will
155
157
  # stay in focus. The amount of jitter is adjusted by the
156
158
  # magnitude of the accPerspective() jitter in this example, 0.33.
157
159
  # In this example, the teapots are drawn 8 times. See jitter.rb
158
160
  display = proc do
159
- viewport = glGetDoublev(GL_VIEWPORT)
160
- glClear(GL_ACCUM_BUFFER_BIT)
161
-
162
- for jitter in 0...8
163
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
164
- accPerspective(45.0,
165
- viewport[2]/ viewport[3],
166
- 1.0, 15.0, 0.0, 0.0,
167
- 0.33*$j8[jitter][0], 0.33*$j8[jitter][1], 5.0)
168
- # ruby, gold, silver, emerald, and cyan teapots
169
- renderTeapot(-1.1, -0.5, -4.5, 0.1745, 0.01175, 0.01175, 0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 0.6)
170
- renderTeapot(-0.5, -0.5, -5.0, 0.24725, 0.1995, 0.0745, 0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4)
171
- renderTeapot(0.2, -0.5, -5.5, 0.19225, 0.19225, 0.19225, 0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4)
172
- renderTeapot(1.0, -0.5, -6.0, 0.0215, 0.1745, 0.0215, 0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6)
173
- renderTeapot(1.8, -0.5, -6.5, 0.0, 0.1, 0.06, 0.0, 0.50980392, 0.50980392, 0.50196078, 0.50196078, 0.50196078, 0.25)
174
- glAccum(GL_ACCUM, 0.125)
175
- end
176
-
177
- glAccum(GL_RETURN, 1.0)
178
- glutSwapBuffers()
161
+ viewport = glGetDoublev(GL_VIEWPORT)
162
+ glClear(GL_ACCUM_BUFFER_BIT)
163
+
164
+ for jitter in 0...8
165
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
166
+ accPerspective(45.0,
167
+ viewport[2]/ viewport[3],
168
+ 1.0, 15.0, 0.0, 0.0,
169
+ 0.33*$j8[jitter][0], 0.33*$j8[jitter][1], 5.0)
170
+ # ruby, gold, silver, emerald, and cyan teapots
171
+ renderTeapot(-1.1, -0.5, -4.5, 0.1745, 0.01175, 0.01175, 0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 0.6)
172
+ renderTeapot(-0.5, -0.5, -5.0, 0.24725, 0.1995, 0.0745, 0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4)
173
+ renderTeapot(0.2, -0.5, -5.5, 0.19225, 0.19225, 0.19225, 0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4)
174
+ renderTeapot(1.0, -0.5, -6.0, 0.0215, 0.1745, 0.0215, 0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6)
175
+ renderTeapot(1.8, -0.5, -6.5, 0.0, 0.1, 0.06, 0.0, 0.50980392, 0.50980392, 0.50196078, 0.50196078, 0.50196078, 0.25)
176
+ glAccum(GL_ACCUM, 0.125)
177
+ end
178
+
179
+ glAccum(GL_RETURN, 1.0)
180
+ glutSwapBuffers()
179
181
  end
180
182
 
181
183
  myReshape = proc do |w, h|
182
- glViewport(0, 0, w, h)
184
+ glViewport(0, 0, w, h)
183
185
  end
184
186
 
185
187
  keyboard = proc do |key, x, y|
186
- case (key)
187
- when ?\e
188
- exit(0)
189
- end
188
+ case (key)
189
+ when ?\e
190
+ exit(0)
191
+ end
190
192
  end
191
193
 
192
194
  # Main Loop
193
- # Open window with initial window size, title bar,
195
+ # Open window with initial window size, title bar,
194
196
  # RGBA display mode, depth buffer, and handle input events.
195
197
  glutInit()
196
198
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_ACCUM | GLUT_DEPTH)
@@ -202,4 +204,3 @@ glutReshapeFunc(myReshape)
202
204
  glutDisplayFunc(display)
203
205
  glutKeyboardFunc(keyboard)
204
206
  glutMainLoop()
205
-
@@ -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
@@ -39,67 +39,69 @@
39
39
  # Pressing the left mouse button rotates the rectangle.
40
40
  # Pressing the middle mouse button stops the rotation.
41
41
  require 'opengl'
42
+ require 'glu'
43
+ require 'glut'
42
44
  require 'rational'
43
45
  include Gl,Glu,Glut
44
46
 
45
47
  $spin = 0.0
46
48
 
47
49
  display = Proc.new do
48
- glClear(GL_COLOR_BUFFER_BIT)
49
- glPushMatrix()
50
- glRotate($spin, 0.0, 0.0, 1.0)
51
- glColor(1.0, 1.0, 1.0)
52
- glRect(-25.0, -25.0, 25.0, 25.0)
53
- glPopMatrix()
54
- glutSwapBuffers()
50
+ glClear(GL_COLOR_BUFFER_BIT)
51
+ glPushMatrix()
52
+ glRotate($spin, 0.0, 0.0, 1.0)
53
+ glColor(1.0, 1.0, 1.0)
54
+ glRect(-25.0, -25.0, 25.0, 25.0)
55
+ glPopMatrix()
56
+ glutSwapBuffers()
55
57
  end
56
58
 
57
59
  $spinDisplay = Proc.new do
58
- $spin = $spin + 4.0
59
- $spin = $spin - 360.0 if ($spin > 360.0)
60
- glutPostRedisplay()
60
+ $spin = $spin + 4.0
61
+ $spin = $spin - 360.0 if ($spin > 360.0)
62
+ glutPostRedisplay()
61
63
  end
62
64
 
63
65
  def init
64
- glClearColor(0.0, 0.0, 0.0, 0.0)
65
- glShadeModel(GL_FLAT)
66
+ glClearColor(0.0, 0.0, 0.0, 0.0)
67
+ glShadeModel(GL_FLAT)
66
68
  end
67
69
 
68
70
  reshape = Proc.new do |w, h|
69
- glViewport(0, 0, w, h)
70
- glMatrixMode(GL_PROJECTION)
71
- glLoadIdentity()
72
- glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0)
73
- glMatrixMode(GL_MODELVIEW)
74
- glLoadIdentity()
71
+ glViewport(0, 0, w, h)
72
+ glMatrixMode(GL_PROJECTION)
73
+ glLoadIdentity()
74
+ glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0)
75
+ glMatrixMode(GL_MODELVIEW)
76
+ glLoadIdentity()
75
77
  end
76
78
 
77
79
  mouse = Proc.new do |button, state, x, y|
78
- case button
79
- when GLUT_LEFT_BUTTON
80
- glutIdleFunc($spinDisplay) if (state == GLUT_DOWN)
81
- when GLUT_MIDDLE_BUTTON
82
- glutIdleFunc(nil) if (state == GLUT_DOWN)
83
- end
80
+ case button
81
+ when GLUT_LEFT_BUTTON
82
+ glutIdleFunc($spinDisplay) if (state == GLUT_DOWN)
83
+ when GLUT_MIDDLE_BUTTON
84
+ glutIdleFunc(nil) if (state == GLUT_DOWN)
85
+ end
84
86
  end
85
87
 
86
88
  keyboard = Proc.new do |key, x, y|
87
- case (key)
88
- when ?\e
89
- exit(0)
90
- end
89
+ case (key)
90
+ when ?\e
91
+ exit(0)
92
+ end
91
93
  end
92
-
94
+
93
95
  # Request double buffer display mode.
94
96
  # Register mouse input callback functions
95
97
  glutInit
96
98
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
97
- glutInitWindowSize(500, 500)
99
+ glutInitWindowSize(500, 500)
98
100
  glutInitWindowPosition(100, 100)
99
101
  glutCreateWindow($0)
100
102
  init()
101
- glutDisplayFunc(display)
102
- glutReshapeFunc(reshape)
103
+ glutDisplayFunc(display)
104
+ glutReshapeFunc(reshape)
103
105
  glutKeyboardFunc(keyboard)
104
106
  glutMouseFunc(mouse)
105
107
  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
@@ -38,46 +38,48 @@
38
38
  # Draws the bitmapped letter F on the screen (several times).
39
39
  # This demonstrates use of the glBitmap() call.
40
40
  require 'opengl'
41
+ require 'glu'
42
+ require 'glut'
41
43
  include Gl,Glu,Glut
42
44
 
43
45
  $rasters = [
44
- 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
45
- 0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
46
- 0xff, 0xc0, 0xff, 0xc0
46
+ 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
47
+ 0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
48
+ 0xff, 0xc0, 0xff, 0xc0
47
49
  ].pack("C*")
48
50
 
49
51
  def init
50
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
51
- glClearColor(0.0, 0.0, 0.0, 0.0)
52
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
53
+ glClearColor(0.0, 0.0, 0.0, 0.0)
52
54
  end
53
55
 
54
56
  display = Proc.new do
55
- glClear(GL_COLOR_BUFFER_BIT)
56
- glColor(1.0, 1.0, 1.0)
57
- glRasterPos2i(20, 20)
58
- glBitmap(10, 12, 0.0, 0.0, 11.0, 0.0, $rasters)
59
- glBitmap(10, 12, 0.0, 0.0, 11.0, 0.0, $rasters)
60
- glBitmap(10, 12, 0.0, 0.0, 11.0, 0.0, $rasters)
61
- glutSwapBuffers()
57
+ glClear(GL_COLOR_BUFFER_BIT)
58
+ glColor(1.0, 1.0, 1.0)
59
+ glRasterPos2i(20, 20)
60
+ glBitmap(10, 12, 0.0, 0.0, 11.0, 0.0, $rasters)
61
+ glBitmap(10, 12, 0.0, 0.0, 11.0, 0.0, $rasters)
62
+ glBitmap(10, 12, 0.0, 0.0, 11.0, 0.0, $rasters)
63
+ glutSwapBuffers()
62
64
  end
63
65
 
64
66
  reshape = Proc.new do |w, h|
65
- glViewport(0, 0, w, h)
66
- glMatrixMode(GL_PROJECTION)
67
- glLoadIdentity()
68
- glOrtho(0, w, 0, h, -1.0, 1.0)
69
- glMatrixMode(GL_MODELVIEW)
67
+ glViewport(0, 0, w, h)
68
+ glMatrixMode(GL_PROJECTION)
69
+ glLoadIdentity()
70
+ glOrtho(0, w, 0, h, -1.0, 1.0)
71
+ glMatrixMode(GL_MODELVIEW)
70
72
  end
71
73
 
72
74
  keyboard = Proc.new do |key, x, y|
73
- case (key)
74
- when ?\e
75
- exit(0)
76
- end
75
+ case (key)
76
+ when ?\e
77
+ exit(0)
78
+ end
77
79
  end
78
80
 
79
81
  # Main Loop
80
- # Open window with initial window size, title bar,
82
+ # Open window with initial window size, title bar,
81
83
  # RGBA display mode, and handle input events.
82
84
  glutInit
83
85
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)