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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +2 -0
- data/.gitignore +2 -1
- data/.travis.yml +19 -0
- data/History.rdoc +26 -0
- data/Manifest.txt +3 -23
- data/README.rdoc +43 -37
- data/Rakefile +6 -62
- data/examples/NeHe/nehe_lesson02.rb +3 -2
- data/examples/NeHe/nehe_lesson03.rb +3 -2
- data/examples/NeHe/nehe_lesson04.rb +3 -1
- data/examples/NeHe/nehe_lesson05.rb +4 -1
- data/examples/NeHe/nehe_lesson06.rb +9 -6
- data/examples/NeHe/nehe_lesson07.rb +9 -6
- data/examples/NeHe/nehe_lesson08.rb +9 -6
- data/examples/NeHe/nehe_lesson09.rb +10 -6
- data/examples/NeHe/nehe_lesson11.rb +9 -6
- data/examples/NeHe/nehe_lesson12.rb +9 -6
- data/examples/NeHe/nehe_lesson16.rb +50 -47
- data/examples/NeHe/nehe_lesson19.rb +10 -7
- data/examples/NeHe/nehe_lesson36.rb +234 -229
- data/examples/OrangeBook/brick.rb +227 -225
- data/examples/OrangeBook/particle.rb +233 -231
- data/examples/RedBook/aapoly.rb +71 -70
- data/examples/RedBook/aargb.rb +54 -52
- data/examples/RedBook/accanti.rb +96 -94
- data/examples/RedBook/accpersp.rb +106 -104
- data/examples/RedBook/alpha.rb +54 -52
- data/examples/RedBook/alpha3D.rb +90 -88
- data/examples/RedBook/bezcurve.rb +48 -46
- data/examples/RedBook/bezmesh.rb +71 -69
- data/examples/RedBook/checker.rb +57 -55
- data/examples/RedBook/clip.rb +41 -39
- data/examples/RedBook/colormat.rb +72 -70
- data/examples/RedBook/cube.rb +39 -37
- data/examples/RedBook/depthcue.rb +37 -35
- data/examples/RedBook/dof.rb +110 -109
- data/examples/RedBook/double.rb +40 -38
- data/examples/RedBook/drawf.rb +30 -28
- data/examples/RedBook/feedback.rb +79 -77
- data/examples/RedBook/fog.rb +90 -89
- data/examples/RedBook/font.rb +78 -76
- data/examples/RedBook/hello.rb +29 -27
- data/examples/RedBook/image.rb +57 -55
- data/examples/RedBook/jitter.rb +131 -131
- data/examples/RedBook/light.rb +2 -1
- data/examples/RedBook/lines.rb +70 -68
- data/examples/RedBook/list.rb +48 -46
- data/examples/RedBook/material.rb +200 -199
- data/examples/RedBook/mipmap.rb +84 -82
- data/examples/RedBook/model.rb +55 -53
- data/examples/RedBook/movelight.rb +52 -50
- data/examples/RedBook/pickdepth.rb +103 -101
- data/examples/RedBook/planet.rb +46 -44
- data/examples/RedBook/quadric.rb +97 -95
- data/examples/RedBook/robot.rb +55 -53
- data/examples/RedBook/select.rb +118 -116
- data/examples/RedBook/smooth.rb +35 -33
- data/examples/RedBook/stencil.rb +96 -94
- data/examples/RedBook/stroke.rb +75 -73
- data/examples/RedBook/surface.rb +93 -91
- data/examples/RedBook/teaambient.rb +71 -69
- data/examples/RedBook/teapots.rb +105 -103
- data/examples/RedBook/tess.rb +96 -94
- data/examples/RedBook/texbind.rb +79 -77
- data/examples/RedBook/texgen.rb +88 -86
- data/examples/RedBook/texturesurf.rb +57 -55
- data/examples/RedBook/varray.rb +85 -83
- data/examples/RedBook/wrap.rb +76 -74
- data/examples/misc/OGLBench.rb +114 -113
- data/examples/misc/anisotropic.rb +154 -152
- data/examples/misc/fbo_test.rb +37 -36
- data/examples/misc/font-glut.rb +47 -46
- data/examples/misc/glfwtest.rb +16 -16
- data/examples/misc/plane.rb +13 -13
- data/examples/misc/readpixel.rb +66 -65
- data/examples/misc/sdltest.rb +21 -19
- data/examples/misc/trislam.rb +548 -547
- data/ext/opengl/common.h +16 -38
- data/ext/opengl/conv.h +39 -41
- data/ext/opengl/extconf.rb +4 -31
- data/ext/opengl/funcdef.h +126 -124
- data/ext/opengl/gl-1.0-1.1.c +1917 -1917
- data/ext/opengl/gl-1.2.c +4 -667
- data/ext/opengl/gl-1.3.c +9 -9
- data/ext/opengl/gl-1.4.c +8 -8
- data/ext/opengl/gl-1.5.c +1 -1
- data/ext/opengl/gl-2.0.c +392 -388
- data/ext/opengl/gl-3.0.c +493 -0
- data/ext/opengl/gl-enums.c +1523 -5
- data/ext/opengl/gl-enums.h +4679 -122
- data/ext/opengl/gl-error.c +7 -7
- data/ext/opengl/gl-error.h +4 -4
- data/ext/opengl/gl-ext-arb.c +468 -464
- data/ext/opengl/gl-ext-ext.c +18 -18
- data/ext/opengl/gl-ext-nv.c +15 -15
- data/ext/opengl/gl.c +2 -0
- data/ext/opengl/gl_buffer.c +92 -92
- data/ext/opengl/opengl.c +1 -7
- data/lib/opengl.rb +23 -59
- data/lib/opengl/1.9/opengl.so +0 -0
- data/lib/opengl/2.0/opengl.so +0 -0
- data/lib/opengl/2.1/opengl.so +0 -0
- data/lib/opengl/test_case.rb +1 -2
- data/test/dummy.xorg.conf +140 -0
- data/test/test_gl.rb +18 -22
- data/test/test_gl_10_11.rb +220 -220
- data/test/test_gl_12.rb +11 -122
- data/test/test_gl_13.rb +202 -210
- data/test/test_gl_14.rb +16 -19
- data/test/test_gl_15.rb +2 -4
- data/test/test_gl_20.rb +45 -58
- data/test/test_gl_21.rb +46 -163
- data/test/test_gl_ext_arb.rb +54 -72
- data/test/test_gl_ext_ati.rb +0 -2
- data/test/test_gl_ext_ext.rb +66 -66
- data/test/test_gl_ext_gremedy.rb +8 -15
- data/test/test_gl_ext_nv.rb +109 -112
- data/test/test_opengl_buffer.rb +8 -25
- data/utils/README +0 -5
- data/utils/enumgen.rb +72 -76
- data/utils/extlistgen.rb +55 -55
- metadata +90 -67
- metadata.gz.sig +0 -0
- data/Rakefile.cross +0 -107
- data/docs/build_install.txt +0 -119
- data/docs/extensions.txt.in +0 -348
- data/docs/history.txt +0 -66
- data/docs/requirements_and_design.txt +0 -117
- data/docs/roadmap.txt +0 -28
- data/docs/scientific_use.txt +0 -35
- data/docs/supplies/page_template.html +0 -71
- data/docs/thanks.txt +0 -29
- data/docs/tutorial.txt +0 -469
- data/ext/opengl/glu-enums.c +0 -164
- data/ext/opengl/glu-enums.h +0 -463
- data/ext/opengl/glu.c +0 -1534
- data/ext/opengl/glut.c +0 -1145
- data/ext/opengl/glut_callbacks.c +0 -845
- data/lib/glu.rb +0 -1
- data/lib/glut.rb +0 -1
- data/lib/opengl/opengl.so +0 -0
- data/test/test_glu.rb +0 -309
- data/utils/mkdn2html.rb +0 -59
- data/utils/post-mkdn2html.rb +0 -91
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +0 -198
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson07
|
6
9
|
include Gl
|
@@ -186,7 +189,7 @@ class Lesson07
|
|
186
189
|
@filter %= 3
|
187
190
|
|
188
191
|
puts "texture #{@filter}"
|
189
|
-
when 'F' then
|
192
|
+
when 'F' then
|
190
193
|
@fullscreen = !@fullscreen
|
191
194
|
|
192
195
|
if @fullscreen then
|
@@ -208,11 +211,12 @@ class Lesson07
|
|
208
211
|
end
|
209
212
|
|
210
213
|
def load_texture
|
211
|
-
png =
|
214
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../crate.png', __FILE__))
|
215
|
+
|
212
216
|
height = png.height
|
213
217
|
width = png.width
|
214
218
|
|
215
|
-
image = png.
|
219
|
+
image = png.to_rgba_stream
|
216
220
|
|
217
221
|
@textures = glGenTextures 3
|
218
222
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -234,4 +238,3 @@ class Lesson07
|
|
234
238
|
end
|
235
239
|
|
236
240
|
Lesson07.new
|
237
|
-
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson08
|
6
9
|
include Gl
|
@@ -189,7 +192,7 @@ class Lesson08
|
|
189
192
|
@filter %= 3
|
190
193
|
|
191
194
|
puts "texture #{@filter}"
|
192
|
-
when 'F' then
|
195
|
+
when 'F' then
|
193
196
|
@fullscreen = !@fullscreen
|
194
197
|
|
195
198
|
if @fullscreen then
|
@@ -223,11 +226,12 @@ class Lesson08
|
|
223
226
|
end
|
224
227
|
|
225
228
|
def load_texture
|
226
|
-
png =
|
229
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../glass.png', __FILE__))
|
230
|
+
|
227
231
|
height = png.height
|
228
232
|
width = png.width
|
229
233
|
|
230
|
-
image = png.
|
234
|
+
image = png.to_rgba_stream
|
231
235
|
|
232
236
|
@textures = glGenTextures 3
|
233
237
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -249,4 +253,3 @@ class Lesson08
|
|
249
253
|
end
|
250
254
|
|
251
255
|
Lesson08.new
|
252
|
-
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson09
|
6
9
|
include Gl
|
@@ -141,7 +144,7 @@ class Lesson09
|
|
141
144
|
when ?\e then
|
142
145
|
glutDestroyWindow @window
|
143
146
|
exit 0
|
144
|
-
when 'F' then
|
147
|
+
when 'F' then
|
145
148
|
@fullscreen = !@fullscreen
|
146
149
|
|
147
150
|
if @fullscreen then
|
@@ -170,11 +173,13 @@ class Lesson09
|
|
170
173
|
end
|
171
174
|
|
172
175
|
def load_texture
|
173
|
-
|
176
|
+
|
177
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../star.png', __FILE__))
|
178
|
+
|
174
179
|
height = png.height
|
175
180
|
width = png.width
|
176
181
|
|
177
|
-
image = png.
|
182
|
+
image = png.to_rgba_stream
|
178
183
|
|
179
184
|
@textures = glGenTextures 3
|
180
185
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -196,4 +201,3 @@ class Lesson09
|
|
196
201
|
end
|
197
202
|
|
198
203
|
Lesson09.new
|
199
|
-
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson11
|
6
9
|
include Gl
|
@@ -140,7 +143,7 @@ class Lesson11
|
|
140
143
|
when ?\e
|
141
144
|
glutDestroyWindow @window
|
142
145
|
exit 0
|
143
|
-
when 'F' then
|
146
|
+
when 'F' then
|
144
147
|
@fullscreen = !@fullscreen
|
145
148
|
|
146
149
|
if @fullscreen then
|
@@ -154,11 +157,12 @@ class Lesson11
|
|
154
157
|
end
|
155
158
|
|
156
159
|
def load_texture
|
157
|
-
png =
|
160
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../tim.png', __FILE__))
|
161
|
+
|
158
162
|
height = png.height
|
159
163
|
width = png.width
|
160
164
|
|
161
|
-
image = png.
|
165
|
+
image = png.to_rgba_stream.each_byte.to_a
|
162
166
|
|
163
167
|
@textures = glGenTextures 1
|
164
168
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -170,4 +174,3 @@ class Lesson11
|
|
170
174
|
end
|
171
175
|
|
172
176
|
Lesson11.new
|
173
|
-
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson12
|
6
9
|
include Gl
|
@@ -163,7 +166,7 @@ class Lesson12
|
|
163
166
|
when ?\e
|
164
167
|
glutDestroyWindow @window
|
165
168
|
exit 0
|
166
|
-
when 'F' then
|
169
|
+
when 'F' then
|
167
170
|
@fullscreen = !@fullscreen
|
168
171
|
|
169
172
|
if @fullscreen then
|
@@ -181,11 +184,12 @@ class Lesson12
|
|
181
184
|
end
|
182
185
|
|
183
186
|
def load_texture
|
184
|
-
png =
|
187
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../crate.png', __FILE__))
|
188
|
+
|
185
189
|
height = png.height
|
186
190
|
width = png.width
|
187
191
|
|
188
|
-
image = png.
|
192
|
+
image = png.to_rgba_stream.each_byte.to_a
|
189
193
|
|
190
194
|
@textures = glGenTextures 1
|
191
195
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -197,4 +201,3 @@ class Lesson12
|
|
197
201
|
end
|
198
202
|
|
199
203
|
Lesson12.new
|
200
|
-
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson16
|
6
9
|
include Gl
|
@@ -16,9 +19,9 @@ class Lesson16
|
|
16
19
|
@filter = 0
|
17
20
|
|
18
21
|
@fog_mode = [
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
GL_EXP,
|
23
|
+
GL_EXP2,
|
24
|
+
GL_LINEAR
|
22
25
|
]
|
23
26
|
|
24
27
|
@fog_filter = 0
|
@@ -64,7 +67,7 @@ class Lesson16
|
|
64
67
|
end
|
65
68
|
|
66
69
|
def reshape width, height
|
67
|
-
width
|
70
|
+
width = width.to_f
|
68
71
|
height = height.to_f
|
69
72
|
height = 1.0 if height.zero?
|
70
73
|
|
@@ -94,63 +97,63 @@ class Lesson16
|
|
94
97
|
glBegin GL_QUADS do
|
95
98
|
# front face
|
96
99
|
glTexCoord2f(0.0, 1.0)
|
97
|
-
glVertex3f(-1.0, -1.0,
|
100
|
+
glVertex3f(-1.0, -1.0, 1.0)
|
98
101
|
glTexCoord2f(1.0, 1.0)
|
99
|
-
glVertex3f(
|
102
|
+
glVertex3f(1.0, -1.0, 1.0)
|
100
103
|
glTexCoord2f(1.0, 0.0)
|
101
|
-
glVertex3f(
|
104
|
+
glVertex3f(1.0, 1.0, 1.0)
|
102
105
|
glTexCoord2f(0.0, 0.0)
|
103
|
-
glVertex3f(-1.0,
|
106
|
+
glVertex3f(-1.0, 1.0, 1.0)
|
104
107
|
|
105
108
|
# back face
|
106
109
|
glTexCoord2f(0.0, 1.0)
|
107
110
|
glVertex3f(-1.0, -1.0, -1.0)
|
108
111
|
glTexCoord2f(1.0, 1.0)
|
109
|
-
glVertex3f(-1.0,
|
112
|
+
glVertex3f(-1.0, 1.0, -1.0)
|
110
113
|
glTexCoord2f(1.0, 0.0)
|
111
|
-
glVertex3f(
|
114
|
+
glVertex3f(1.0, 1.0, -1.0)
|
112
115
|
glTexCoord2f(0.0, 0.0)
|
113
|
-
glVertex3f(
|
116
|
+
glVertex3f(1.0, -1.0, -1.0)
|
114
117
|
|
115
118
|
# top face
|
116
119
|
glTexCoord2f(0.0, 1.0)
|
117
|
-
glVertex3f(-1.0,
|
120
|
+
glVertex3f(-1.0, 1.0, -1.0)
|
118
121
|
glTexCoord2f(1.0, 1.0)
|
119
|
-
glVertex3f(-1.0,
|
122
|
+
glVertex3f(-1.0, 1.0, 1.0)
|
120
123
|
glTexCoord2f(1.0, 0.0)
|
121
|
-
glVertex3f(
|
124
|
+
glVertex3f(1.0, 1.0, 1.0)
|
122
125
|
glTexCoord2f(0.0, 0.0)
|
123
|
-
glVertex3f(
|
126
|
+
glVertex3f(1.0, 1.0, -1.0)
|
124
127
|
|
125
128
|
# bottom face
|
126
129
|
glTexCoord2f(1.0, 1.0)
|
127
130
|
glVertex3f(-1.0, -1.0, -1.0)
|
128
131
|
glTexCoord2f(1.0, 0.0)
|
129
|
-
glVertex3f(
|
132
|
+
glVertex3f(1.0, -1.0, -1.0)
|
130
133
|
glTexCoord2f(0.0, 0.0)
|
131
|
-
glVertex3f(
|
134
|
+
glVertex3f(1.0, -1.0, 1.0)
|
132
135
|
glTexCoord2f(0.0, 1.0)
|
133
|
-
glVertex3f(-1.0, -1.0,
|
136
|
+
glVertex3f(-1.0, -1.0, 1.0)
|
134
137
|
|
135
138
|
# right face
|
136
139
|
glTexCoord2f(1.0, 0.0)
|
137
|
-
glVertex3f(
|
140
|
+
glVertex3f(1.0, -1.0, -1.0)
|
138
141
|
glTexCoord2f(0.0, 0.0)
|
139
|
-
glVertex3f(
|
142
|
+
glVertex3f(1.0, 1.0, -1.0)
|
140
143
|
glTexCoord2f(0.0, 1.0)
|
141
|
-
glVertex3f(
|
144
|
+
glVertex3f(1.0, 1.0, 1.0)
|
142
145
|
glTexCoord2f(1.0, 1.0)
|
143
|
-
glVertex3f(
|
146
|
+
glVertex3f(1.0, -1.0, 1.0)
|
144
147
|
|
145
148
|
# left face
|
146
149
|
glTexCoord2f(0.0, 0.0)
|
147
150
|
glVertex3f(-1.0, -1.0, -1.0)
|
148
151
|
glTexCoord2f(0.0, 1.0)
|
149
|
-
glVertex3f(-1.0, -1.0,
|
152
|
+
glVertex3f(-1.0, -1.0, 1.0)
|
150
153
|
glTexCoord2f(1.0, 1.0)
|
151
|
-
glVertex3f(-1.0,
|
154
|
+
glVertex3f(-1.0, 1.0, 1.0)
|
152
155
|
glTexCoord2f(1.0, 0.0)
|
153
|
-
glVertex3f(-1.0,
|
156
|
+
glVertex3f(-1.0, 1.0, -1.0)
|
154
157
|
end
|
155
158
|
|
156
159
|
@xrot += 0.03
|
@@ -166,34 +169,35 @@ class Lesson16
|
|
166
169
|
|
167
170
|
def keyboard key, x, y
|
168
171
|
case key
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
172
|
+
when ?\e
|
173
|
+
glutDestroyWindow @window
|
174
|
+
exit 0
|
175
|
+
when 'F' then
|
176
|
+
@fullscreen = !@fullscreen
|
177
|
+
|
178
|
+
if @fullscreen then
|
179
|
+
glutFullScreen
|
180
|
+
else
|
181
|
+
glutPositionWindow 0, 0
|
182
|
+
end
|
183
|
+
when 'f' then
|
184
|
+
@fog_filter += 1
|
185
|
+
@fog_filter %= 3
|
186
|
+
|
187
|
+
glFogi GL_FOG_MODE, @fog_mode[@fog_filter]
|
188
|
+
puts "fog #{@fog_filter}"
|
186
189
|
end
|
187
190
|
|
188
191
|
glutPostRedisplay
|
189
192
|
end
|
190
193
|
|
191
194
|
def load_texture
|
192
|
-
png =
|
195
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../crate.png', __FILE__))
|
196
|
+
|
193
197
|
height = png.height
|
194
198
|
width = png.width
|
195
199
|
|
196
|
-
image = png.
|
200
|
+
image = png.to_rgba_stream.each_byte.to_a
|
197
201
|
|
198
202
|
@textures = glGenTextures 1
|
199
203
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -205,4 +209,3 @@ class Lesson16
|
|
205
209
|
end
|
206
210
|
|
207
211
|
Lesson16.new
|
208
|
-
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'opengl'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
+
require 'glu'
|
5
|
+
require 'glut'
|
6
|
+
require 'chunky_png'
|
4
7
|
|
5
8
|
class Lesson19
|
6
9
|
include Gl
|
@@ -110,7 +113,7 @@ class Lesson19
|
|
110
113
|
|
111
114
|
@particles.each do |particle|
|
112
115
|
next unless particle.active
|
113
|
-
|
116
|
+
|
114
117
|
x = particle.x
|
115
118
|
y = particle.y
|
116
119
|
z = particle.z + @zoom
|
@@ -167,7 +170,7 @@ class Lesson19
|
|
167
170
|
when ?\e
|
168
171
|
glutDestroyWindow @window
|
169
172
|
exit 0
|
170
|
-
when 'F' then
|
173
|
+
when 'F' then
|
171
174
|
@fullscreen = !@fullscreen
|
172
175
|
|
173
176
|
if @fullscreen then
|
@@ -187,11 +190,12 @@ class Lesson19
|
|
187
190
|
end
|
188
191
|
|
189
192
|
def load_texture
|
190
|
-
png =
|
193
|
+
png = ChunkyPNG::Image.from_file(File.expand_path('../particle.png', __FILE__))
|
194
|
+
|
191
195
|
height = png.height
|
192
196
|
width = png.width
|
193
197
|
|
194
|
-
image = png.
|
198
|
+
image = png.to_rgba_stream.each_byte.to_a
|
195
199
|
|
196
200
|
@textures = glGenTextures 1
|
197
201
|
glBindTexture GL_TEXTURE_2D, @textures[0]
|
@@ -203,4 +207,3 @@ class Lesson19
|
|
203
207
|
end
|
204
208
|
|
205
209
|
Lesson19.new
|
206
|
-
|
@@ -1,290 +1,295 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
# Nehe Lesson 36 Code
|
2
4
|
# modified from immediate mode to use vertex arrays for helix drawing
|
3
5
|
require 'opengl'
|
6
|
+
require 'glu'
|
7
|
+
require 'glut'
|
8
|
+
|
4
9
|
include Gl,Glu,Glut
|
5
10
|
include Math
|
6
11
|
|
7
12
|
def emptyTexture
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
# Create Storage Space For Texture Data (128x128x4)
|
14
|
+
data = ([0]*4*128*128).pack("f*")
|
15
|
+
txtnumber = glGenTextures(1) # Create 1 Texture
|
16
|
+
glBindTexture(GL_TEXTURE_2D, txtnumber[0]) # Bind The Texture
|
17
|
+
glTexImage2D(GL_TEXTURE_2D, 0, 4, 128, 128, 0,
|
18
|
+
GL_RGBA, GL_FLOAT, data) # Build Texture Using Information In data
|
19
|
+
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR)
|
20
|
+
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
|
21
|
+
return txtnumber[0] # Return The Texture ID
|
17
22
|
end
|
18
23
|
|
19
24
|
def init
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
25
|
+
global_ambient = [0.2, 0.2, 0.2, 1.0] # Set Ambient Lighting To Fairly Dark Light (No Color)
|
26
|
+
light0pos = [0.0, 5.0, 10.0, 1.0] # Set The Light Position
|
27
|
+
light0ambient = [0.2, 0.2, 0.2, 1.0] # More Ambient Light
|
28
|
+
light0diffuse = [0.3, 0.3, 0.3, 1.0] # Set The Diffuse Light A Bit Brighter
|
29
|
+
light0specular = [0.8, 0.8, 0.8, 1.0] # Fairly Bright Specular Lighting
|
30
|
+
|
31
|
+
lmodel_ambient = [0.2,0.2,0.2,1.0] # And More Ambient Light
|
32
|
+
|
33
|
+
$angle = 0.0 # Set Starting Angle To Zero
|
34
|
+
|
35
|
+
$lasttime = 0
|
36
|
+
|
37
|
+
$blurTexture = emptyTexture() # Create Our Empty Texture
|
38
|
+
|
39
|
+
$helix_v,$helix_n = createHelix()
|
40
|
+
glVertexPointer(3,GL_FLOAT,0,$helix_v.flatten.pack("f*"))
|
41
|
+
glNormalPointer(GL_FLOAT,0,$helix_n.flatten.pack("f*"))
|
42
|
+
|
43
|
+
glLoadIdentity() # Reset The Modelview Matrix
|
44
|
+
|
45
|
+
glEnable(GL_DEPTH_TEST) # Enable Depth Testing
|
46
|
+
|
47
|
+
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,lmodel_ambient) # Set The Ambient Light Model
|
48
|
+
|
49
|
+
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,global_ambient) # Set The Global Ambient Light Model
|
50
|
+
glLightfv(GL_LIGHT0, GL_POSITION, light0pos) # Set The Lights Position
|
51
|
+
glLightfv(GL_LIGHT0, GL_AMBIENT, light0ambient) # Set The Ambient Light
|
52
|
+
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0diffuse) # Set The Diffuse Light
|
53
|
+
glLightfv(GL_LIGHT0, GL_SPECULAR, light0specular) # Set Up Specular Lighting
|
54
|
+
glEnable(GL_LIGHTING) # Enable Lighting
|
55
|
+
glEnable(GL_LIGHT0) # Enable Light0
|
56
|
+
|
57
|
+
glShadeModel(GL_SMOOTH) # Select Smooth Shading
|
58
|
+
|
59
|
+
glMateriali(GL_FRONT, GL_SHININESS, 128)
|
60
|
+
glClearColor(0.0, 0.0, 0.0, 0.5) # Set The Clear Color To Black
|
56
61
|
end
|
57
62
|
|
58
63
|
# Keyboard handler to exit when ESC is typed
|
59
64
|
keyboard = lambda do |key, x, y|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
+
case(key)
|
66
|
+
when ?\e
|
67
|
+
exit(0)
|
68
|
+
end
|
69
|
+
glutPostRedisplay
|
65
70
|
end
|
66
71
|
|
67
72
|
reshape = lambda do |w,h|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
glMatrixMode(GL_PROJECTION)
|
74
|
+
glViewport(0,0,w,h)
|
75
|
+
glLoadIdentity()
|
76
|
+
width = 0.5
|
77
|
+
height = 0.5 * h/w;
|
78
|
+
glFrustum(-width,width,-height,height,1.0,2000.0)
|
79
|
+
glMatrixMode(GL_MODELVIEW)
|
80
|
+
glViewport(0,0,w,h)
|
76
81
|
end
|
77
82
|
|
78
83
|
def viewOrtho
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
glMatrixMode(GL_PROJECTION) # Select Projection
|
85
|
+
glPushMatrix() # Push The Matrix
|
86
|
+
glLoadIdentity() # Reset The Matrix
|
87
|
+
width = glutGet(GLUT_WINDOW_WIDTH)
|
88
|
+
height = glutGet(GLUT_WINDOW_HEIGHT)
|
89
|
+
glOrtho( 0, width , height , 0, -1, 1 ) # Select Ortho Mode (widthxheight)
|
90
|
+
glMatrixMode(GL_MODELVIEW) # Select Modelview Matrix
|
91
|
+
glPushMatrix() # Push The Matrix
|
92
|
+
glLoadIdentity() # Reset The Matrix
|
88
93
|
end
|
89
94
|
|
90
95
|
def viewPerspective # Set Up A Perspective View
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
96
|
+
glMatrixMode( GL_PROJECTION ) # Select Projection
|
97
|
+
glPopMatrix() # Pop The Matrix
|
98
|
+
glMatrixMode( GL_MODELVIEW ) # Select Modelview
|
99
|
+
glPopMatrix() # Pop The Matrix
|
95
100
|
end
|
96
101
|
|
97
102
|
def normalize(v)
|
98
|
-
|
99
|
-
|
100
|
-
|
103
|
+
len = sqrt( v[0]*v[0] + v[1]*v[1] + v[2]*v[2])
|
104
|
+
return v if len==0
|
105
|
+
[ v[0] / len, v[1] / len, v[2] / len ]
|
101
106
|
end
|
102
107
|
|
103
108
|
def calcNormal(v) # Calculates Normal For A Quad Using 3 Points
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
109
|
+
# Finds The Vector Between 2 Points By Subtracting
|
110
|
+
# The x,y,z Coordinates From One Point To Another.
|
111
|
+
# Calculate The Vector From Point 1 To Point 0
|
112
|
+
v1, v2, out = [], [], []
|
113
|
+
x,y,z = 0,1,2
|
114
|
+
|
115
|
+
v1[x] = v[0][x] - v[1][x] # Vector 1.x=Vertex[0].x-Vertex[1].x
|
116
|
+
v1[y] = v[0][y] - v[1][y] # Vector 1.y=Vertex[0].y-Vertex[1].y
|
117
|
+
v1[z] = v[0][z] - v[1][z] # Vector 1.z=Vertex[0].y-Vertex[1].z
|
118
|
+
# Calculate The Vector From Point 2 To Point 1
|
119
|
+
v2[x] = v[1][x] - v[2][x] # Vector 2.x=Vertex[0].x-Vertex[1].x
|
120
|
+
v2[y] = v[1][y] - v[2][y] # Vector 2.y=Vertex[0].y-Vertex[1].y
|
121
|
+
v2[z] = v[1][z] - v[2][z] # Vector 2.z=Vertex[0].z-Vertex[1].z
|
122
|
+
# Compute The Cross Product To Give Us A Surface Normal
|
123
|
+
out[x] = v1[y]*v2[z] - v1[z]*v2[y] # Cross Product For Y - Z
|
124
|
+
out[y] = v1[z]*v2[x] - v1[x]*v2[z] # Cross Product For X - Z
|
125
|
+
out[z] = v1[x]*v2[y] - v1[y]*v2[x] # Cross Product For X - Y
|
126
|
+
|
127
|
+
normalize(out)
|
123
128
|
end
|
124
129
|
|
125
130
|
def createHelix() # creates helix VA
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
131
|
+
twists = 5
|
132
|
+
r = 1.5
|
133
|
+
|
134
|
+
helix_v = []
|
135
|
+
helix_n = []
|
136
|
+
|
137
|
+
0.step(360,20) do |phi| # 360 Degrees In Steps Of 20
|
138
|
+
0.step(360*twists,20) do |theta| # 360 Degrees * Number Of Twists In Steps Of 20
|
139
|
+
v= phi/180.0*PI # Calculate Angle Of First Point ( 0 )
|
140
|
+
u= theta/180.0*PI # Calculate Angle Of First Point ( 0 )
|
141
|
+
|
142
|
+
x= cos(u)*(2.0+cos(v))*r # Calculate x Position (1st Point)
|
143
|
+
y= sin(u)*(2.0+cos(v))*r # Calculate y Position (1st Point)
|
144
|
+
z=((u-(2.0*PI)) + sin(v))*r # Calculate z Position (1st Point)
|
145
|
+
|
146
|
+
v0 = [x,y,z]
|
147
|
+
|
148
|
+
v= phi/180.0*PI # Calculate Angle Of Second Point ( 0 )
|
149
|
+
u= (theta+20)/180.0*PI # Calculate Angle Of Second Point ( 20 )
|
150
|
+
|
151
|
+
x= cos(u)*(2.0+cos(v))*r # Calculate x Position (2nd Point)
|
152
|
+
y= sin(u)*(2.0+cos(v))*r # Calculate y Position (2nd Point)
|
153
|
+
z= ((u-(2.0*PI)) + sin(v))*r # Calculate z Position (2nd Point)
|
154
|
+
|
155
|
+
v1 = [x,y,z]
|
156
|
+
|
157
|
+
v= (phi+20)/180.0*PI # Calculate Angle Of Third Point ( 20 )
|
158
|
+
u= (theta+20)/180.0*PI # Calculate Angle Of Third Point ( 20 )
|
159
|
+
|
160
|
+
x= cos(u)*(2.0+cos(v))*r # Calculate x Position (3rd Point)
|
161
|
+
y= sin(u)*(2.0+cos(v))*r # Calculate y Position (3rd Point)
|
162
|
+
z= ((u-(2.0*PI)) + sin(v))*r # Calculate z Position (3rd Point)
|
163
|
+
|
164
|
+
v2 = [x,y,z]
|
165
|
+
|
166
|
+
v= (phi+20)/180.0*PI # Calculate Angle Of Fourth Point ( 20 )
|
167
|
+
u= (theta)/180.0*PI # Calculate Angle Of Fourth Point ( 0 )
|
168
|
+
|
169
|
+
x= cos(u)*(2.0+cos(v))*r # Calculate x Position (4th Point)
|
170
|
+
y= sin(u)*(2.0+cos(v))*r # Calculate y Position (4th Point)
|
171
|
+
z= ((u-(2.0*PI)) + sin(v))*r # Calculate z Position (4th Point)
|
172
|
+
|
173
|
+
v3 = [x,y,z]
|
174
|
+
|
175
|
+
normal = calcNormal([v0,v1,v2,v3]) # Calculate The Quad Normal
|
176
|
+
helix_v << v0 << v1 << v2 << v3
|
177
|
+
helix_n << normal << normal << normal << normal
|
178
|
+
end
|
179
|
+
end
|
180
|
+
[helix_v,helix_n]
|
176
181
|
end
|
177
182
|
|
178
|
-
def processHelix() # Draws A Helix
|
179
|
-
|
180
|
-
|
183
|
+
def processHelix() # Draws A Helix
|
184
|
+
glfMaterialColor = [0.4,0.2,0.8,1.0] # Set The Material Color
|
185
|
+
specular = [1.0,1.0,1.0,1.0] # Sets Up Specular Lighting
|
181
186
|
|
182
|
-
|
183
|
-
|
187
|
+
glLoadIdentity() # Reset The Modelview Matrix
|
188
|
+
gluLookAt(0, 5, 50, 0, 0, 0, 0, 1, 0) # Eye Position (0,5,50) Center Of Scene (0,0,0), Up On Y Axis
|
184
189
|
|
185
|
-
|
190
|
+
glPushMatrix() # Push The Modelview Matrix
|
186
191
|
|
187
|
-
|
188
|
-
|
189
|
-
|
192
|
+
glTranslatef(0,0,-50) # Translate 50 Units Into The Screen
|
193
|
+
glRotatef($angle/2.0,1,0,0) # Rotate By angle/2 On The X-Axis
|
194
|
+
glRotatef($angle/3.0,0,1,0) # Rotate By angle/3 On The Y-Axis
|
190
195
|
|
191
|
-
|
192
|
-
|
196
|
+
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,glfMaterialColor)
|
197
|
+
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,specular)
|
193
198
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
200
|
+
glEnableClientState(GL_NORMAL_ARRAY)
|
201
|
+
glDrawArrays(GL_QUADS,0,$helix_v.size)
|
202
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
203
|
+
glDisableClientState(GL_NORMAL_ARRAY)
|
199
204
|
|
200
|
-
|
205
|
+
glPopMatrix() # Pop The Matrix
|
201
206
|
end
|
202
207
|
|
203
208
|
def drawBlur(times,inc)
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
209
|
+
spost = 0.0 # Starting Texture Coordinate Offset
|
210
|
+
alphainc = 0.9 / times # Fade Speed For Alpha Blending
|
211
|
+
alpha = 0.2 # Starting Alpha Value
|
212
|
+
|
213
|
+
width = glutGet(GLUT_WINDOW_WIDTH)
|
214
|
+
height = glutGet(GLUT_WINDOW_HEIGHT)
|
215
|
+
# Disable AutoTexture Coordinates
|
216
|
+
glDisable(GL_TEXTURE_GEN_S)
|
217
|
+
glDisable(GL_TEXTURE_GEN_T)
|
218
|
+
|
219
|
+
glEnable(GL_TEXTURE_2D) # Enable 2D Texture Mapping
|
220
|
+
glDisable(GL_DEPTH_TEST) # Disable Depth Testing
|
221
|
+
glBlendFunc(GL_SRC_ALPHA,GL_ONE) # Set Blending Mode
|
222
|
+
glEnable(GL_BLEND) # Enable Blending
|
223
|
+
glBindTexture(GL_TEXTURE_2D,$blurTexture) # Bind To The Blur Texture
|
224
|
+
viewOrtho() # Switch To An Ortho View
|
225
|
+
|
226
|
+
alphainc = alpha / times # alphainc=0.2 / Times To Render Blur
|
227
|
+
|
228
|
+
glBegin(GL_QUADS) # Begin Drawing Quads
|
229
|
+
0.upto(times-1) do |num| # Number Of Times To Render Blur
|
230
|
+
glColor4f(1.0, 1.0, 1.0, alpha) # Set The Alpha Value (Starts At 0.2)
|
231
|
+
glTexCoord2f(0+spost,1-spost) # Texture Coordinate ( 0, 1 )
|
232
|
+
glVertex2f(0,0) # First Vertex ( 0, 0 )
|
233
|
+
|
234
|
+
glTexCoord2f(0+spost,0+spost) # Texture Coordinate ( 0, 0 )
|
235
|
+
glVertex2f(0,height) # Second Vertex ( 0, height )
|
236
|
+
|
237
|
+
glTexCoord2f(1-spost,0+spost) # Texture Coordinate ( 1, 0 )
|
238
|
+
glVertex2f(width,height) # Third Vertex ( width, height )
|
239
|
+
|
240
|
+
glTexCoord2f(1-spost,1-spost) # Texture Coordinate ( 1, 1 )
|
241
|
+
glVertex2f(width,0) # Fourth Vertex ( width, 0 )
|
242
|
+
|
243
|
+
spost += inc # Gradually Increase spost (Zooming Closer To Texture Center)
|
244
|
+
alpha = alpha - alphainc # Gradually Decrease alpha (Gradually Fading Image Out)
|
245
|
+
end
|
246
|
+
glEnd() # Done Drawing Quads
|
247
|
+
|
248
|
+
viewPerspective() # Switch To A Perspective View
|
249
|
+
|
250
|
+
glEnable(GL_DEPTH_TEST) # Enable Depth Testing
|
251
|
+
glDisable(GL_TEXTURE_2D) # Disable 2D Texture Mapping
|
252
|
+
glDisable(GL_BLEND) # Disable Blending
|
253
|
+
glBindTexture(GL_TEXTURE_2D,0) # Unbind The Blur Texture
|
249
254
|
end
|
250
255
|
|
251
256
|
|
252
257
|
def renderToTexture
|
253
|
-
|
258
|
+
glViewport(0,0,128,128); # Set Our Viewport (Match Texture Size)
|
254
259
|
|
255
|
-
|
260
|
+
processHelix() # Render The Helix
|
256
261
|
|
257
|
-
|
262
|
+
glBindTexture(GL_TEXTURE_2D,$blurTexture) # Bind To The Blur Texture
|
258
263
|
|
259
|
-
|
260
|
-
|
264
|
+
# Copy Our ViewPort To The Blur Texture (From 0,0 To 128,128... No Border)
|
265
|
+
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, 128, 128, 0)
|
261
266
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
+
glClearColor(0.0, 0.0, 0.5, 0.5) # Set The Clear Color To Medium Blue
|
268
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Clear The Screen And Depth Buffer
|
269
|
+
width = glutGet(GLUT_WINDOW_WIDTH)
|
270
|
+
height = glutGet(GLUT_WINDOW_HEIGHT)
|
271
|
+
glViewport(0 , 0,width,height) # Set Viewport (0,0 to widthxheight)
|
267
272
|
end
|
268
273
|
|
269
274
|
drawGLScene = lambda do # Draw The Scene
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
275
|
+
glClearColor(0.0, 0.0, 0.0, 0.5) # Set The Clear Color To Black
|
276
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Clear Screen And Depth Buffer
|
277
|
+
glLoadIdentity() # Reset The View
|
278
|
+
renderToTexture() # Render To A Texture
|
279
|
+
processHelix() # Draw Our Helix
|
280
|
+
drawBlur(25,0.02) # Draw The Blur Effect
|
281
|
+
glFlush() # Flush The GL Rendering Pipeline
|
282
|
+
glutSwapBuffers()
|
283
|
+
sleep(0.001) # don't hog all cpu time
|
279
284
|
end
|
280
285
|
|
281
286
|
idle = lambda do
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
287
|
+
now = glutGet(GLUT_ELAPSED_TIME)
|
288
|
+
elapsed = now - $lasttime
|
289
|
+
$angle += (elapsed * 0.03) # Update angle Based On The Clock
|
290
|
+
$lasttime = now
|
286
291
|
|
287
|
-
|
292
|
+
glutPostRedisplay()
|
288
293
|
end
|
289
294
|
|
290
295
|
# Main
|