Display a same PURE mesh multiple Times

Hello all,
Woawwww… working on my project, I just realized that I did not catch something really important about meshes… I have a circle mesh composed of vertices. No texture, no image, just color. To reproduce it several time, I just thought to add a rectangle with addRect and I was persuaded that the circle mesh as it is, would be reproduced exactly… But no ! Quite evidently (…) only a rectangle white mesh appears. It seems the only way to reproduce a mesh by this way is to have a textured one. So my question is how can I draw the same pure circle mesh several time ? Do I have to draw() for each one in a loop ??? Thanks

You can draw the same mesh different places by doing this:

pushMatrix()     --Stores the original information about how to draw the mesh

translate(x, y)     --Moves your mesh
rotate(angle)     --Rotates your mesh
scale(size)     --Scales your mesh

mesh:draw()     --Draw your mesh

popMatrix()     --Resets everything back to the pushMatrix() 
                       --so you can start over with the next mesh

This is for 2D but it works almost the same way in 3D.

Thank you, but I must not have been clear. This moves the mesh. But I just want to draw the same mesh simultaneously at different places so they all appears at the same time at screen. Thanks

I probably wasn’t clear either. This functions change where stuff is drawn, not where the mesh is located. So you can use this multiple times with the same mesh. Just remember to use push and pop matrix every time you want to draw it in a new place.

Ok then, I’ll watch this more closely. Anyway thank yo for your help. By the way, I suppose the methods you propose is very time consuming for the graphic or cpu engine no ?

If you tell Codea to draw the same mesh 100 times in 100 different places, it will draw the same mesh in 100 different places. Conserves memory. There is also a sample that looks like a spiral that would be good to look at; it uses one mesh but draws it in a neat spiral hundreds of times.

Thanks aciolino. Of course I have seen the sample you speak about but it’s not a pure mesh but a textured one so It could not help for my case. I understand your argument about memory conservation for sure, but is the way to draw Chunnoo proposes also fast ? Here is my principal concern, as always, speed :slight_smile: Thanks

The mesh example also uses the same method :slight_smile:

And btw meshes with textures are just as meshy as all the other meshes they just have more complex colors.