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

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

Categories

HOME
compiler-construction
debugging
push-notification
homebrew
react-virtualized
stock
yahoo-oauth
spring-cloud-stream
amazon-ecs
packages
c#-2.0
fsm
icloud
ojdbc
datastax-java-driver
in-app-purchase
add
fancybox-3
spring-kafka
offline
vb.net-2010
hex-editors
decimal
after-effects
progressive-web-apps
windows-7-x64
footer
jqwidget
google-cloud-speech
karma-jasmine
shopware
maxmind
assistant
saas
c++-amp
tinymce-4
bcd
pim
avcapturesession
windows-dev-center
atl
force-layout
libvpx
twitch
awt
avro4s
nxlog
thin
menuitem
rainbowtable
errordocument
jquery-validate
hls.js
knpmenubundle
gcsfuse
spring-mongodb
crosswalk-runtime
nested-sets
color-picker
google-feed-api
instant
etsy
prettytensor
apachebench
ipconfig
asp.net5
itextpdf
system.management
natvis
t4mvc
marching-cubes
qdialog
fouc
microbenchmark
bridge.net
javax.mail
python-green
modalpopup
document-classification
ceil
wp-query
valueconverter
oracle-warehouse-builder
inbox
ril
file-locking
eventual-consistency
django-nonrel
html-editor
enterprisedb
free-variable
trusted
funscript
gdata-api
venn-diagram
qtkit
nsmanagedobject
assembly-loading
cufon
gnustep
javax.script
self-extracting
yslow
dentrix
suppress
nsviewanimation
user-friendly
yagni
sector
3gp
caching-application-block

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App