Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
2answers
50 views

In XNA 4, how can I access SpriteBatch's transformMatrix in my shader?

I would like to use a custom effect with a regular XNA SpriteBatch. I have a 2D camera which computes a transform matrix, so I need my shader to take this into account. I have put a world matrix ...
5
votes
1answer
118 views

Multiple SpriteSheets break batching

The problem: I can't fit all my 2d animation sprites for all units and environment in 1 spritesheet. Everything batches fine until I use two spritesheets... I noticed the following : all units from ...
0
votes
1answer
74 views

Set color by uniform per sprite using libGDX SpriteBatch

I am using a SpriteBatch to render large amounts of sprites very fast. Now I want to modify the sprites with shaders to tint them in a color. Problem 1: Altering an uniform by getting the shader and ...
2
votes
1answer
70 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 ...
0
votes
1answer
197 views

Sprite draw-order in libgdx

From other frameworks I know methods for easy ordering sprites within a spritebatch (to determine if a sprite has to be drawn in front or behind another sprite). For example in MonoGame/XNA this is ...
0
votes
1answer
48 views

Batching and object's transformation

I'm trying to implement batching in my game (Sprite batching and 3D Mesh batching), I've read a lot of documentation about that but I don't understand something: When each object have is own ...
2
votes
1answer
112 views

Failing Screen Resize Method

So I want my game to draw to a specific "optimal" size and then be stretched to fit screens that are a different size. I'm using LibGDX and figured that I could just draw everything to a FrameBuffer ...
2
votes
4answers
130 views

LibGDX - SpriteBatch's .draw() method requiring float[]

Please excuse my lack of knowledge with LibGDX, as I have just started learning it. I am going through some simple tutorials, and in one of them, I draw a string onto the screen like so: // the ...
2
votes
1answer
275 views

Setting uniform value of a vertex shader for different sprites in a SpriteBatch

I'm using libGDX and currently have a simple shader that does a passthrough, except for randomly shifting the vertex positions. This shift is a vec2 uniform that I set within my code's render() loop. ...
2
votes
1answer
109 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
272 views

libGDX SpriteBatch reuse

Using libGDX, sprites or simply texture regions must be inserted into the batch for drawing: void render() { batch.begin(); batch.draw(...); batch.end(); } Is the VBO being uploaded ...
0
votes
1answer
54 views

XNA 4.0 - Strange Behavior when using RenderTarget2D

My Problem is similar to XNA 4.0 - Why does using a RenderTarget2d cause transparency on models?. I want to render my scene to a Texture2D and then draw the texture. If I set no RenderTarget at all ...
0
votes
0answers
87 views

rotating sprite with quaternion in scenegraph

I have been trying to set up a scenegraph in XNA, which I then use to draw sprites in the correct places. It uses matrix transformations to accomplish this. So far, I got position and scale working ...
0
votes
1answer
116 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?
1
vote
0answers
87 views

Rotating SpriteBatch clockwise [closed]

I have developed a 2D game that looks great on the Android. Now I want to make it cross-platform. For this I need to literally rotate everything when it is on desktop. I tried to do that by rotating ...
2
votes
2answers
945 views

SDL2 sprite batching and texture atlases

I have been programming a 2D game in C++, using the SDL2 graphics API for rendering. My game concept currently features effects that could result in even tens of thousands of sprites being drawn ...
0
votes
1answer
64 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
51 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 ...
2
votes
2answers
289 views

Batching and Z-order with Alpha blending in a 3D world

I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++) Currently, I'm ordering elements back to front before drawing them without batch (so 1 element ...
3
votes
1answer
396 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
58 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
265 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 ...
0
votes
2answers
299 views

Batching elements

I don't understand exactly how batching works. What I have understood: Batching is useful to regroup similar elements together and draw them in one draw call (performance++), currently drawing an ...
0
votes
2answers
1k views

SpriteBatch being drawn outside of Stage?

Currently working on my first game, though running into some problems with libgx and screen aspect ratio. What I have is a Stage which contains things like menu buttons etc, and the rest of the game ...
1
vote
1answer
1k views

