Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualCornstalks

Posted 07 November 2012 - 08:30 AM

When batching draw calls, how does one handle different transform matrices (position/rotation) for each object? Does each object's transformation matrix have to be applied before the batch draw call?

Specifically, I'm using OpenGL ES 2.0 to draw lots of 2D boxes. I can draw each one individually just fine, but seeing as I'm targeting mobile platforms, I'm looking to try to squeeze as much performance out of this as I can. The boxes aren't textured; mostly I'm interested in minimizing draw calls to save CPU time. The more CPU time I save, the larger my physics simulation can be.

  • If I draw a lot of boxes and want to batch the draw calls together into one call, does that require that I apply the transformation matrices of each object to its vertices before copying all the objects into a single buffer for drawing?
  • When batches are drawn, how does one differentiate between each object being drawn (if it's possible)? Perhaps my understanding of batching is wrong, but the way I currently understand it is that you cannot differentiate between each object (because you just take the vertices of all the objects to draw and copy them all into one buffer, so it just looks like a whole bunch of vertices; also this would require using GL_TRIANGLES instead of GL_TRIANGLE_STRIP (unless degenerate triangles were inserted) so as to not connect two different objects with a stray triangle)
  • If you had a bunch of 2D boxes to draw, each with its own position, rotation, and scaling, but all of the same color (and no textures), how would you (personally) draw them? As a follow up, what if each had its own color; does that change things?

I don't know a lot about drawing optimization techniques. I'm comfortable drawing things to the screen, but I'm not a fancy graphics programmer.

#3Cornstalks

Posted 07 November 2012 - 08:29 AM

When batching draw calls, how does one handle different transform matrices (position/rotation) for each object? Does each object's transformation matrix have to be applied before the batch draw call?

Specifically, I'm using OpenGL ES 2.0 to draw lots of 2D boxes. I can draw each one individually just fine, but seeing as I'm targeting mobile platforms, I'm looking to try to squeeze as much performance out of this as I can. The boxes aren't textured; mostly I'm interested in minimizing draw calls to save CPU time. The more CPU time I save, the larger my physics simulation can be.
  • If I draw a lot of boxes and want to batch the draw calls together into one call, does that require that I apply the transformation matrices of each object to its vertices before copying all the objects into a single buffer for drawing?
  • When batches are drawn, how does one differentiate between each object being drawn (if it's possible)? Perhaps my understanding of batching is wrong, but the way I currently understand it is that you cannot differentiate between each object (because you just take the vertices of all the objects to draw and copy them all into one buffer, so it just looks like a whole bunch of vertices; also this would require using GL_TRIANGLES instead of GL_TRIANGLE_STRIP (unless degenerate triangles were inserted) so as to not connect two different objects with a stray triangle)
  • If you had a bunch of 2D boxes to draw, each with its own position, rotation, and scaling, but all of the same color (and no textures), how would you (personally) draw them? As a follow up, what if each had its own color; does that change things?
I don't know a lot about drawing optimization techniques. I'm comfortable drawing things to the screen, but I'm not a fancy graphics programmer.

#2Cornstalks

Posted 07 November 2012 - 08:18 AM

When batching draw calls, how does one handle different transform matrices (position/rotation) for each object? Does each object's transformation matrix have to be applied before the batch draw call?

Specifically, I'm using OpenGL ES 2.0 to draw lots of 2D boxes. I can draw each one individually just fine, but seeing as I'm targeting mobile platforms, I'm looking to try to squeeze as much performance out of this as I can. The boxes aren't textured; mostly I'm interested in minimizing draw calls to save CPU time. The more CPU time I save, the larger my physics simulation can be.

  • If I draw a lot of boxes and want to batch the draw calls together into one call, does that require that I apply the transformation matrices of each object to its vertices before copying all the objects into a single buffer for drawing?
  • When batches are drawn, how does one differentiate between each object being drawn (if it's possible)? Perhaps my understanding of batching is wrong, but the way I currently understand it is that you cannot differentiate between each object (because you just take the vertices of all the objects to draw and copy them all into one buffer, so it just looks like a whole bunch of vertices; also this would require using GL_TRIANGLES instead of GL_TRIANGLE_STRIP (unless degenerate triangles were inserted) so as to not connect two different objects with a stray triangle)
  • If you had a bunch of 2D boxes to draw, each with its own position, rotation, and scaling, but all of the same color (and no textures), how would you (personally) draw them?

I don't know a lot about drawing optimization techniques. I'm comfortable drawing things to the screen, but I'm not a fancy graphics programmer.

#1Cornstalks

Posted 07 November 2012 - 08:17 AM

When batching draw calls, how does one handle different transform matrices (position/rotation) for each object? Does each object's transformation matrix have to be applied before the batch draw call?


Specifically, I'm using OpenGL ES 2.0 to draw lots of 2D boxes. I can draw each one individually just fine, but seeing as I'm targeting mobile platforms, I'm looking to try to squeeze as much performance out of this as I can. The boxes aren't textured; mostly I'm interested in minimizing draw calls to save CPU time. The more CPU time I save, the larger my physics simulation can be.
  • If I draw a lot of boxes and want to batch the draw calls together into one call, does that require that I apply the transformation matrices of each object to its vertices before copying all the objects into a single buffer for drawing?
  • When batches are drawn, how does one differentiate between each object being drawn (if it's possible)? Perhaps my understanding of batching is wrong, but the way I currently understand it is that you cannot differentiate between each object (because you just take the vertices of all the objects to draw and copy them all into one buffer, so it just looks like a whole bunch of vertices; also this would require using GL_TRIANGLES instead of GL_TRIANGLE_STRIP (unless degenerate triangles were inserted) so as to not connect two different objects with a stray triangle)
  • If you had a bunch of 2D boxes to draw, each with its own position, rotation, and scaling, but all of the same color (and no textures), how would you (personally) draw them?
I don't know a lot about drawing optimization techniques. I'm comfortable drawing things to the screen, but I'm not a fancy graphics programmer.

PARTNERS