Page 1 of 1

Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 21.11.2009, 14:16
by Boux
Work-arounds/bug fixes for ATI/Vista
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:
Image

Image

Bottom left/bottom right:
20-pixel thick empty area (figure returned by a call to GetSystemMetrics)
Image

Image


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:
Image

Image

Bottom left/bottom right:
Image

Image

First bug fixed!

2 - Fullscreen mode
Right-click context menu invisible but shape of pointer changes to acknowledge the event:
Image

After changing the window style in winmain.ccp:
Image

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

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 26.11.2009, 22:02
by chris
Boux,

Thank you for making these changes. I'm on the road with just my MacBook, but will try out your changes on my Windows system when I get back in a few days. I expect that they should work just fine with NVIDIA cards, too.

--Chris

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 26.11.2009, 22:56
by Granyte
thanks for the try it fixed the problems but created a new and i think worst one

cause it fixes both problem but when i try to exit full screen celestia just crash brighing the display driver with him
how ever the crash issue with your code might be proper to window 7x64 driver


the problem seem to be in the driver it self since catalyst 9.7 didn't had any problem with the windowed mode or full screen mode and since then it just kept degradating and has of now with catalyst 9.11 i'm having issue with my opengl 2.0 render path

for the information i use 2x 4850 mobility in cfx setup

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 26.11.2009, 23:10
by Reiko
I had that same problem with ATI and fixed it by setting the windows theme to windows classic.

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 26.11.2009, 23:19
by Granyte
setting my theme to classic caused my laptop to lagg and spin th fan like crazy (like a tornado) for like 5 min when it stop it comes back to normal the result made me draw the conclusion that setting it to classic caused some wierd overheating problem

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 27.11.2009, 10:19
by Boux
Granyte wrote:thanks for the try it fixed the problems but created a new and i think worst one

cause it fixes both problem but when i try to exit full screen celestia just crash brighing the display driver with him
how ever the crash issue with your code might be proper to window 7x64 driver


the problem seem to be in the driver it self since catalyst 9.7 didn't had any problem with the windowed mode or full screen mode and since then it just kept degradating and has of now with catalyst 9.11 i'm having issue with my opengl 2.0 render path

for the information i use 2x 4850 mobility in cfx setup

Well, I am running Vista64 here with 2x4870 in crossfire and I have not this crash issue with latest catalyst. It just work.
I do not see how the changes I made would do any harm.

Regarding your specific issue, you may want to try another opengl driver dropped right into your Celestia root folder. Celestia only will use this one instead of the version installed in the system.
I have had some success with the FireGl opengl driver (atioglxx.dll) extracted from the driver package (version 6.14.10.8794).
I you cannot find it, just tell me, I will upload it to my ftp.
There are complaints all over the net about problems with opengl ATI drivers.
They are great for direct3d though.

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 27.11.2009, 10:32
by Boux
Reiko wrote:I had that same problem with ATI and fixed it by setting the windows theme to windows classic.

Tried this too, and also disabling desktop composition, even with some more C++ code checking graphic card vendor ID at runtime.
They are ugly - litterally :) - workarounds which do not solve both issues at the same time.
I want Celestia to behave as it should, with aero and glass enabled as they are supposed to be.
And ... I just can't stand the old interface from windows 95 jurassic times :lol:

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 27.11.2009, 16:47
by Granyte
i agree it need to work all together if not it kill the point of having those OS and hardware acceleration is not has good with aero disabeled than it's with it enabeled


i agree it's wierd that your changes cause the display driver to crash especialy in window 7 who is the windows os who is the hardest to make driver crash but you changes does so i have no clue why while the normal celestia work with out crashing

actualy opengl on ati is not the best i agree however they are workin on it and in 9.10 it improved celestia was runing smoother and i had only the displacement and full screen issue but at the time i was runing win vista x64

i recently switched over to win 7 x64 and at the sametime performed a clean instal and installed catalyst 9.11 and i'm now having a subtle issue with opengl 2.0 that i can only notice when looking at the black hole addons

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 27.11.2009, 23:16
by Reiko
Granyte wrote:setting my theme to classic caused my laptop to lagg and spin th fan like crazy (like a tornado) for like 5 min when it stop it comes back to normal the result made me draw the conclusion that setting it to classic caused some wierd overheating problem
That's odd that classic, a less stressful theme to your system, would cause an overheat problem. :?

