Syncronising app with screen

Hello

I am in the process of creating a few demoes. Here I load in a few models and make them crash into each other. My problem is that it apparently takes a while to get the GLlists to the gfx card.(thats my theory anyway) So by the time the scene shows on screen , the demo is already done.

How can I syncronise this, how does one syncronise screen with application.

You’re using time-based rendering I take it; what’s happening is that you’re letting the timer run while resources are being loaded and created. Probably not good at startup! You should stop the timer while something is being loaded and created and restart it afterwards. (Use the new lwjgl util Timer class - it’s a breeze)

Cas :slight_smile:

k, not to sure how to use it though. Currently my loop is something like this (very simplified)

while(true){

dt=frametime (with 60 FPS dt=1/60th of a sec)
movestuff(dt)
draw()

}

How would tickbased go?

I think you want to be using timebased rendering, not tickbased. Tickbased is good for 2D.

To use the Timer:

Call Timer.tick(); once per frame. This is a static method; all instantiated Timers are updated simultaneously.

Each object that needs to be timed can then have its own Timer, which you can pause() or reset() and call getTime() on it as needed. It returns the float time in seconds since the timer was constructed.

Because all the timers are synchronized to the Timer.tick() function they’ll all be properly in step with each other too.

Cas :slight_smile: