Jump to content
  • Advertisement
Sign in to follow this  
-XM-

Full Screen Error

This topic is 2956 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, been working on a 3D space shooter. My game is running at 1280 x 720. While programming and debugging I keep the game in a windowed state and everything works fine. However, when I turn the game full screen and pause the game all of the ships that are in the process of moving start to glitch back and forth like they are stuck. I am pausing the game by not clearing anything off the screen, just drawing a pause menu on top of the gameplay. This way the game is still visible, making it a little more stylish.

Do you guys have any idea what the problem is? Is there a certain call I should make before pausing the game?

Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
I noticed that you said "drawing a pause menu on top of the gameplay". How did you draw the menu? using some APIs? or using a dialog box, or a child window?
Did you use GDI?

Share this post


Link to post
Share on other sites
Fullscreen is dangerous but maximizing without border looks exactly the same with less than 1% loss in performance. It is also better not to have real fullscreen because the user might get an instant message in the background. In "Titan quest" you have to shut down the game and loose progress just to answer the message.

http://www.codeguru.com/forum/showthread.php?p=1958575

Share this post


Link to post
Share on other sites
Can you explain it a bit more, please?
You stop all the rendering, stop calling Clear and Preset, just keep the last backbuffer displayed? If, then how are you rendering the pause menu?
What actually do you mean by "not clearing anything"?

Share this post


Link to post
Share on other sites
GraphicsDevice.Clear(Color.Black); is never called when all of this is going on. That way the player can still see the game in the background. Both my Update and Draw are set up in a structure like this:

if (gameMode == "mainMenu")
{
}

if (gameMode == "gameMode")
{
}

if (gameMode == "pauseMenu")
{
}

etc.

When pauseMenu is called the screen is never cleared and I draw a 2D graphic on top of the screen, if the graphic was to move at all then it would look like a mess, but it doesn't move at all so it looks fine. This is really all I am doing, I haven't messed with the backbuffers or anything like that.

I guess I could fix all of this by continuing to draw the gameworld, but not updating anything. But I would still like to know why the models glitch like this.

If anything needs further explaining please ask :)

Thanks

Share this post


Link to post
Share on other sites
Oops, I forgot to mention this is all in XNA. I'm thinking WM_ERASEBKGND is something related to C++?

Share this post


Link to post
Share on other sites
Quote:
...glitch back and forth like they are stuck...
And you say you still draw 2D stuff in pause mode, but don't clear. So you call present (*) then. I guess what you experience is the flipping of most recently two rendered frames (apart from the 2D stuff): Without clearing and drawing, the present (*) flips the front and backbuffer repeatedly.

Two approaches:

- Render your game as usual without an update of your game world, as you yourself suggested.
- Render your game to a render target (once) and use that during pause (full screen quad).

Hope that helps

unbird

(*) Edit: Ah, yeah XNA, probably you don't explicitly call GraphicsDevice.Present(). How does your game loop look like ? Overriden Game.Draw() without this call I guess. AFAIR the Present call is done by this framework, so you will always get the Present, which then flips the buffers.

Share this post


Link to post
Share on other sites
As unbird says, the contents of the back-buffer isn't normally saved after a frame. If you want you could change this with a different SwapEffect. SwapEffect Enumeration.
However, it's usually best to keep this at discarding the back-buffer on swap, for performance reasons, so I would also go with redrawing the game without updating.

Share this post


Link to post
Share on other sites
I would also personaly continue rendering everything normally, just keeping the same positions of everything.
If you keep rendering, you are able to do some animation on your pause menu etc.

And if the application is graphically "heavy" and you would like to ease the GC during pause, do what unbird mentioned as the second option - render the "last" frame of the game to a texture and then just display this texture on a fullscreen quad which will be almost no strain for the GC. And, as a bonus, you will be able to make some nice effects easily, for example bluring the picture under the pause menu, making it black&white, making it less contrast etc. ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!