Hi all!
Celestia does not seem to like some configurations with ATI graphics cards.
Under Vista, for many users - laptops notably - , this translates into:
Windowed mode:
- top of opengl viewport is hidden by the menubar
- viewport is shifted up by the height of the menubar and bottom of viewport does not render anything
Fullscreen mode:
- right-clicking selection does not make context menu to pop-up to the foreground
Some pictures to illustrate what is happening
1 - Windowed mode
Top of viewport hidden behind menubar:
Top left/top right:
Bottom left/bottom right:
20-pixel thick empty area (figure returned by a call to GetSystemMetrics)
After changing some code in winmain.ccp to make sure menubar is thrown in at the right time so that the opengl viewport is created at the right place:
Top left/top right:
Bottom left/bottom right:
First bug fixed!
2 - Fullscreen mode
Right-click context menu invisible but shape of pointer changes to acknowledge the event:
After changing the window style in winmain.ccp:
Second bug nailed!
Here is the code block where the changes have been made (with relevant comments where needed):
Code: Select all
// Line 1971 of winmain.ccp Determine the proper window style to use
DWORD dwStyle;
if (newMode != 0)
{
dwStyle = WS_POPUPWINDOW | WS_MAXIMIZE;
// original style is: dwStyle = WS_POPUP;
// work-around for right-click context menu
// not popping up in fullscreen mode with ATI card in Vista
}
else
{
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
}
// Create the window
HWND hwnd = CreateWindow(AppName,
AppName,
dwStyle,
x, y,
width, height,
NULL,
NULL,
appInstance,
NULL);
if (hwnd == NULL)
return NULL;
ShowWindow(hwnd, SW_SHOW);
SetForegroundWindow(hwnd);
SetFocus(hwnd);
deviceContext = GetDC(hwnd);
if (!SetDCPixelFormat(deviceContext))
{
MessageBox(NULL,
"Could not get appropriate pixel format for OpenGL rendering.", "Fatal Error",
MB_OK | MB_ICONERROR);
return NULL;
}
// beginning of moved code block
// to make sure the menubar is created right now
{
if (newMode == 0)
SetMenu(hwnd, menuBar);
else
hideMenuBar = true;
}
// end of moved code block
bool firstContext = false;
if (glContext == NULL)
{
glContext = wglCreateContext(deviceContext);
firstContext = true;
}
wglMakeCurrent(deviceContext, glContext);
if (firstContext)
{
GLenum glewErr = glewInit();
if (glewErr != GLEW_OK)
{
MessageBox(NULL, "Could not set up OpenGL extensions.", "Fatal Error",
MB_OK | MB_ICONERROR);
return NULL;
}
}
/* 4 lines below moved to lines 2012-2015 above
if (newMode == 0)
SetMenu(hwnd, menuBar);
else
hideMenuBar = true;//*/
return hwnd;
}
It would be nice to have some building and testing done by you guys, both on ATI and Nvidia hardware.
The code bit is available here:
http://www.quickfixcomm.fr/Celestia/winmainccp-modification.cpp
Edit:
For your convenience, a latest SVN build can be grabbed here:
http://www.quickfixcomm.fr/Celestia/celestiaSVN4912.zip