bulldog_physics 0.1.1 → 0.2.0

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.
@@ -0,0 +1,38 @@
1
+ module BulldogPhysics
2
+ class Spring < ForceGenerator
3
+
4
+
5
+ attr :connection_point # connection point in local coords
6
+ attr :other_connection_point # point of connection of the spring to the other object in that objects local coords
7
+ attr :other #particle at the other end of the spring
8
+ attr :spring_constant
9
+ attr :rest_length
10
+
11
+ def initialize(local_connection_pt, other_body, other_connection_point, spring_constant, rest_length)
12
+ @conection_point, @other, @other_connection_point, @spring_constant, @rest_length = local_connection_pt, other_body, other_connection_point, spring_constant, rest_length
13
+ end
14
+
15
+ def update_force(body, duration)
16
+ # calc ends in world space
17
+ lws = body.get_point_in_world_space(@conection_point)
18
+ ows = other.get_point_in_world_space(@other_connection_point)
19
+
20
+ # calculate the vector of the string
21
+ force = lws - ows
22
+
23
+ # calculate magnitude of the force
24
+ magnitude = force.magnitude
25
+ magnitude = (magnitude - @rest_length).abs
26
+ magnitude *= @spring_constant
27
+
28
+ # calculate and apply the final force
29
+ force.normalize
30
+ force *= -magnitude
31
+ body.add_force_at_point(force, lws)
32
+ end
33
+
34
+
35
+
36
+
37
+ end
38
+ end
@@ -0,0 +1,97 @@
1
+ module BulldogPhysics
2
+ class BodyRegistration
3
+ attr_accessor :body, :next_body
4
+
5
+ def initialize(body = RigidBody.new, next_body = nil)
6
+ @body = body
7
+ @next_body = next_body
8
+ end
9
+ end
10
+
11
+ class ContactGenRegistration
12
+ attr_accessor :gen, :next_gen
13
+
14
+ def initialize(gen = ContactGenerator.new, next_gen = nil)
15
+ @gen = gen
16
+ @next_body = next_gen
17
+ end
18
+ end
19
+
20
+ class World
21
+
22
+ attr_accessor :bodies, :registry
23
+ attr_accessor :resolver
24
+ attr_accessor :contact_generators
25
+ attr_accessor :first_body
26
+ attr_accessor :contacts
27
+ attr_accessor :max_contacts
28
+ attr_accessor :calculate_iterations
29
+
30
+
31
+ def initialize(max_contacts = 20, iterations = 5)
32
+ @max_contacts = max_contacts
33
+ @contacts = Array.new
34
+ @calculate_iterations = iterations == 0
35
+ @resolver = ContactResolver.new(iterations)
36
+ @bodies = Array.new
37
+ @registry = ForceRegistry.new
38
+ @contact_generators = Array.new
39
+ end
40
+
41
+ def start_frame()
42
+ @bodies.each do |body|
43
+ body.clear_accumulators
44
+ body.calculate_derived_data
45
+ end
46
+ end
47
+
48
+ def generate_contacts()
49
+ limit = @max_contacts
50
+
51
+
52
+ for g in @contact_generators
53
+ used = g.add_contact(@contacts, limit)
54
+ end
55
+
56
+ #eturn @max_contacts - limit
57
+ return @contacts.size
58
+ end
59
+
60
+
61
+ def integrate(duration)
62
+ for b in @bodies
63
+ b.integrate(duration)
64
+ b.calculate_derived_data
65
+ #b.calculate_internals
66
+ end
67
+ end
68
+
69
+ def run_physics(duration, clear_contacts = true)
70
+
71
+ #@contacts.clear() if clear_contacts
72
+
73
+ @registry.update_forces(duration)
74
+ integrate(duration)
75
+ used_contacts = generate_contacts()
76
+
77
+ if(used_contacts > 0)
78
+ #if(@calculate_iterations)
79
+ @resolver.iterations = used_contacts * 2
80
+ @resolver.resolve_contacts(@contacts, used_contacts, duration)
81
+ # end
82
+ end
83
+
84
+
85
+
86
+
87
+ #integrate(duration)
88
+ end
89
+
90
+ def add_gravity
91
+ #gravity = Gravity.new(Vector3.new(0, -0.5, 0))
92
+ #@bodies.each{|body| @registry.add(body, gravity)}
93
+ end
94
+
95
+
96
+ end
97
+ end
@@ -40,8 +40,10 @@ module BulldogPhysics
40
40
  end
