Archived

This topic is now archived and is closed to further replies.

Elliot

more detail = slower overall speed

Recommended Posts

how do you change your ogl programs so that detail only effects your frames per second and not the timing? for example a ball going from one place to another while it''s slower if it has a background.

Share this post


Link to post
Share on other sites
you need to using some timing mechanism to work out how much time has elapsed between frames ... here''s an example

say you want a cube to rotate 360 degrees every second, here''s the psuedo-code

t1 = time(in milliseconds)

loop
t2 = current time(in milliseconds)
draw background (what you call detail)
rotate cube 360/((t2 - t1) / 1000)
draw cube
goto loop

this is basically the same as saying speed = distance / time ... therefore knowing a given speed, and how much time has elapsed, you can work out how far an object would have travelled in a given time period!

i know that''s a bit muddled! but i''ve only just woken up!

Share this post


Link to post
Share on other sites