xna-4.0


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

Related Links

XNA 4.0 InvalidOperationException was unhandeled
Pass variables to another class?
Xna Game referencing Game in update
XNA game studio simple sprite animation
XNA phase management
How to check BoundingSphere for one ModelBone?
MonoGame: Some VertexColorPosition dissappear while drawing user primitives(DrawUserPrimitives)
Testing XNA 4.0 games On the XBOX 360 without paying $100 [duplicate]
Detecting clicks in a non-rectangular shape
What's a good way to optimise rendering a 2D tile game in XNA?
How to make 3D racing game with XNA? [closed]
How to correctly accelerate a rotated 3d model in XNA?
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

Categories

HOME
twitter
drivers
cplex
octobercms
leon
amazon-ecs
rubygems
webpack-2
disassembler
baqend
ezpublish
opengl-es-2.0
datastax-java-driver
android-youtube-api
nano-server
offline
task
orchardcms
decimal
netflix
text-rendering
lldb
visjs
autoconf
tibco-mdm
trading
p-value
internet-explorer-9
entitlements
minitab
xacml
log4js-node
libssl
preg-match-all
.net-4.0
caret
normal-distribution
mpmediaquery
simplexml
streamsets
streamreader
cookiecutter-django
avro4s
node-gyp
ibpy
midl
total-commander
termination
dropbox-php
return-value
lowpass-filter
nstextview
slickedit
sybase-asa
python-cryptography
lync-client-sdk
vtigercrm
crosswalk-runtime
quartz-composer
gnome-shell-extensions
background-service
ableton-live
nxt
pcf
skobbler-maps
firebaseui
python-stackless
bluegiga
ios8-today-widget
mutation-observers
iis-arr
varargs
operation
key-management
fscommand
dia
xc16
file-copying
id3v2
document-classification
google-reader
wp-query
comexception
marmalade
poller
picturefill
back-stack
pushbackinputstream
distutils
angularjs-controller
automount
newtonscript
bubble-chart
netbeans-6.9
spring-portlet-mvc
nsobject
table-footer
castle-monorail
zend-decorators
multiple-languages
ajax-forms

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App