Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Time and Animation [3/9]

Here is an improved version of the program with a stable image.

The vsync function waits for the computer to finish refreshing the screen. The computer refreshes the screen at the display device's frame rate.

After the vsync function completes, the program can draw to the screen again.

After running and studying the program, change the number (i.e. literal expression) 100 to some other value and observe how it affects the output. Try values 10 and 300.

* * *

-- Vertical Synchronization --

The vertical synchronization signal is issued by the graphics processing unit (GPU) when it has completed sending the contents of the display framebuffer to the display device. The vsync function is similar to the sleepMs function, except that it pauses the program until the vertical synchronization signal is received from the GPU.

Loading...