vsync in SWT GLCanvas

Started by chytrus, March 09, 2006, 15:10:40

Previous topic - Next topic

chytrus

Can smoone tell me how to enable vsync when my drawing context is
SWT GLCanvas.

chytrus

TalanOFF

Hmm, that's a good question. I couldn't find anything about that on the project page.

Well, as the SWT3.2 is still being developed there still is a chance that this one appears in the final release.

Signed: TalanOFF

Matzon

vsync doesn't make sense in windowed mode

chytrus

So is there other way to have smooth animation in the windowed mode ?

Fool Running

QuoteSo is there other way to have smooth animation in the windowed mode ?
What do you mean by "smooth" animation? You shouldn't need VSync enabled to do animation that is at least 30fps (My definition of smooth :D )
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

princec

My definition of smooth is 60fps :twisted:

Cas :)

baysmith

For a maximum of 100 fps with very low polling overhead, use a looping timerExec() call like the following:

   display.timerExec(0, new Runnable() {

      public void run() {
        render();
        display.timerExec(0, this);
      }
      
    });


This has a maximum of 100 fps because the timerExec() has a minimum resolution of 10 milliseconds (at least on Eclipse 3.2M5a, Windows XP). Results may vary depending on the complexity of your scene and speed of your graphics card. For my small test scenes, 100 fps is achived with almost zero CPU cost.

Greater than 100 fps can be achived by using display.asyncExec() and the high resolution timer, org.lwjgl.util.Timer. However, CPU overhead will be incurred from polling the timer.