Problem with Camera Visualization

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
AlexanderPD
Posts: 2
Joined: Sat Aug 08, 2009 1:38 pm

Problem with Camera Visualization

Post 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! ;)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Problem with Camera Visualization

Post 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
AlexanderPD
Posts: 2
Joined: Sat Aug 08, 2009 1:38 pm

Re: Problem with Camera Visualization

Post 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 ^__^
Post Reply