Jamieson's picture

V Sync to which monitor?

Hi,

I installed OpenTX yesterday and started programming OpenGL for the first time. My software uses two Winforms windows, one control form and a display window (Which contains the GLControl).

The program is for simple 2D animation where i have rendered a quad and i'm swapping textures to get the effect im looking for. The good news it works.
Both Winforms (control and display) are created on Screen 1, i then move the display window on to Screen 2 and maximise.

My question is, given that my monitors have different refresh rates, which vsync is being used to frame limit my displaywindow ? and do i need to select the screen in some way ?

Thanks Jamie


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

The while loop is executing as fast as possible, burning CPU time. In most cases, enabling vsync will take care of that (use glControl1.Context.SwapInterval = 1.)

Another thing you can do is measure how many frames you are rendering, and call System.Threading.Thread.Sleep(1) to throttle your app when the framerate goes too high.

virabhadra's picture

Now the movements are smooth and it looks nice!

It wasn't so intuitive to find that in the glControl settings.

Thank you for the answer!