2
votes
1answer
66 views

Cancel a SpriteBatch I've started drawing

Background: I'm working on a control library for XNA to use in a couple game clients I've written. The way I've implemented Dialogs is to have them derive from the base XNAControl class. XNAControl ...
2
votes
1answer
98 views

SpriteBatch, trying to reduce draw calls

This my main draw call: Matrix Camera_transformation = player_camera_.GetTransformation(); // Background - AlphaBlend spritebatch.Begin(SpriteSortMode.Deferred, ...
0
votes
1answer
98 views

How do I right-align text?

I'm using SpriteBatch.DrawString, which seems to not have an overload for text alignment. How can I draw aligned text?
0
votes
0answers
77 views

Sorting 3D particles by depth

This is a general particles question, but I use XNA/MonoGame so I looked at: http://xbox.create.msdn.com/en-US/education/catalog/sample/particle_3d for Particles 3D. I found the example not to ...
0
votes
1answer
61 views

Issue with calling Spritebatch in XNA 4.0 Game [closed]

So, I am creating a game in XNA 4.0, using the program Microsoft Visual C# Studio Express 2010. The issue I am having: I have the entire game done, and there is no reason why it should not be ...
-1
votes
1answer
50 views

XNA spritebatch drawing order

Im new in this and im making XNA game. I have problem with spritebatch drawing order. To be explained : i click button to open inventory and i need all drawing to be behind my inventory layout. But ...
3
votes
1answer
312 views

Spritebatch Vertex shader world matrix change after each draw

I have a spritebatch where I draw some textures transformed in 3d space. The easy way was just Begin with the transformation matrix, draw, and end it right after. But that is silly, so I'm trying ...
0
votes
0answers
57 views

Simultanious RenderTarget use in XNA

I am currently grappling with the idea of lighting a 2D scene as a 3D one and i need to clear up a couple of things. I have so far figured out that i am going to use a differed lighting system where ...
3
votes
1answer
217 views

Is multipass rendering possible with SpriteBatch?

I'm trying to implement a bloom effect. This requires three shader passes: a brightness threshold, a horizontal blur, and a vertical blur. It also requires resizes, but these are irrelevant to the ...
1
vote
1answer
145 views

Spritebatch not working in winforms

I'm using the Winforms sample on the app hub and everything is working fine except my spritebatch won't draw anything unless I call Invalidate in the Draw method. I have this in my initialize method: ...
0
votes
2answers
154 views

XNA Texture2D positioning problem

I'm currently stuck on something that just seems extremely odd. I'm creating a game with kinect, and when the player performs an action I want to place a texture onto the screen where their hand is. ...
2
votes
1answer
103 views

SpriteBatch.Draw with scale or rotation trigger a new batch?

I recently read that any transformation changes will cause a new batch to be triggered. So, if I have 10 Sprites and each has a different rotation or scale will there be 10 batches sent up? Or is ...
0
votes
1answer
239 views

SpriteBatch.end() Issue because of a thread

While playing, I use a thread to Load() and Unload() Texture2D. I have multiple ContentManager to only Unload() Texture2D I want to unload. But sometimes, I have this issue on the SpriteBatch.End() : ...
1
vote
2answers
116 views

Textures loading too large on smaller monitors

I have an XNA game, and when i run the game the textures load all good on my computer and on my tv and they're all bring drawn in the right position. But on my laptop, which screen is smaller then ...
1
vote
3answers
2k views

XNA SpriteBatch.Draw with rotation, scaling and origin?

I use a 1x1 pixel 2d texture as source for SpriteBatch.Draw. The texture is scaled and rotated around an origin. The left image is only scaling. The right one scaling + rotation around the origin at ...
1
vote
0answers
377 views

Stacking Drawing Matrix for SpriteBatch in XNA

I'm trying to make a 2D engine for XNA with SpriteBatch. My object unit is Entity, which can include other Entities as its children. However, when drawing them, the rotation and scaling stacking do ...
1
vote
3answers
249 views

Objects being drawn on wrong layers

I have the main game (Game1.cs) draw the sprites like so: //Clear everything GraphicsDevice.Clear(Color.CornflowerBlue); //Begin drawing ...
1
vote
1answer
166 views

XNA 4.0 - strange blueish alpha with Spritebatch over Skybox