41
41
 
42
42
  #require_all 'Particles'
43
- require 'vector3'
44
- require 'matrix3'
45
- require 'quaternion'
46
- require 'matrix4'
43
+ require File.join(File.dirname(__FILE__), '/vector3')
44
+ require File.join(File.dirname(__FILE__), '/matrix3')
45
+ require File.join(File.dirname(__FILE__), '/quaternion')
46
+ require File.join(File.dirname(__FILE__), '/matrix4')
47
+
47
48
  require_all File.dirname(__FILE__) + '/Particles'
49
+ require_all File.dirname(__FILE__) + '/RigidBodies'
@@ -17,5 +17,9 @@ module GlStuff
17
17
  glEnable(GL_TEXTURE_2D);
18
18
  end
19
19
 
20
+
21
+ def self.mem_pointer(array)
22
+ MemoryPointer.new(:float, array.size).put_array_of_float(0, array)
23
+ end
20
24
  end
21
25
  end
@@ -9,7 +9,7 @@ module GlStuff
9
9
  def initialize
10
10
  @ambient = [ 0.0, 1.0, 0.0, 1.0 ]
11
11
  @diffuse = [ 1.0, 1.0, 1.0, 1.0 ]
12
- @position = [ 1.0, 5.0, 1.0, 0.0 ]
12
+ @position = MemoryPointer.new(:float, 4).put_array_of_float(0, [1.0, 5.0, 1.0, 1.0])
13
13
  @lmodel_ambient = [ 0.4, 0.4, 0.4, 1.0 ]
14
14
  @no_mat = [ 0.0, 0.0, 0.0, 1.0 ]
15
15
  @mat_ambient = [ 0.7, 0.7, 0.7, 1.0 ]
@@ -4,20 +4,20 @@ module GlStuff
4
4
  attr_accessor :ambient, :diffuse, :specular, :shininess, :emission
5
5
 
6
6
  def initialize()
7
- @ambient = [ 0.7, 0.7, 0.7, 1.0 ]
8
- @ambient_color = [ 0.8, 0.8, 0.2, 1.0 ]
9
- @diffuse = [ 0.5, 0.5, 0.5, 1.0 ]
10
- @specular = [ 1.0, 1.0, 1.0, 1.0 ]
11
- @shininess = [ 0.0 ] # 0 is noe, 100 would be hide
12
- @emission = [0.3, 0.2, 0.2, 0.0]
7
+ @ambient = GlUtility.mem_pointer([ 0.7, 0.7, 0.7, 1.0 ])
8
+ @ambient_color = GlUtility.mem_pointer([ 0.8, 0.8, 0.2, 1.0 ])
9
+ @diffuse = GlUtility.mem_pointer([ 0.5, 0.5, 0.5, 1.0 ])
10
+ @specular = GlUtility.mem_pointer([ 1.0, 1.0, 1.0, 1.0 ])
11
+ @shininess = GlUtility.mem_pointer([ 0.0 ]) # 0 is noe, 100 would be hide
12
+ @emission = GlUtility.mem_pointer([0.3, 0.2, 0.2, 0.0])
13
13
  end
14
14
 
15
15
  def setup_material
16
- glMaterial(GL_FRONT, GL_AMBIENT, @ambient)
17
- glMaterial(GL_FRONT, GL_DIFFUSE, @diffuse)
18
- glMaterial(GL_FRONT, GL_SPECULAR, @specular)
19
- glMaterial(GL_FRONT, GL_SHININESS, @shininess)
20
- glMaterial(GL_FRONT, GL_EMISSION, @emission)
16
+ glMaterialfv(GL_FRONT, GL_AMBIENT, @ambient)
17
+ #glMaterialfv(GL_FRONT, GL_DIFFUSE, @diffuse)
18
+ #glMaterialfv(GL_FRONT, GL_SPECULAR, @specular)
19
+ #glMaterialfv(GL_FRONT, GL_SHININESS, @shininess)
20
+ #glMaterialfv(GL_FRONT, GL_EMISSION, @emission)
21
21
  end
22
22
 
