Sign in to follow this  
Zeke

Redraw entire screen in full screen mode

Recommended Posts

Zeke    122
I have found a difference in full screen and windowed mode in the game im doing (2d game in Directx 9). I have a game board with a marker moving around it to show what square the player is on. At the moment the only thing that moves in the entire screen is this marker. So rather than draw the entire board and then the marker on top, I keep track of where the marker used to be and just draw that part of the board, then draw the marker in the new position (so that the marker int he old position has been "drawn over" when it moves). For this reason I dont clear the screen (g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );, each frame as I dont want to draw the entire board each time and if I cleared the screen each frame i would have to). This works fine in windowed mode, but in full screen mode something is filling the screen with black in between my draws i.e. in windowed mode: 1) Clear the screen 2) Draw the entire board 3) Draw the marker loop { 4) Draw the bit of the board where the marker is 5) Draw the marker in the new position } In full screen mode: 1) Clear the screen 2) Draw the entire board 3) Draw the marker loop { 4) Screen is filled with black (not a g_pd3dDevice->Clear, the colour I use is blue) 5) The segment of board is drawn along with the marker, rest of the screen is blue (my clear screen colour) 6) Entire board is drawn with the marker at the correct position } I dont understand where steps 4,5 and 6 have come from. Is there something in full screen that means you have to redraw the entire screen? Anyone have any ideas why this is happening or why its only happening in full screen mode and not windowed? Cheers.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Zeke
I dont understand where steps 4,5 and 6 have come from. Is there something in full screen that means you have to redraw the entire screen?

Anyone have any ideas why this is happening or why its only happening in full screen mode and not windowed?
Because you're not using the debug runtimes [smile]
If your swap effect is set to D3DSWAPEFFECT_DISCARD, then you're telling the driver it can throw away the contents of the backbuffer each frame, and you'll redraw the whole thing. That's much more efficient than forcing the driver to keep the old data around.
In windowed mode, the driver will probably just copy the data it needs or something, but in fullscreen, it'll be creating a full swap chain and swapping buffers, which ahnialates anything that was on the screen before.
The debug runtimes will fill with backbuffer with magenta and then green on alternate frames to highlight these problems.

So - What's your swap effect, and are you using the debug runtimes?

Share this post


Link to post
Share on other sites
Zeke    122
Ahhhh thanks Evil Steve, I am indeed using D3DSWAPEFFECT_DISCARD. So which is more efficient, to use D3DSWAPEFFECT_DISCARD and redraw the entire screen every time or to use a different swap effect and only draw the bits that have changed?

And as you suspected I wasnt using the debug runtimes, but I am now :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this