在 Direct3D 9 中进入窗口模式
我正在制作一个 Direct3D 应用程序,我可以使用带有新演示参数的 IDirect3DDevice9::Reset
轻松从窗口模式转到全屏模式。但是,当我使用相同的技巧从全屏模式转到窗口模式时,窗口现在失去了边框。
如果我尝试执行 SetWindowLong
将窗口样式设置为 WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
(然后使用 SWP_FRAMECHANGED
SetWindowPos
),窗口现在获得其边框,但 direct3d 设备不再工作。再次重置设备不起作用,而不是 Reset(),
执行 Release()
然后 SetWindowLong()
然后 CreateDevice ()
再次,当然会失败,因为我的托管资源依赖于我的设备。
在创建带边框的窗口时,如何使 IDirect3DDevice9::Reset
返回窗口模式?
I'm making a Direct3D app, and I can easily go from Windowed to Fullscreen mode using IDirect3DDevice9::Reset
with new presentation parameters. However, when I use the same trick to go from fullscreen to windowed mode, the window has now lost its borders.
If I try doing SetWindowLong
to set the window style to WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
(and then SetWindowPos
with SWP_FRAMECHANGED
), the window now gets its border, but the direct3d device no longer works. Resetting the device again doesn't work, and instead of Reset(),
doing Release()
then SetWindowLong()
then CreateDevice()
again, of course fails, as my managed resources are dependent on my device.
How do I make IDirect3DDevice9::Reset
to go back to windowed mode, while creating a bordered window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要更改窗口的属性:
接下来,您必须释放您在默认池 -
D3DPOOL_DEFAULT
中创建的所有资源(如果可能,最好使用D3DPOOL_MANAGED
)。如果不这样做,IDirect3DDevice9::Reset
将失败。然后您可以重置设备,最后根据需要重新创建任何资源。确保您正确设置
IDirect3DDevice9::Reset
的D3DPRESENT_PARAMETERS
。First, you need to change the properties of the window:
Next you have to release any resources you created in default pool -
D3DPOOL_DEFAULT
(it's better to useD3DPOOL_MANAGED
if possible). If you don't,IDirect3DDevice9::Reset
will fail.Then you can reset the device and finally recreate any resources if needed. Make sure you set up
D3DPRESENT_PARAMETERS
forIDirect3DDevice9::Reset
correctly.