23
23
  end
@@ -0,0 +1,189 @@
1
+ require 'rubygems'
2
+ require 'rubygame'
3
+ begin
4
+ require 'ffi-opengl'
5
+ $gl = :ffi_opengl
6
+ include FFI,GL,GLU,GLUT
7
+ rescue LoadError
8
+ puts "ATTENTION: This demo requires the opengl extension for ruby."
9
+ raise
10
+ end
11
+ require './lib/bulldog_physics'
12
+ require_all './lib/examples/GlStuff'
13
+ include BulldogPhysics
14
+ include Rubygame
15
+ include GlStuff
16
+
17
+
18
+ class Game
19
+ def initialize(width,height)
20
+ @width = width
21
+ @height = height
22
+ @queue = EventQueue.new
23
+ @queue.enable_new_style_events
24
+ @clock = Clock.new
25
+ @world = World.new(20,2)
26
+ @x_trans, @y_trans, @z_trans = 0, 0, -20
27
+ @w_down = @a_down = @s_down = @d_down = @zoom_in_down = false
28
+ end
29
+
30
+ def init_game()
31
+ Rubygame.init
32
+
33
+ Rubygame::GL.set_attrib(Rubygame::GL::RED_SIZE, 5)
34
+ Rubygame::GL.set_attrib(Rubygame::GL::GREEN_SIZE, 5)
35
+ Rubygame::GL.set_attrib(Rubygame::GL::BLUE_SIZE, 5)
36
+ # Rubygame::GL.set_attrib(Rubygame::GL::DEPTH_SIZE, 16)
37
+ #Rubygame::GL.set_attrib(Rubygame::GL::DOUBLEBUFFER, 1)
38
+
39
+ @maximum_resolution = Screen.get_resolution
40
+ @screen = Screen.new([@width,@height], 16, [OPENGL,HWSURFACE])
41
+ @clock.target_framerate = 30
42
+ @clock.calibrate
43
+ @clock.enable_tick_events
44
+ ObjectSpace.garbage_collect
45
+
46
+ glViewport( 0, 0, @width, @height )
47
+ glMatrixMode( GL_PROJECTION )
48
+ glLoadIdentity( )
49
+
50
+ gluPerspective( 45, @width/@height, 0.5, 1000.0)
51
+ #gluLookAt(0.0,0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0);
52
+ glMatrixMode( GL_MODELVIEW )
53
+ glLoadIdentity( )
54
+
55
+ @lighting = Lighting.new
56
+ @lighting.setup
57
+
58
+ glShadeModel(GL_SMOOTH);
59
+ glEnable(GL_DEPTH_TEST)
60
+ glEnable(GL_LIGHTING)
61
+ glEnable(GL_LIGHT0)
62
+ glDepthFunc(GL_LESS)
63
+
64
+ @sail_boat = RigidBody.new
65
+ @sail_boat.position = Vector3.new(0, 1.6, 0)
66
+ @sail_boat.orientation = Quaternion.new(1.0, 0, 0, 0)
67
+ @sail_boat.mass = 200.0
68
+ #@sail_boat.set_inertia_tensor(Vector3.new(2,1,1), 100)
69
+ @sail_boat.linear_damping = 0.8
70
+ @sail_boat.angular_damping = 0.8
71
+ @sail_boat.calculate_derived_data
72
+
73
+ buoyancy = Buoyancy.new(Vector3.new(0.0, 0.5, 0.0 ), 1.0, 3.6, 1.6)
74
+ @world.registry.add( @sail_boat, buoyancy)
75
+ @world.bodies << @sail_boat
76
+ end
77
+
78
+
79
+
80
+ def run()
81
+ catch(:rubygame_quit) do
82
+ loop do
83
+ @queue.each do |event|
84
+ case event
85
+ when Rubygame::Events::KeyPressed
86
+ # puts event.key
87
+ case event.key
88
+ when :escape
89
+ throw :rubygame_quit
90
+ when :q
91
+ throw :rubygame_quit
92
+ when :w
93
+ @w_down = true
94
+ @zoom_in_down = event.modifiers.include? :left_shift
95
+ when :s
96
+ @s_down = true
97
+ @zoom_out_down = event.modifiers.include? :left_shift
98
+ when :a
99
+ @a_down = true
100
+ when :d
101
+ @d_down = true
102
+ when Rubygame::Events::KeyReleased
103
+ case event.key
104
+ when :w
105
+ @w_down = false
106
+ when :a
107
+ @a_down = false
108
+ when :d
109
+ @d_down = false
110
+ when :s
111
+ @s_down = false
112
+ end
113
+ @zoom_in_down = false
114
+ when Rubygame::Events::QuitRequested
115
+ throw :rubygame_quit
116
+ end
117
+ end
118
+
119
+ @time_elapsed = @clock.tick()
120
+ @time_alive = @clock.lifetime
121
+ seconds_elapsed = @time_elapsed.milliseconds / 1000.0
122
+ duration = seconds_elapsed
123
+ @world.start_frame
124
+
125
+ glClearColor(0.0, 0.0, 0.0, -1.0)
126
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
127
+ glLoadIdentity()
128
+
129
+
130
+ interval = 2
131
+ if @w_down
132
+ unless @zoom_in_down
133
+ @z_trans += interval
134
+ else
135
+ @y_trans += interval
136
+ end
137
+ end
138
+ if @s_down
139
+ unless @zoom_out_down
140
+ @z_trans -= interval if @s_down
141
+ else
142
+ @y_trans -= interval
143
+ end
144
+ end
145
+ @x_trans += interval if @a_down
146
+ @x_trans -= interval if @d_down
147
+
148
+
149
+ glTranslatef(@x_trans,@y_trans,@z_trans)
150
+
151
+ glPushMatrix()
152
+ glBegin(GL_QUADS)
153
+ glVertex3f(-1000, -1 , 1000)
154
+ glVertex3f(-1000, -1, -1000)
155
+ glVertex3f(1000, -1, -1000)
156
+ glVertex3f(1000, -1, 1000)
157
+ glEnd
158
+ glPopMatrix()
159
+
160
+
161
+ @world.bodies.each do |body|
162
+ glPushMatrix()
163
+ mat = GlUtility.mem_pointer(body.get_gl_transform)
164
+ glMultMatrixf(mat)
165
+ glRotatef(body.rotation.x, 1, 0, 0)
166
+ glRotatef(body.rotation.y, 0, 1, 0)
167
+ glRotatef(body.rotation.z, 0, 0, 1)
168
+ glutSolidCube(0.5)
169
+ glPopMatrix()
170
+ end
171
+
172
+ @world.run_physics(duration, false)
173
+
174
+ Rubygame::GL.swap_buffers()
175
+ @screen.update
176
+ @screen.flip
177
+
178
+ ObjectSpace.garbage_collect
179
+
180
+ end
181
+ end
182
+
183
+ end
184
+
185
+ end
186
+
187
+ game = Game.new(640,480)
188
+ game.init_game
189
+ game.run
@@ -1,16 +1,16 @@
1
1
  require 'rubygems'
