在directx中如何设置垂直同步

来源:互联网 发布:哈萨克软件大全 编辑:程序博客网 时间:2024/04/29 05:18

在使用CreateDevice创建设备时,设置参数D3DPRESENT_PARAMETERS中的PresentationInterval为D3DPRESENT_INTERVAL_ONE或者D3DPRESENT_INTERVAL_DEFAULT,表示在绘图是使用Present操作时,会等待在垂直重扫完毕以后,进行front buffer的切换(若检测到垂直同步完毕,则马上flip调换frontbuffer和backbuffer)。这样,画面的帧率就不会超过显示器(显卡)的刷新率,一般为60HZ。

SDK文档原话:The driver will wait for the vertical retrace period (the runtime will "beam follow" to prevent tearing).Present operations will not be affected more frequently than the screen refresh; the runtime will complete at most one Present operation per adapter refresh period. This is equivalent to using D3DSWAPEFFECT_COPYVSYNC in DirectX 8.1. This option is always available for both windowed and full-screen swap chains.