LWJGL Forum

Programming => OpenGL => Topic started by: chytrus on March 09, 2006, 15:10:40

Title: vsync in SWT GLCanvas
Post by: chytrus on March 09, 2006, 15:10:40
Can smoone tell me how to enable vsync when my drawing context is
SWT GLCanvas.

chytrus
Title: vsync in SWT GLCanvas
Post by: TalanOFF on March 10, 2006, 11:35:41
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
Title: vsync in SWT GLCanvas
Post by: Matzon on March 10, 2006, 15:41:15
vsync doesn't make sense in windowed mode
Title: vsync in SWT GLCanvas
Post by: chytrus on March 10, 2006, 16:56:19
So is there other way to have smooth animation in the windowed mode ?
Title: hmmmmmmmm...
Post by: Fool Running on March 10, 2006, 18:14:01
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 )
Title: vsync in SWT GLCanvas
Post by: princec on March 11, 2006, 16:02:17
My definition of smooth is 60fps :twisted:

Cas :)
Title: vsync in SWT GLCanvas
Post by: baysmith on March 23, 2006, 07:53:17
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.