I created a 3D scene and now I wanted to draw a 2D overlay with the SpriteBatch class. That is my rendering code: public void Draw(GameTime gametime) { ...
2
votes
2answers
164 views

XNA Sprite Clipping Incorrectly During Rotation

I'm having a bit of trouble getting my sprites in XNA to draw when near the edge of the screen. Seemingly if you use SpriteBatch to draw then XNA will not draw it if for example (mPosition.X + ...
2
votes
0answers
299 views

Why is Spritebatch drawing my Textures out of order?

I just started working with XNA Studio after programming 2D games in java. Because of this, I have absolutely no experience with Spritebatch and sprite sorting. In java, I could just layer the images ...
1
vote
2answers
4k views

How can I draw a simple 2D line in XNA without using 3D primitives and shders

I would like to be able to draw arbitary lines in my sprite based 2D XNA game. How can I draw a simple line on screen in XNA without dealing with vertex arrays or shaders.
7
votes
1answer
808 views

How can I achieve a 3D-like effect with spritebatch's rotation and scale parameters

I'm working on a 2d game with a top-down perspective similar to Secret of Mana and the 2D Final Fantasy games, with one big difference being that it's an action rpg using a 3-dimensional physics ...
0
votes
1answer
648 views

Artifacts when using SamplerState.LinearClamp in SpriteBatch

I'm using XNA 4.0 and VS2010 Express for Windows Phone and Windows Phone SDK 7.1. This is a platform game and I have a map made up of 16x16 textures that is drawn dynamically, tile by tile. When ...
2
votes
1answer
1k views

Using SpriteBatch with BasicEffects and layerDepth creates negative Z values?

Simply: Why don't all of these sprites draw? What do I need to do to make them draw? I'm trying to use SpriteBatch.Draw with the layerDepth parameter to help reduce overdrawn. However I can't get it ...
3
votes
1answer
1k views

XNA how to draw some sprites tiled/wrapped and others not?

I already have: mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); and take care to draw all my sprites in order. I now want to draw some textures tiled. Do I have to create ...
1
vote
3answers
560 views

Smallest increment for a SpriteBatch depth between 0.0 and 1.0?

