我正在System.Windows.Forms.Control
使用 Direct3D 9 渲染。
我的渲染循环没有超过 120 FPS,这是我屏幕的刷新率。我尝试更改刷新率,它确实相应地限制了渲染循环。另外,我发现这IDirect3DDevice9::Present(/*...*/)
是限制渲染速度的原因。我能做些什么来消除这个限制?
D3D 初始化:
// ctrl : System::Windows::Forms::Control
int render_w = ctrl->Width;
int render_h = ctrl->Height;
HWND ctrl_hnd = (HWND)ctrl->Handle.ToPointer();
// d3dpp : D3DPRESENT_PARAMETERS
d3dpp.hDeviceWindow = ctrl_hnd;
d3dpp.Windowed = TRUE;
d3dpp.BackBufferWidth = render_w;
d3dpp.BackBufferHeight = render_h;
// and further settings...
// d3d : LPDIRECT3D9
// d3ddev : LPDIRECT3DDEVICE9
d3d->CreateDevice(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
ctrl_hnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp,
&d3ddev);