Warning: This site is under construction, most links will be broken.

LightX API -> lxgfx -> setvblankmode

Last modified on Tue, 10th Apr 2007 at 00:42 UTC by zipplet

lxgfx.setvblankmode


procedure setvblankmode(
  mode: tlxvblankwait
);


Sets the vertical synchronisation mode for page flipping/frame output. Vertical synchronisation prevents frame tearing during animation. Games should not rely on a vertical blank occuring at a specific frequency (60hz for example) because it depends on the monitor. A later version of LightX may contain a call to query the frequency.

The default mode when lxgfx is initialised is vbNone.

mode: tlxvblankwait
vbNone: Do not wait for vertical blank before flipping.

vbBlocking: Wait for vertical blank before flipping, using a call that will probably use up 100% CPU time (such as DirectDraw7.WaitForVerticalBlank). If you are using a doublebuffering or triplebuffering scheme in full screen mode, LightX may be able to avoid blocking with 100% cpu while using this mode with some output engines, such as lxgfxdirectdraw. The reason that synchronisation usually uses 100% CPU is actually a design flaw in the PC architecture - there is no way for the video card to notify a program when vblank occurs, so the program must constantly poll the card.

vbIdle: Use IdleVBlank unit to try to use little CPU time while waiting for vertical blank (experimental). Might not be stable on all systems at this time. Using this mode also forces LightX to synchronise with all calls to lxgfx.flip, so triplebuffering mode effectively becomes useless without some clever trickery in your game (since it will *always* wait for a flip before letting you use the next surface, effectively turning it back into a double buffering scheme).

Class: lxgfx