My most common problem
I get this problem a lot. Previously i’ve fixed it by makign sure all my sprite batches Save state, eg:
_spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate & SpriteSortMode.Texture, SaveStateMode.SaveState);
This time I cannot source the problem. I’ve removed every spritebatch to be certain it’s just the model and my scenegraph, and yet the problem persists. I am using the SpaceWar Scaling system, but I turned that off as part of this test.
If you dont immediately see the problem, you normally only see the top half of that light-blue cockpit dome, and certainly not into the “intake” on the nose cone. This is the same model from Spacewar.
WHAT WAS IT!?
RenderState.DepthBufferWriteEnable = false.
Yep. That’s from something I copied over from Spacewar.
I still don’t properly understand save states yet mind you. That call was occuring after a Batch.Begin with savestate so I didnt expect to see that state later on.
Anyway, if you have trouble with things like this go take a look at Sean Hargraeves post on SpriteBatch and RenderStates and then dig around in your app for any RenderStates you’ve explicitly set and forgot to revert.
Thanks to Pon in #xna for the links and the patience.
SpriteBatch.Draw issues
I wrote a little component to scroll tiles for my little side-scroller. It seemed to be working quite nicely. After that, I started on a scene graph, and the design of my scene graph did not accomodate the scroller being a “component” – more on that at some point. Upshot is, small amount of refactoring of my scroller code. Got it running in my new scene graph and what do I end up with? Take a look:
I upped the contrast on the right to make it clear that not only do my tiles have fading edges, but are tinged red? I dont know where the issue is. I tried using Rectangles for my source and destination to ensure that i was using integers. That did not help. Next step i gues is to make my target just a bit larger than desired.
I just wonder why it suddenly appeared and if it isn’t a device render setting?
Thanks to Kukyona who pointed out the two obvious issues.
- That bit of red came from a red line in the texture that i had forgotten i drew.
- At some point my texture got exported from Flash (which i use for pixel editing), at 600px high. He suggested 640 and everything is fine now.
The lesson: Texture file dimensions at multiples of 32.
Welcome
Hi There!
I’m a complete XNA n00b. Won’t stop me though. I love the idea of porting some of the classics from my heydey to the 360. Especially scrollers like Delta, R-Type, Wonderboy. You know, 64 classics. I may be a freak, but i still play 64 games using CCS64. If I could play those games on the XBox. Well that would rock. Of course im not talking direct ports, just similarily ‘old school’ games with a nice next gen console look and feel
Leave a Comment
Leave a Comment
Leave a Comment