xboxscene.org forums

Author Topic: The Black Screen Syndrom  (Read 466 times)

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
The Black Screen Syndrom
« on: December 12, 2006, 09:28:00 AM »

When you compile a xna program you can find the .exe binary in bin\x86\Debug

If you are just a player, be warned that if you try to run a program by compiling its source you may be completely stuck with a black screen. Alt+F4 won't stop the program. You will have to try to kill the right task by doing Ctrl+Alt+Suppr then Enter, but with a black screen you may kill the wrong task. Quite a nightmare...

The solution is, even if sources are given to you, to test the .exe binary first (if you don't have it, compile it with F6 but do not use F5 because F5 will compile then run.

If you get stuck with black screen after launching a xna .exe binary then just hit Alt+F4 to kill it.

It seems developers out there only run their program on xbox360 or high res Windows and they just produce black screen if screen resolution is not appropriate under Windows. A lots of progress needs to be made in that domain...

Note that all existing xna games around (except spacewar) crashed or produced black screen.
Just like if things created with beta xna had no chance to work on Windows with final xna (at least in my config)... Developers really need to autodetect things and avoid crashes or black screens...
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
The Black Screen Syndrom
« Reply #1 on: December 14, 2006, 08:52:00 AM »

I've found this post in official xna forums (about black screen in full screen mode)

<< (from Arnd. G.)
Hi,

I had the same problem. But my Iiyama Vision Master reported "Fast Signal".

In DirectX Utility "Caps Viewer" I found below "Display Modes" different Refresh Rates which are not "good" for my monitor (e.g. 800x600 @ 240 Hz).

Fortunatelly with the DirectX Utility "Control Panel" -> Direct Draw you can switch the "Forced Refresh Rate from "Auto" to a value like "75".

Viola, the FullScreenToggle works!

Regards,

Arnd
>>

That means there is an awful issue in xna gse. It lets directdraw choose highest possible refreshrate.
In most case that will be too much for your screen, and so the black screen.

The worst is that they marked the case solved. Which means they gladly think mere players will install also (in joy) directX SDK (as if installing visual c sharp was not bad enough). Well I say so because I assume the utilities refered above are found in that SDK. I will check that now.


That other post looks promising, I will try also.

<< (from Shawn Hargreaves - MSFT)
Answer Re: Why does XNA render at 75 Hz in fullscreen?
  Was this post helpful ?      
 
 
 By "runs at 75 hz" do you mean that the monitor refresh rate is being set to 75, or that we are calling your Draw function at 75?

My guess would be that we're just using the default monitor refresh rate. If you want to change that you can hook the GraphicsDeviceManager.PreparingDeviceSettings event, and modify the args.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz property.
>>

This post has been edited by openxdkman: Dec 14 2006, 04:54 PM
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
The Black Screen Syndrom
« Reply #2 on: December 14, 2006, 09:26:00 AM »

Ahhhh... Finally, that damn black screen syndrome in full screen mode can be fixed manually in code.


For example, in Spacewar starter kit, replace

        void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            // We turn off auto depth buffer creation when scaling output.
            //
            e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;
        }

with

        void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            // We turn off auto depth buffer creation when scaling output.
            //
            e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;
#if XBOX360            
#else
           
            if (e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen)
                e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = 60;
#endif            
        }


I will look for a way to improve this patch (better to detect the current windows desktop resolution refreshrate and keep it for full screen mode)

Damn... Without fullscreen mode there was no way to reach top 3D performance on Windows... How come mere beginners have to handle this issue after MONTHS of beta!?!


This post has been edited by openxdkman: Dec 14 2006, 05:27 PM
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
The Black Screen Syndrom
« Reply #3 on: December 14, 2006, 09:54:00 AM »

With this you can set in fullscreen mode the same refreshrate as the one detected in windowed mode :
(you can still force its value though if you wish)
It's for Spacewar starter kit (file SpacewarGame.cs)

At line 30, add a new variable

private int preferredRefreshRate = 0;
        //0 will mean you want to set this variable when we are in windowed
        //mode and reuse it later when we go back to fullscreen mode



replace

void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
// We turn off auto depth buffer creation when scaling output.
//
e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;
}

with


void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
// We turn off auto depth buffer creation when scaling output.
//
e.GraphicsDeviceInformation.PresentationParameters.EnableAutoDepthStencil = !enableDrawScaling;

#if XBOX360            
#else
            if (e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen)
            {
                if (preferredRefreshRate!=0)
                    e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = preferredRefreshRate;
                else //we never went in windowed mode before, dunno what is refreshrate yet
                    e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = 60;
                }
#endif            
}



finally, replace

                // going fullscreen, use desktop resolution to minimize display mode changes
                // this also has the nice effect of working around some displays that lie about
                // supporting 1280x720
                GraphicsAdapter adapter = graphics.GraphicsDevice.CreationParameters.Adapter;
                graphics.PreferredBackBufferWidth = adapter.CurrentDisplayMode.Width;
                graphics.PreferredBackBufferHeight = adapter.CurrentDisplayMode.Height;

with

                // going fullscreen, use desktop resolution to minimize display mode changes
                // this also has the nice effect of working around some displays that lie about
                // supporting 1280x720
                GraphicsAdapter adapter = graphics.GraphicsDevice.CreationParameters.Adapter;
                graphics.PreferredBackBufferWidth = adapter.CurrentDisplayMode.Width;
                graphics.PreferredBackBufferHeight = adapter.CurrentDisplayMode.Height;
                if (preferredRefreshRate==0) preferredRefreshRate = adapter.CurrentDisplayMode.RefreshRate;


Ok... now we can have fun!

This post has been edited by openxdkman: Dec 14 2006, 05:55 PM
Logged