XNA 4.0: terrain glitches caused by SpriteBatch
I'm trying to implement terrain collision in XNA so I've added some dynamic text that allows me to test whether calculations are correct. Everything was rendered just fine until I called: spriteBatch.Begin(); spriteBatch.End(); or spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); spriteBatch.End(); With these instructions terrain glitches a little bit, when I remove these two lines from my code everything is back to normal (but it means I cannot draw HUD) Anyone has any clue what can cause that and how should I fix it? screens: with sprite batch on with sprite batch off
it due to spritebatch change the graphicsdevice states... before drawing the terrain you should store the right renderstates... usually the you have to set the right RasterizerState and DepthStencilState. Common values are RasterizarState.CullNone and DepthStencilState.Default
What's the difference between world and view for purpose of camera?
Vertexbuffer Getdata VertexPositionNormalTexture
Converting from 3.1 to 4.0… gamestates
XNA large coordinates and float precision
Trying to make Gaussian Blur stronger/blurrier - XNA 4.0 HLSL
XNA, EmguCV and perfomance issue with webcam
Does XNA apps run on Windows RT?
How to pass a Texture2D object to Pixel Shader in XNA 4.0?
how to connect windows phone 7 application by using 2 different mobile device?
Adding a game service in XNA 4.0 through vb.net
Can the position of pixel be changed from Pixel Shader in XNA 4.0?
Adding GamerServicesComponent causes ridiculously long program start
Platformer tile engine--advice on what to do with long tiles
XNA Vector2 path contained inside rectangle
XNA changing 200 or so tiles pixels
Loading files during run time in XNA 4.0