Modal dialogs opened by a fullscreen OpenGL window on Windows 7 are not showing

荒凉一梦 提交于 2019-12-01 14:23:43

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

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.

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

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, dec.2013

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.

Solution on my system was pretty simple: - DO NOT specify WS_POPUP style at the window creation time. - Just after you obtain hwnd, re-set your windows styles to what you want (but no WS_POPUP again) using SetWindowLong(hwnd,GWL_STYLE, yr_styles);

I had the same problem with OpenGL under Win7 64 bit. Modal dialog boxes and modal windows are not shown, also they are active in the background. My project used stereo display (quad buffers). In my case, the problem was due to an incorrect setting in the control panel of the display adapter (Nvidia Quadro FX3800). The setting was "Stereo Enabled", which was incorrectly on "off". Switching it on solved the problem.

when i want, for example, open a filedialog in OpenGL fullscreen (Windows10 or every Windows before), i call

RedrawWindow(hwnd, 0, 0, RDW_INTERNALPAINT);

( this causes a WM_PAINT message to be posted to the window regardless of whether any portion of the window is invalid )

and just after this i call the filedialog. The filedialog will be shown now in OpenGL fullscreen.

In WndProc inside the case WM_PAINT: i do a SwapBuffers(hdc)

RedrawWindow(hwnd, 0, 0, RDW_INTERNALPAINT);
// important when fullscreen; forces a WM_PAINT message,
GLwin->Fileselect(s_fname); // or whatever dialog

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lparam)
{
  switch(message)
  {
    case WM_PAINT:
    SwapBuffers(hdc);  // (same as in the render-loop)
    break;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!