2
2
  require 'rubygame'
3
3
  begin
4
- require 'opengl'
5
- include Gl,Glu,Glut
4
+ require 'ffi-opengl'
5
+ $gl = :ffi_opengl
6
+ #include Gl,Glu,Glut
6
7
  rescue LoadError
7
8
  puts "ATTENTION: This demo requires the opengl extension for ruby."
8
9
  raise
9
10
  end
10
-
11
- require 'bulldog_physics'
12
-
13
- require_all 'GlStuff'
11
+ include FFI, GL, GLU, GLUT
12
+ require './lib/bulldog_physics'
13
+ require_all './lib/examples/GlStuff'
14
14
 
15
15
  include BulldogPhysics
16
16
  include BulldogPhysics::Particles
@@ -67,8 +67,8 @@ class Game
67
67
  @ball.damping = 1
68
68
  @ball.material.specular = BALL_SPECULAR
69
69
  @ball.material.diffuse = PARTICLE_DIFFUSE
70
- @ball.frozen = true
71
-
70
+ @ball.frozen = true
71
+
72
72
 
73
73
  @current_ball = Particle.new
74
74
  @current_ball.position = @ball.position
@@ -79,44 +79,47 @@ class Game
79
79
  @world.registry.add( @current_ball, ParticleGravity.new())
80
80
  @world.particles << @current_ball
81
81
 
82
-
82
+
83
83
  particle1 = Particle.new
