Quicker? Submitting Geometry vs Altering Modelview Matrix

Started by
4 comments, last by Hedinus 13 years, 3 months ago
I am currently developing a game for the iPhone (only consider OpenGLEs 1.x at this point for the game).

I have many simple textured quads that I would like to render at one time.
The quad locations and rotation are fixed and will at most need to be dynamically skewed.

Is it faster to submit unique vertex arrays for each quad, or should I push and pop the matrix stacks, only submitting the geometry once?

Thanks for any replies.
Advertisement
if you are only changing the view use martices
Matrix stacks work quite well. On iOS devices you should definitely submit geometry buffers only once, unless you do something special like deformable meshes, etc. The reason is because some of that stuff could get converted to fixed point math internally, depending on the GL profile, which obviously could be a significant performance hit. I suggest you to plan on how you want to represent the entire scene and how you want to render it with minimal draw calls. If you limit your draw calls as much as possible then the number of matrix stack operations will also decrease.
Latest project: Sideways Racing on the iPad
After running some tests for the game, I will be making the quads more animated (having the quads' top bounce and sway).

An idea popped up while working to pass a contiguous array of vertices (each quad owning their own set) to the GP once.
Should I still just mess with the matrix stacks or just have single array of vertices?


Thank you both for the replies. You've just helped me on deciding another portion of the game.

An idea popped up while working to pass a contiguous array of vertices (each quad owning their own set) to the GP once.
Should I still just mess with the matrix stacks or just have single array of vertices?
Not sure what you mean by that... could you elaborate?

Basically the idea is that if you have a model of an object, say a donut, you buffer it to GL once as a VBO. To render the donut, you use the modelview matrix to scale, translate, and rotate to the appropriate position. To render many donuts in different positions, you use the same VBO, but with different modelview matrices. When dealing with many types of models (say, a sphere, a cube, a cat, a dog), you create a VBO repository of those objects (but no duplicates of the same mesh), and draw them using the method I outlined before.

Sometimes it makes more sense to combine models and a single VBO to render them in a single draw call. For instance, if you have 100 donuts spilled onto the floor (that look the same), it would be more efficient to combine them into a single vertex pool and create VBO for that group, which in turn you can use a single matrix and one draw call to render.
Latest project: Sideways Racing on the iPad
<br /> <br /> <blockquote>An idea popped up while working to pass a contiguous array of vertices (each quad owning their own set) to the GP once.<br /> Should I still just mess with the matrix stacks or just have single array of vertices?<br /> <br /> Not sure what you mean by that… could you elaborate?<br /> <br /> <br /> The idea that I had would be to submit a number of vertices to render a bunch of quads, the vertices of which were modified for animation each frame before passing the data to the GP.<br /> <br /> In a previous game I had similar geometry for a number of objects. I would pass the geometry in once and modify the GP matrices for each object.<br /> I didn&#39;t need to worry so much about speed in that game. This time around I want to make sure I can draw hopefully hundres of graphic elements per frame while still keeping a good frame rate.

This topic is closed to new replies.

Advertisement