View Full Version : Cloning

Rick T
12-20-2011, 12:34 PM
The reusability of vertex data, cloning if you will, is what I am after.

Given: Vertex Data with positions and normals of one 3d object ( say a cube).
How do I render in 1 frame:
3 cubes, in 3 different positions, in 3 different colors.

I am writing for the Mac iPad and objects will be rendered with ES2.

Rick Tschudin

12-20-2011, 02:46 PM
Draw the same cube with different modelview matrices and different colors.

Thought, as you use ES2, you have to do it all in a shader.

carsten neumann
12-20-2011, 03:01 PM
If instead of 3 you want to draw hundreds of copies of a mesh you may want to look into instancing, i.e. glDrawElementsInstanced (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawElementsInstanced.xml) and friends.
It probably makes more sense to ask about that on a ES forum (http://www.khronos.org/message_boards/viewforum.php?f=19) though, as I don't know what API ES supports in that area.