84
84
  particle1.mass = 1
85
- particle1.position = Vector3.new(5,2,0)
86
- particle1.damping = 1
87
- particle1.velocity = Vector3.new(0,2.0,0)
85
+ particle1.position = Vector3.new(0.75,16.0,0.0)
86
+ particle1.damping = 0.8
87
+ particle1.velocity = Vector3.new(0.0,0.0,0)
88
88
  particle1.material.specular = ANCHOR_SPECULAR
89
89
  particle1.material.diffuse = PARTICLE_DIFFUSE
90
90
 
91
91
  particle2 = Particle.new
92
92
  particle2.mass = 1
93
- particle2.position = Vector3.new(0,2,0)
94
- particle2.damping = 1
93
+ particle2.position = Vector3.new(-8.0,5,0)
94
+ particle2.damping = 0.8
95
95
  particle2.velocity = Vector3.new(0,0.0,0)
96
96
  particle2.material.specular = ANCHOR_SPECULAR
97
97
  particle2.material.diffuse = PARTICLE_DIFFUSE
98
98
 
99
- prod = ParticleRod.new(particle1, particle2, 2.0)
100
-
99
+ #prod = ParticleRod.new(particle1, particle2, 2.0)
100
+
101
+ pspring = ParticleSpring.new(@current_ball,4,3)
102
+ @world.registry.add( particle2, ParticleGravity.new())
103
+ @world.registry.add( particle1, pspring)
101
104
  @world.particles << particle1
102
105
  @world.particles << particle2
103
- @world.contact_generators << prod
106
+ #@world.contact_generators << prod
104
107
 
105
- @world.contact_generators << ParticleGroundContacts.new(@world.particles)
106
- @world.contact_generators << ParticleParticleContacts.new(@world.particles)
108
+ @world.contact_generators << ParticleGroundContacts.new(@world.particles)
109
+ @world.contact_generators << ParticleParticleContacts.new(@world.particles)
107
110
 
108
111
  for i in 1..5
109
- for j in 1..5
110
- part = Particle.new
111
- part.mass = 0
112
- offset = j % 2 == 0 ? 1 : 0
113
- part.position = Vector3.new( -5 + i * 2 + offset, j * 2, 0)
114
- part.material.specular = SPRING_SPECULAR
115
- part.material.diffuse = PARTICLE_DIFFUSE
116
- @world.particles << part
117
- end
118
- end
119
-
112
+ for j in 1..5
113
+ part = Particle.new
114
+ part.mass = 0
115
+ offset = j % 2 == 0 ? 1 : 0
116
+ part.position = Vector3.new( -5 + i * 2 + offset, j * 2, 0)
117
+ part.material.specular = SPRING_SPECULAR
118
+ part.material.diffuse = PARTICLE_DIFFUSE
119
+ @world.particles << part
120
+ end
121
+ end
122
+
120
123
 
121
124
  puts "PARTICLE COUNT [ #{@world.particles.size} ] "
122
125
  puts "Contact Generators count: #{@world.contact_generators.size}"
@@ -134,20 +137,20 @@ class Game
134
137
  Rubygame::GL.set_attrib(Rubygame::GL::BLUE_SIZE, 5)
135
138
  Rubygame::GL.set_attrib(Rubygame::GL::DEPTH_SIZE, 16)
136
139
  Rubygame::GL.set_attrib(Rubygame::GL::DOUBLEBUFFER, 1)
137
-
138
- @maximum_resolution = Screen.get_resolution
140
+
141
+ @maximum_resolution = Screen.get_resolution
139
142
  @screen = Screen.new([@width,@height], 16, [OPENGL])
140
143
  @clock.target_framerate = 30
141
144
  @clock.calibrate
142
145
  @clock.enable_tick_events
143
146
  ObjectSpace.garbage_collect
144
147
 
145
- glViewport( 0, 0, WIDE, HIGH )
146
- glMatrixMode( GL::PROJECTION )
148
+ GL::glViewport( 0, 0, WIDE, HIGH )
149
+ glMatrixMode( GL_PROJECTION )
147
150
  glLoadIdentity( )
148
151
  #GLU::Perspective( -35, WIDE/(HIGH.to_f), 0.5, 30.0)
