在Windows 7上由全屏OpenGL窗口打开的模式对话框未显示 [英] Modal dialogs opened by a fullscreen OpenGL window on Windows 7 are not showing

查看:123
本文介绍了在Windows 7上由全屏OpenGL窗口打开的模式对话框未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我的问题可能与未解决的相关问题相同(

It seems that my problem may be the same as an unanswered related question (OpenGL with GLUT on windows 7, fullscreen mode not showing the message box).

由于我将Win7用作开发环境,并且将其作为我的应用程序的可能目标平台,所以我注意到它们的行为有所下降.

Since I switched to Win7 as a development environment, and a possible target platform for my applications, I noticed a regression in their behaviour.

每当我有一个包含全屏OpenGL上下文的全屏窗口时,应用程序都会在显示模式对话框(例如消息框,文件打开对话框等)时遇到问题

Whenever I have a fullscreen window containing a fullscreen OpenGL context, the applications have problems displaying modal dialog boxes (such as message boxes, file open dialog, etc.)

该窗口仅以WS_POPUP样式创建. GL上下文没什么花哨的. Windows XP一切正常.

The window is just created with WS_POPUP style. The GL context is nothing fancy. And everything is fine with Windows XP.

在Windows 7下,问题在于模式对话框在打开时是不可见的(可能出现在全屏窗口的后面).您必须先Alt-Tab应用程序才能显示对话框.

The problem under Windows 7 is that the modal dialog boxes are invisible at their opening (maybe their appear behind the full screen window). You have to Alt-Tab the application to have the dialogs appear.

这是一个主要问题,因为应用程序似乎在等待用户输入的同时被冻结.

This is a major problem as the application appears to be frozen, while it in fact waits for user input.

有人遇到这种行为吗?有人知道解决方法吗?

Did anyone encounter this behaviour ? Does anyone know a workaround ?

我迅速组成了一个示例测试应用程序;可以在 http://pastebin.com/K4v2NNDs 中找到其源代码.可以在此处.

I've quickly made up a sample test application ; its source code can be found at http://pastebin.com/K4v2NNDs. A simple MSVC8 project can be found here.

PS.我还发布在opengl.org论坛上,对于同时关注这两个问题的人,我们深表歉意.

PS. I've also posted on opengl.org forums, sorry for those of you that follow both.

编辑

由于克里斯(Chris)的评论,我已经在各种事件(例如WM_TIMER或WM_RBUTTONUP)上测试了模式对话框,但是问题仍然存在.

Thanks to Chris comment, I've tested the modal dialog on various events, such as WM_TIMER or WM_RBUTTONUP, but the problem is still there.

我也用'DWM_EC_DISABLECOMPOSITION'调用了'DwmEnableComposition'只是为了检查:问题仍然存在.

I've also called 'DwmEnableComposition' with 'DWM_EC_DISABLECOMPOSITION' just to check : problem still there.

我还通过用DirectX替换OpenGL位对应用程序进行了测试,这样,一切都可以按预期进行……这确实是OpenGL引起的问题.

I've also tested the application by replacing the OpenGL bits by DirectX, and this way everything works as expected... It's really OpenGL causing the problem.

(更新后的pastebin http://pastebin.com/Rq1Ehm3w 和我的便签本)

(updated pastebin http://pastebin.com/Rq1Ehm3w and my scratchpad)

编辑

该问题在Windows 8上也存在.

The problem also exists on Windows 8.

推荐答案

一种解决方法是

A workaround has been posted on opengl.org by Joseph Steel, so, for reference I put it here as well :

我为此问题找到的解决方案是确保窗口的像素格式使用WGL_SWAP_COPY_ARB交换方法,而不是WGL_SWAP_EXCHANGE_ARB.

The solution I found for this problem was to ensure that the pixel format for the window uses the WGL_SWAP_COPY_ARB swap method rather than the WGL_SWAP_EXCHANGE_ARB.

我注意到,必须使用'wglChoosePixelFormatARB'来获取像素格式.

I've noted that one must use 'wglChoosePixelFormatARB' to obtain the pixel format.

我尝试使用带有'PFD_SWAP_COPY'标志的经典'ChoosePixelFormat',但是它不能在我的系统上运行(Win7 x64 + NVidia GeFo 9600GT v196.21),因为它总是返回带有'PFD_SWAP_EXCHANGE'的像素格式

I tried with the classic 'ChoosePixelFormat' with the 'PFD_SWAP_COPY' flag, but it does not work on my system (Win7 x64 + NVidia GeFo 9600GT v196.21) as it always returns me a pixel format with 'PFD_SWAP_EXCHANGE' instead.

我对结果只满意一半,因为它使我的显示器有些撕裂,但至少可以起作用!

I'm only half-happy with the results, as it introduces some tearing in my display, but as least it works !

作为参考,我已经更新了

For reference, I've updated my test source code.

EDIT,2013年12月

至少在我的系统(笔记本电脑,Optimus GeForce 650M)上,此解决方法不再起作用. WGL_SWAP_COPY_ARB已设置,但不显示模式对话框.到目前为止,似乎创建具有1个像素边框的窗口(将WS_BORDER添加到WS_POPUP样式)确实可以解决问题,并且可以防止进入全屏"模式.

This workaround does not work anymore, at least on my system (laptop, Optimus GeForce 650M). The WGL_SWAP_COPY_ARB is setup but the modal dialog does not show. So far, it seems that creating the window with a 1 pixel border (adding WS_BORDER to WS_POPUP style) does the trick, and prevents entering 'fullscreen' mode.

这篇关于在Windows 7上由全屏OpenGL窗口打开的模式对话框未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