When playing a Video in my OpenGL Game (e.g. startup video), I want to sync it with my delta time. What is the delta time and how to use here.

Do I need to sync with the delta time (and how?) or is there another way to sync my video? I'm using my own video file reader.

  • 4
    \$\begingroup\$ Unless the video is silent, you're probably better off synchronizing the video playback with the audio track. \$\endgroup\$ – Adam May 27 '13 at 9:42

The Delta Time is simply a standarized "clock time", which should be always be 1Hz or 1tick/1second. Some clocks can be to fast or too slow so a precise Rolex watch will show the exact delta time while a cheap one will lie a bit...

The CPU's are referred to as clocks (for eg. the overclocking). Depending on their "clock rate" some can even be over 5Ghz, so they can generate 5,000,000,000 "clock beats" per second. If you do not use the delta time in your video player, your computers clock will frames of the video 5Bil x faster then it should. So it needs to be downscaled to a human-friendly time measurement unit. Would You use miles to measure the height of an ant - You can, but why would you?

Older games for Windows 95, didn't use the delta time but were scaled for the cpu's at that time. If you load a 25 year old game into a new computer wont be able to play it, as it was meant to be used on an Intel 80386 or something similar which had the clockrate of 40Mhz. So the game would play 125x faster on the new PC with 5GHz clock.

Read about the deltatime and the clock rate on Wikipedia, and before you script anything which has a time constant keep in mind that if it is meant for different CPU's you always have to use the Delta Time. :)



  • \$\begingroup\$ It can end worse than simply being "too fast". ;) I remember when I tried to play the classic Nibbles.bas on my 133 MHz Pentium - it simply crashed (or more specific: stopped with a interpreter error) due to dividing by 0: The game tried to measure the processor's speed and then used that value to calculate speeds. Only downside has been the fact a reasonably fast machine got it to cause a "divide by zero" error. \$\endgroup\$ – Mario Mar 28 '13 at 0:33
  • \$\begingroup\$ Some very old games may work on modern systems if they are vsynced or have a way to turn on vsync. If simulation have to wait for screen refresh that will limit the max FPS they may reach. \$\endgroup\$ – Hatoru Hansou Jun 26 '13 at 1:28
  • 1
    \$\begingroup\$ I don't think this actually answers the question, which is about playing videos, not the merits of time-based over frame-based animation. \$\endgroup\$ – Nathan Reed Jun 26 '13 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.