149
- GLU::Perspective( 45, WIDE/(HIGH.to_f), 0.5, 100.0)
150
- glMatrixMode( GL::MODELVIEW )
152
+ gluPerspective( 45, WIDE/(HIGH.to_f), 0.5, 100.0)
153
+ glMatrixMode( GL_MODELVIEW )
151
154
  glLoadIdentity( )
152
155
 
153
156
 
@@ -155,10 +158,10 @@ class Game
155
158
  @lighting.setup
156
159
 
157
160
  glShadeModel (GL_SMOOTH);
158
- glEnable(GL::DEPTH_TEST)
161
+ glEnable(GL_DEPTH_TEST)
159
162
  glEnable(GL_LIGHTING)
160
163
  glEnable(GL_LIGHT0)
161
- glDepthFunc(GL::LESS)
164
+ glDepthFunc(GL_LESS)
162
165
 
163
166
 
164
167
 
@@ -167,41 +170,41 @@ class Game
167
170
 
168
171
  def run()
169
172
  catch(:rubygame_quit) do
170
- loop do
171
- @queue.each do |event|
172
- case event
173
- when Rubygame::Events::KeyPressed
173
+ loop do
174
+ @queue.each do |event|
175
+ case event
176
+ when Rubygame::Events::KeyPressed
174
177
  # puts event.key
175
- case event.key
176
- when :escape
177
- throw :rubygame_quit
178
- when :q
179
- throw :rubygame_quit
180
- when :w
181
- @w_down = true
182
- when :s
183
- @s_down = true
184
- when :a
185
- @a_down = true
186
- when :d
187
- @d_down = true
188
- when :l
189
- @world.particles.each do |part|
190
- puts part.position
191
- puts "NUM CONTACTS: #{@world.contacts.size}"
192
- end
193
- when :space
194
- @current_ball.frozen = !@current_ball.frozen
178
+ case event.key
179
+ when :escape
180
+ throw :rubygame_quit
181
+ when :q
182
+ throw :rubygame_quit
183
+ when :w
184
+ @w_down = true
185
+ when :s
186
+ @s_down = true
187
+ when :a
188
+ @a_down = true
189
+ when :d
190
+ @d_down = true
191
+ when :l
192
+ @world.particles.each do |part|
193
+ puts part.position
194
+ puts "NUM CONTACTS: #{@world.contacts.size}"
195
+ end
196
+ when :space
197
+ @current_ball.frozen = !@current_ball.frozen
195
198
  when :r
196
- puts "RESET"
197
- @current_ball = Particle.new
198
- @current_ball.position = START_POSITION.dup
199
- @current_ball.velocity = @ball.velocity.dup
200
- @current_ball.mass = @ball.mass
201
- @current_ball.damping = @ball.damping
202
- @current_ball.frozen = true
203
- @world.registry.add( @current_ball, ParticleGravity.new())
204
- @world.particles << @current_ball
199
+ puts "RESET"
200
+ @current_ball = Particle.new
201
+ @current_ball.position = START_POSITION.dup
202
+ @current_ball.velocity = @ball.velocity.dup
203
+ @current_ball.mass = @ball.mass
204
+ @current_ball.damping = @ball.damping
205
+ @current_ball.frozen = true
206
+ @world.registry.add( @current_ball, ParticleGravity.new())
207
+ @world.particles << @current_ball
205
208
  end
206
209
  when Rubygame::Events::KeyReleased
207
210
  case event.key
@@ -237,7 +240,7 @@ class Game
237
240
  @world.start_frame
238
241
 
239
242
  glClearColor(0.0, 0.0, 0.0, -1.0)
240
- glClear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT)
243
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
241
244
  glLoadIdentity()
242
245
 
243
246
  glTranslatef(@x_trans,@y_trans,@z_trans)
@@ -266,12 +269,12 @@ class Game
266
269
 
267
270
  @world.run_physics(seconds_elapsed)
268
271
 
269
- Rubygame::GL.swap_buffers()
270
- @screen.update
272
+ Rubygame::GL.swap_buffers()
273
+ @screen.update
271
274
  @screen.flip
272
- ObjectSpace.garbage_collect
275
+ ObjectSpace.garbage_collect
273
276
 
274
- end
277
+ end
275
278
  end
276
279
 
277
280
  end