I experienced some problems with SpriteBatch in XNA when I tried to mix two different SpriteSort modes. (Begin with deferred, end, begin with BackToFront wasn't sorting properly.) I've settled on just ...
1
vote
1answer
342 views

Are SharpDX's ContextDirect2D methods different from XNA's SpriteBatch?

I'm migrating from XNA to SharpDX in Win8. I noticed this DrawBitmap call in one of the samples. Is this different in some shape, way or form from XNA's SpriteBatch?
5
votes
2answers
2k views

SpriteBatch.Begin() making my model not render correctly

I was trying to output some debug information using DrawString when I noticed my model suddenly was being rendered like it was inside-out (like the culling had been disabled or something) and the ...
1
vote
0answers
201 views

Sprite sorting issues

I apologize for the vague title, I'm not sure how else to phrase this problem. I am using tIDE to assist me in my game's world development. To give a dynamic effect to map layers within tIDE, it has ...
0
votes
1answer
772 views

Nested Sprite Batch and background draw

my code looks something like this: graphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.Draw(contentLoader.VerticalGradient, tileSafe, null, ...
4
votes
2answers
747 views

Cropping a line (laser beam) in XNA

I have a laser sprite that I wish to crop. I want to crop it so when it collides with an item, I can calculate the distance between the starting point, and the ending point, and only draw that. This ...
3
votes
2answers
851 views

2D sprites not drawing at correct depths?

I've been having some problems with getting my sprites to draw in the correct order. Right now there are 2 types of objects: nodes and paths. I always want the nodes to draw over the paths so I have ...
-4
votes
1answer
408 views

Make Sprite Jump Upon a Platform

I have been struggling to make a game like Doodle Jump where the sprite jumps on a platform. So how do you make a sprite jump upon platforms in XNA? Th platforms are represented by a list of positions ...
3
votes
2answers
626 views

XNA: Regarding SpriteBatch.Draw()

I was trying to develop a very simple ping pong game using XNA. In my Draw() I am drawing the player paddles first then the ball as follows: spriteBatch.Draw(myPlayer, myPlayer1Pos, null, ...
2
votes
1answer
431 views

XNA GameServices vs. public static

I am just starting learning XNA for developing Windows Phone games. I am stumbling accross different sample codes featuring different approaches on handling things. A question for the experts... or ...
2
votes
3answers
2k views

Can I use SpriteBatch when drawing sprites on a rotating 3D plane

I'd like to have my plane of sprites rotate similarly as in this game (YouTube Video). So basically, everything is drawn in 2D, but the 2D plane is then "rotated in 3D" (or camera is rotated). When ...
5
votes
4answers
3k views

How to clip cut-off text in a textbox?

I'm writing a textbox class for my XNA game and I'm using SpriteFont to draw the text. It's only a single line textbox so when the text width exceeds the size of the rectangle box, it currently just ...
2
votes
1answer
2k views

Why isn't my sprite being drawn in the correct position in XNA?

Sorry if this has been asked before, but I can't seem to find it here. I'm trying to make an asteroids clone in XNA. I took the Game State Management project and am making new classes for things like ...
1
vote
1answer
859 views

Why do 3d model drawn to a RenderTarget appear distorted compared to those drawn directly?

I've got a problem drawing a 3D model to a RenderTarget2D in XNA 4. When the model is drawn to a render target, and then the render target is later drawn to the screen it appears distorted. (See right ...
4
votes
2answers
2k views

Performance/architectural implications of calling SpriteBatch.Begin/End in many different places?

I notice some code samples only call SpriteBatch.Begin and SpriteBatch.End in the game's main draw method and then draw everything within that method through direct SpriteBatch.Draw calls or indirect ...
1
vote
1answer
2k views

XNA 4.0 - Mixing 3D and 2D - SpriteBatch putting weird alpha texture over whole scene

I am working on a game in XNA 4.0 that has been entirely in 3D so far but now I want to incorporate a HUD. I have tried doing a simple test using spriteBatch as such: spriteBatch.Begin(); ...
1
vote
1answer
410 views

Effective SpriteBatching in XNA?

What is an example of efficient sprite batching in XNA? I don't know when (if ever) I would do something like this: spriteBatch.Begin() DrawSprite1(); spriteBatch.End(); spriteBatch.Begin(); ...
27
votes
2answers
8k views

How exactly does XNA's SpriteBatch work?

To be more precise, if I needed to recreate this functionality from scratch in another API (e.g. in OpenGL) what would it need to be capable of doing? I do have a general idea of some of the steps, ...
1
vote
2answers
1k views

Can SpriteBatch be used to fill a polygon with a texture?

I basically need to fill a texture into a polygon using the SpriteBatch. I've done some research but couldn't find anything useful except polygon triangulation method, which works well only with ...
2
votes
1answer
355 views

Should I go with SpriteBatch or just 3D with Z component always zero?

I'm designing a platformer and beginning to code the viewing engine of the game. Now, I have to make a key decision: Should I just use SpriteBatch to draw all the 2D stuff, as there is no 3D, or ...
1
vote
4answers
515 views

SpriteBatch.Draw() rectangle is different from destinationRectangle passed in

When I ask SpriteBatch to draw a rectangle as within the following method : public static void DrawSolidRectangle(Rectangle rectangle, Color color) { // the output from this is shown ...
3
votes
2answers
946 views

XNA C#: How can I prevent blurring when drawing from a RenderTarget2D?

I'm making a game and I want the end graphics to look chunky and pixellated, so I'm drawing from the spritebatch onto a RenderTarget2D which is 1/4th the size of the actual backbuffer, and then ...
5
votes
1answer
670 views

How do I configure the clipping region when drawing with XNA's SpriteBatch?

I have a SpriteBatch that is set to draw to a RenderTarget2D that is 500 pixels larger in both height and width. Whenever I draw to a point outside of the physical screen dimensions, it will not draw ...
4
votes
1answer
758 views

How can I rotate a Texture2D into / out of the screen?

I am drawing a Texture2D onto the screen and have the need to rotate the texture forward, in a 3D way. I'm using the SpriteBatch Draw() method and it only allows limited 2D rotation around the Z ...
4
votes
1answer
791 views

Using raw vertex information for sprites rather than SpriteBatch in XNA

I have been wondering whether using SpriteBatch is the best option. Obviously for prototyping or small games it works well. However, I've been wanting to apply techniques such as shaders and lighting ...