我使用Direct3D 9渲染到System.Windows.Forms.Control
。
我的渲染循环不会超过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);