Page 1 of 1

Problem with Camera Visualization

Posted: Sat Aug 08, 2009 1:52 pm
by AlexanderPD
hi, i downloaded the BasicSetupDemo and it works (naturally! ;) ), but when i add the Framerate class i got some visualization errors:

Image

the "older" cube was always behind the "new" cubes :\
if i remove the framerate inizialitation string from Initialize() method it works correctly, but i need the framerate visualization (and other visualization too!)

i found another topic about this problem: http://www.bepu-games.com/forums/viewto ... nent#p4450
but i can't understand how he fixed it, SpriteBatch don't have an DepthBufferEnable parameter :\

how i can fix it? Thank you! ;)

Re: Problem with Camera Visualization

Posted: Sat Aug 08, 2009 2:24 pm
by Norbo
The RenderStates of the GraphicsDevice are changed by the SpriteBatch every time it starts to draw something. Unless they are set back to what they were before, other drawing will be wonky. A full reference of the things changed by the SpriteBatch and how you can deal with it can be found on Shawn Hargreaves' blog:
http://blogs.msdn.com/shawnhar/archive/ ... tates.aspx

Re: Problem with Camera Visualization

Posted: Sat Aug 08, 2009 3:06 pm
by AlexanderPD
Thank you! Now it works correctly! ;)

i just added:

Code: Select all

GraphicsDevice.RenderState.DepthBufferEnable = true;
before the base.Draw(gameTime); in my Framerate class! ^__^

Thank you a lot again ^__^