|
ScreenVSync | ||
ScreenVSync Flag | ||
Parameters: Flag = Vsync State (1 = Enable) (0 = off) |
||
Returns: NONE | ||
ScreenVSync enables/disables vertical beam synchronization during for screen refresh. When enabled this makes the SYNC command refresh the screen to your monitor using your graphics cards vertical beam. This gives smoother graphics refresh, at the expensive of some performance ! FACTS: * ScreenVSync is off by default. * ScreenVSync is supported in both window and full screen modes. * When ScreenVSync is enabled, you get smoother graphics refresh, but slower (often fixed) frame rates ! * Since enabling VSync makes your program refresh at the monitors refresh rate. Don't assume that other peoples computers will run at the same refresh rate as yours. Their monitor refresh could be set higher/lower than yours! So in those cases, your game with run faster or slower on such computers. * ScreenVSync is a frame limiting mechanism. Therefore, it does not tween the frame rate of your application. So if the machine your program is running upon isn't fast enough to meet your required frame rate, the program will slow down. There's a number of strategies to coupe with this, one common one is something called Timer Based Movement. There's a number of timer based movement examples on the forums as well as the bare bones example bellow and on the timer page. * It's not recommended to use the ScreenVSync in conjunction with SetFPS. This tends to make the frame rate choppy. If you do, we recommend setting the preferred frame rate to say 100 or 200. This is unlike to impact on the Vsync control and should prevent your program from being a complete system hog on machines that either don't have a Vsync support, or it's disabled. Important Note: Many video card drivers, allow the end users to override vertical beam synchronization. Therefore, users who disable VYSNC in their video drivers, won't see any affect by enabling ScreenVSync on those machines, nor will turning on Vsync slow your program down on these machines. Therefore, it's wise to implement object movements independent of the computers actual frame rate. Example #1: This simple example creates a screen, enables Vsyncing, then renders some coloured scrolling boxes to the screen. While the example runs the user enable/disable Vsyncing to view the effect on the smoothness of the scrolling output.
Example #2 -Timer Based Movement: This example moves a circle LEFT to RIGHT across the screen. Rather than using frame based movement, where we'd normally add our movement speed onto the moving object each time through the main loop, this time we're using Timer Based Movement. You can toggle VSYNC using the SPACE BAR.
|
Related Info: | GetScreenVSync | OpenScreen | SetFPS | SwapScreen | Sync | Timer : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |