Questions tagged [spritebatch]

A group of sprites that can all be drawn with the same settings

Filter by
Sorted by
Tagged with
0
votes
1answer
41 views

In Monogame, can/should SpriteBatch be instantiated in the Initialize method as opposed to the LoadContent method?

By default the SpriteBatch instance used is instantiated in the LoadContent method of Game1. ...
0
votes
1answer
26 views

Aligning animation frame assets with different sizes

I have code that changes texture in each frame depending on the player's state - walking, idle. My problem is that the idle texture (from separate png) has a slightly different size, and due to that ...
0
votes
1answer
54 views

How to render a trimmed sprite?

I used TexturePacker to create an atlas for me and I've read it into my game. I can use unrotated and untrimmed sprites and it works fine. Now I would like to support trimmed sprites and I'm running ...
2
votes
1answer
149 views

Overlaying Menus with a State Machine

I'm working on developing a game with C++, SDL, and OpenGL. I created the engine from scratch, and implemented my own state machine to handle menus and general gameplay. Each State gets pushed into a ...
1
vote
1answer
965 views

How to use multiple shaders with LibGdx + SpriteBatch

I'm programming a 2D game libgdx. I'm using a SpriteBatch of course to draw some Sprites. Now I wanted to use multiple ...
1
vote
1answer
194 views

Removing/Updating Spritebatch

I am designing a Spritebatch class, for static and dynamic objects with WebGL. A problem I'm facing is that I have read several different opinions on sprite batching but with one goal. Put all ...
1
vote
1answer
384 views

Using 60 frames per second causes the screen to leave a drawn trail of textures, when there is movement

I'm trying to implement a frame rate feature, and I have noticed that using 60 frames per second causes the screen to leave a drawn trail of textures, when there is movement. Here's the code I'm ...
0
votes
1answer
101 views

Rendering multiple strings/text using SpriteBatch from LibGDx library

I am using the LibGDX library to render a 3D model in my Android application. Now, I am stuck, where I want to render multiple dynamic texts on to different 3D boxes located on different coordinates ...
1
vote
0answers
83 views

How can I draw a snapshot of the game within the game?

I'm making a game in libGDX wich the main focus is "recursion", so I can play multiple instances of the game in itself, flowing through "layers" of games. Currently its mechanics work perfectly, but I'...
0
votes
1answer
100 views

Drawing a partial sprite with batch-LibGdx

I have a sprite like this. I want to draw this sprite in such a way that sprite is growing from bottom to top, using sprite batch on tap.for that,I have written the following code: ...
1
vote
2answers
2k views

Spritebatch and Shaperenderer

When I am using the same spritebatch to draw texture and calling shaperenderer inside it, it is kind of misbehaving, like texture is not getting drawn or font is not getting drawn, Why is it happening?...
0
votes
1answer
255 views

What is more performance friendly?

I'm wondering what is more performance friendly: 1) Rendering a texture (in a seperate RenderTarget2D) and reuse it. (That will use multiple spriteBatch.End() / <...
3
votes
0answers
216 views

Batch z-ordering problem in Cocos2d (Python)

I have a weird problem with my hexmap drawing code. My code uses "squished" hexagons to achieve a pseudo-isometric view. Because of that, the order of drawing them on screen matters a lot. ...
0
votes
1answer
134 views

Libgdx SpriteBatch won't position correctly on Screen

I have been trying to position my spritebatch correctly regardless of screen size but it simply wont scale..This is what I want to achieve on every screen size..I want my Sprite Object to be ...
1
vote
1answer
2k views

Understanding SpriteBatch.Draw overload XNA

I'm talking about the public void Draw (Texture2D texture, Vector2 position, Nullable sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth)...
1
vote
1answer
80 views

LibGDX: I need to get from SpriteBatch to Batch in order to draw a Touchpad

I have created a little game using LibGDX and it uses a SpriteBatch when it renders the game objects. Now I want to add a Touchpad to it, and the draw method of Touchpad takes a Batch as a parameter, ...
1
vote
1answer
691 views

Change the alpha blending color of scaled textures

It looks like semitransparent pixels are blended with while color when textures are drawn scaled. It is very noticeable and looks ugly when textures are drawn on dark background. ...
2
votes
1answer
483 views

Are there spritebatch drawing limitations on monogame?

I've reached a point that it seems when I draw too much on screen, monogame starts doing weird things. When I call this code in the Draw method ...
0
votes
1answer
71 views

Batching in Java (software rendering)

I've watched some tutorials on java game development and when they start using spritesheets all they do is get a subimage out of the spritesheet and create a new BufferedImage out of that. Does java ...
1
vote
1answer
831 views

Drawing textures in 3D/2.5D at an angle using spriteBatch in Monogame

for a university project we are creating a small "2d" game. Im writing 2D in "" because we would like to achieve a look similiar to the one in games like Don't Starve (so more like 2.5D). As you ...
0
votes
1answer
336 views

libgdx: SpriteBatch and ShapeRenderer projection wrong

I'm using LibGDX and the SpriteBatch and ShapeRenderer are having a perspective problem or something... When I draw something with both (code below), the planet texture is smaller than it should be. I ...
3
votes
3answers
371 views

Does scene2d(libGDX) know when an image is drawn out of the screen?

I mean, I want to make a tiled map using scene2d, so in the render method of my game... ...
2
votes
1answer
110 views

Rendering sprites on a Mali-400 MP device

I started developing a small cross platform game engine using OpenGL, I am working actually on a sprite batch renderer. Everything is working fine on OS X, iOS, Win32, and some Android Devices. Here ...
0
votes
1answer
57 views

XNA Texture2D Copy Error

I have a static class that I use to build a 3d character and render the results to a RenderTarget2D which I then return. I'd like to store the results for later use so I need to make a copy of the ...
4
votes
1answer
510 views

Batching texture to texture rendering in Unity on the gpu

I'm working on a 2D sidescroller within Unity 5.1. The terrain is intended to be semi-infinite in all 4 directions, procedurally generated using a noise algorithm. I'm using a 3x3 grid of quads as "...
1
vote
1answer
697 views

Rendering Performance: num Draw Calls == num Texture Bindings

I'm making a game with Libgdx 1.6.4 and experience some lag issues on iPhone 4 and then discovered: ...
0
votes
1answer
523 views

XNA 2D rotation Matrix offset/origin

I'm currently struggling with finding the offset for my original camera translation after I have applied a rotation for it. ...
0
votes
1answer
87 views

I can't understand the batcher.draw at libgdx [closed]

here is the code: ...
2
votes
1answer
2k views

How can I add a transparent overlay to a UI in libGDX?

I am attempting to use the following code ...
1
vote
0answers
244 views

Scaling/Zooming a SpriteBatch

I am working on my first game with LibGDX and coming from ActionScript3 I am used with the possibility of scaling things more or less the way I want. I know it works different in LibGDX, but I can't ...
1
vote
1answer
2k views

How can I do sprite batching in SFML?

I'm new to game dev and using SFML. I need to use lots of sprites at the same time, so I will probably need sprite batching. I know that sprite batching is used to draw multiple sprites with a single ...
0
votes
1answer
484 views

SharpDx Custom effect in SpriteBatch

I'm trying to port a blur effect from an XNA project over to SharpDx, and I get a "Null Reference Exception" wich I'm unable to find the reason for. ...
3
votes
2answers
111 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 ...
5
votes
1answer
554 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 ...
2
votes
1answer
1k 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
112 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 ...
4
votes
2answers
5k 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
108 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 ...
3
votes
1answer
853 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
1k 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: ...
4
votes
1answer
3k 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
484 views

SpriteBatch, trying to reduce draw calls

This my main draw call: ...
1
vote
1answer
2k views

libGDX SpriteBatch reuse

Using libGDX, sprites or simply texture regions must be inserted into the batch for drawing: ...
0
votes
1answer
207 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
1answer
731 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?
6
votes
3answers
10k 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
90 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 working....
-1
votes
1answer
723 views

XNA - Spritebatch Drawing Order

I'm new in this and I'm making XNA game. I have problem with the spritebatch drawing order. To be explained : I click button to open inventory and I need all ...
3
votes
2answers
1k 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 ...
5
votes
1answer
1k 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 ...