OpenGL ES 2.0. Sprite Sheet Animation

I've found a bunch of tutorials on how to make this work on Open GL 1 & 1.1 but I can't find it for 2.0. I would work it out by loading the texture and use a matrix on the vertex shader to move ...
1
vote
1answer
154 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
1answer
207 views

Monogame/SharpDX Texture2D doesn't hold value

The problem I have discovered is most likely between classes, so I dont really have much option but to post the whole code here: https://www.dropbox.com/sh/smyw9t1ap3by2vd/pBX-aJJ-Qx I have been ...
1
vote
1answer
245 views

Batching and performances

I'm trying to understand batching and I'm not sure to understand how to do that, can I have more informations please? Here is what I found for the moment: Batching informations There is many types ...
0
votes
2answers
171 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. ...
4
votes
1answer
370 views

How to optimize SpriteBatch usage?

From what I understand, SpriteBatch's purpose is to batch as many draw operations to send to the GPU. Each batch can handle one texture at a time, and changing SpriteBatch context/texture is ...
3
votes
1answer
99 views

center point of a text?

i'm drawing a text using a spritefont and the draw.string function of the spritebatch object. in some point, i need to augment the size of the text, so i use a variable to scale it. all this is ...
0
votes
1answer
90 views

My Sprite Rectangle moves, but my sprite doesn't

Here's the issue, When I build, everything loads fine, everything works, but then, when you enter the game, the sprite is there. However, The sprite does not move, the sprite RECTANGLE does. Meaning ...
4
votes
1answer
2k views

Libgdx sprite rotation (image quality)

This one is probably really simple but I didn't find a solution. I'm trying to create a widget (speedometer) with libgdx. For the arrows I'm using the setRotation() function. But when the image is ...
-2
votes
1answer
265 views

XNA rendertarget sprite batch problem [closed]

When using this code: public static Texture2D ShowHealthBar(SpriteBatch spriteBatch,Texture2D empty, Texture2D full, float health) { spriteBatch.Begin(); RenderTarget2D ...
0
votes
1answer
465 views

Drawing more that one quad with only one glDrawArray call…?

Edit After initially thinking that my sprite batch test was faster than calling each sprite individually, it appears that is not the case!! :-( With a single set of GL calls for a each sprite, I can ...
1
vote
1answer
462 views

Love2D : How can I keep up with lots of small sprites' collision data?

So I'm using a SpriteBatch to keep up with lots of small pieces for a falling-piece puzzle game. I have an array of Quads (for different color blocks), and they are randomly added to the ...
0
votes
3answers
435 views

How can SpriteBatch use a single texture/asset as multiple independent objects/instances

I'm using LibGDX to create a game, but I'm encountering a problem with SpriteBatch. Whenever two objects that use the same image for their sprite come onto the screen, the new object replaces the old ...
2
votes
1answer
108 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 ...
2
votes
2answers
680 views

Does my 2D OpenGL renderer need optimized?

I've started a game engine for learning purposes. I have successfully gotten an opengl renderer working and I can draw textures of varying sizes to the screen. The way I have done this is by creating ...
0
votes
1answer
260 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
117 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 ...
2
votes
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 ...
0
votes
0answers
786 views

Depth sorting 2D textures in a batch with OpenGL ES 2.0

I have a combo of texture atlases and sprite batches in an OpenGLES 2.0 2D game I'm developing which is working well, but I have a problem with depth sorting. I'm using atlases to reduce the number ...
1
vote
1answer
2k views

Repeat texture in a scrolling game

The bottom region of the screen is filled by a repeated texture: grassTexture = new Texture(Gdx.files.internal("images/grass.png")); grassTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); ...
1
vote
0answers
421 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
275 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 ...
5
votes
3answers
442 views

OpenGL ES 1.1 - How to batch draw particles with different translations?

Assuming that I've combined all of my vertex data for many particles into a single array, how would I batch draw all of those particles in a manner that preserves their unique translations? Any code ...
1
vote
1answer
176 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) { ...
3
votes
2answers
173 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
326 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 ...