多个 Direct3D 9 设备和 Alt-Tab 键
我有一个应用程序,它在全屏模式下创建 Direct3D 9 设备,然后开始演示。稍后,在创建第一个设备后,我临时在窗口模式下创建一个新的 Direct3D 设备(在同一线程上,但针对不同的窗口)。我立即再次销毁该设备,但不知何故,我无法再使用 Alt-tab 退出全屏应用程序。尽管应用程序看起来不再处于焦点状态,但该应用程序只是停留在顶部而不是下降到后台。
如果我将临时设备创建为 D3DDEVTYPE_NULLREF,我突然可以按 Alt-tab 键退出。有人知道为什么会这样吗?如果是的话,我如何在不弄乱现有设备的情况下创建第二个临时设备?
I have an application that creates a Direct3D 9 device in fullscreen mode and then starts presenting. At a later point, after having created the first device, I temporarily create a new Direct3D device in windowed mode (on the same thread but for a different window). I destroy this device immediately again, but somehow I'm then no longer able to Alt-tab out of the fullscreen application anymore. The application just stays on top rather than dropping to the background although it looks like the application is no longer in focus.
If I create my temporary device as D3DDEVTYPE_NULLREF, I'm suddenly able to Alt-tab out. Does anybody have an idea why that is, and if so, how I can create a second temporary device without messing up the existing device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您创建 D3D 设备时,您指定将其绑定到哪个窗口(
CreateDevice
调用的第三个参数)。我可能会建议,破坏第二个设备会以第一个设备看不到的方式夺走焦点。尝试显式地将焦点返回到主窗口:顺便说一句,如果这是并行渲染的方式,请考虑使用渲染目标或交换链。 DX9 文档表示,设备之间的切换会对性能造成重大损失。
When you create a D3D device you specify which window do bind it to (third parameter of
CreateDevice
call). I may suggest that destroying of second device takes out focus in a way which is unseen by the first device. Try explicitly returning the focus back to main window:Btw, if this is how you make parallel rendering consider using render targets or swap chains instead. DX9 docs say that switching between devices puts a significant penalty to performance.
创建第二个设备后尝试重置第一个设备。 MSDN 提到这是初始化多个设备的正确方法。但是我找不到有关它的文章:(
尽管我从来没有需要制作全屏和窗口设备。我只尝试过两个全屏设备。
Try resetting the first device after you create your second device. MSDN mentioned this is the proper way to initialize multiple devices. I can't find the article about it however :(
Although I've never needed to make a full screen and windowed device. I've only ever tried with two full-screen devices.