Boux wrote:
Reiko wrote:I had that same problem with ATI and fixed it by setting the windows theme to windows classic.

Tried this too, and also disabling desktop composition, even with some more C++ code checking graphic card vendor ID at runtime.
They are ugly - litterally :) - workarounds which do not solve both issues at the same time.
I want Celestia to behave as it should, with aero and glass enabled as they are supposed to be.
And ... I just can't stand the old interface from windows 95 jurassic times :lol:
I understand how you feel. I like the vista themes better too and went back to them once I bought an Nvidia card. :blue:

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 28.11.2009, 00:00
by Granyte
i have a theorie on what cause overheating ... when you disable the theme all the renders on screen pass through the cpu instead of the gpu
and the cpu just hate rendering things (drag a window in classic theme the lagg will tell y how much it likes it)
i just recalled i had a ridiculously high nb of windows opened at the time so forcing my cpu to render all that caused the issue
i also tryed this time with less things opened and it worked no trouble but still the win 95 look ....

also putting window theme to classic don't fix the issue about full screen not displaying the menu

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 28.11.2009, 10:36
by Boux
Granyte,
Please try this new build:
http://www.quickfixcomm.fr/Celestia/celestiaSVN4912.zip
I may have left inadvertantly some aggressive optimisations in the previous one.
I am also thinking as a possibility that the changed code - which is plain standard Windows API stuff - may simply have exposed some other issue on your system.

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 29.11.2009, 06:31
by Granyte
this tim jjust switching to dull screen cause the software to crash and again brigning the display driver with it

it might be a window 7 issue also ..

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 04.12.2009, 12:49
by duds26
Thanks for the bug fixes, this should really be added to a Celestia 1.6.1 version.
Problem 1 annoys me a lot, makes stuff unreadable which stops a lot.
Please bring a bugfix release for Celestia with these fixes.

Windows 7 is fairly new, and x64 is not so well tested as x86 is.

I had that same problem with ATI and fixed it by setting the windows theme to windows classic.
This is not a solution, but just a workaround.

Tried the executable and...
The fixes work!
Fantastic.

Win Vista 32bit, ATI X1600
Drivers: ATI Catalyst 9.3

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 05.12.2009, 10:11
by Boux
duds26 wrote:...
Tried the executable and...
The fixes work!
Fantastic.

Win Vista 32bit, ATI X1600
Drivers: ATI Catalyst 9.3

Glad to know that it worked for you.
Always been puzzled why nobody ever cared.
ATI is a major provider of GPUs for laptops and the latest generation of their desktop graphics cards are currently the most powerful.
I am guessing Celestia has lost most of this large potential user base.
For your convenience, here is the latest SVN build:
http://www.quickfixcomm.fr/Celestia/celestiaSVN4920.zip

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 06.12.2009, 21:23
by chris
Boux,

These changes work fine on my Windows system with an NVIDIA card. I've committed your fixes to both the trunk and 1.6.1 branches. Thanks again for debugging this problem and providing patches!

--Chris

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 08.12.2009, 05:19
by Granyte
lastes build

first try
work flawlessly in windowed mode like all befor it

but when switching to full screen make it crash after switching (not brigning the display driver this time)


second try
randrom crash 2 second after start up (just had time to see earth)


third try

work flawlessly in windowed

fullscrren make it crash (brigning the display driver with it)

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 08.12.2009, 09:13
by Boux
Well , this is exposing a problem that is likely specific to ATI's Win7 drivers.
They may be not mature enough yet.
I suggest you try one or all of the following:
- deactivating all options in the Catalyst control center i.e. leaving everything strictly as application-controlled
- deactivating Crossfire (which is useless with Celestia btw)
- uninstall the Win7 drivers and do some testing with the latest Vista64 drivers which may be more stable
- build Celestia on your system just to be sure there is not some Win7 dll or lib weirdness happening
- maybe begin with dropping the attached dll right in your Celestia root folder.
http://www.quickfixcomm.fr/Celestia/atioglxxFirePro.zip

Re: Celestia loves my ATI graphics cards. Bugs nailed!

Posted: 08.12.2009, 15:48
by Granyte
thx disabeling crossfire made your build work flawlesly switching betwen full screen and windowed

the firegl dll fixed the opengl 2.0 render error