DXUTSetConstantFrameTime

Enables or disables a constant frame time.

HRESULT DXUTSetConstantFrameTime(
  BOOL bEnabled,
  FLOAT fTimePerFrame
);

Parameters

bEnabled
[in] If TRUE, a constant frame time will be enabled.
fTimePerFrame
[in] Time per frame, in seconds. The default value is 0.0333f, so the fTime parameter of LPDXUTCALLBACKFRAMEMOVE and LPDXUTCALLBACKFRAMERENDER will advance one second for every 30 frames.

Return Values

If the function succeeds, the return value is S_OK. If the function fails, the return value can be one of the error codes in DXUTERR.

Remarks

This function simulates a fixed-frame rate render loop by sending a constant value for elapsed time to the LPDXUTCALLBACKFRAMEMOVE and LPDXUTCALLBACKFRAMERENDER callback functions. The default rate is one second for every 30 frames. The application itself will continue to render at an unregulated rate (which may be far higher than the specified frame rate).

This function is useful for saving the rendered output to a video format for playback, allowing animation at a rate independent of the actual rate at which frames were rendered.

Requirements

Header: Declared in Dxut.h.

See Also

LPDXUTCALLBACKFRAMEMOVE, LPDXUTCALLBACKFRAMERENDER