PDA

View Full Version : Multiple positioning using vertex arrays?



legendkiller
10-29-2004, 04:56 AM
Im very new to opengl and i'm playing around with vertex arrays. If i create an object using vertex arrays how would i make another instance of this object using the same array but in a different position in the window.

RigidBody
10-29-2004, 05:03 AM
you would use glTranslatef(dx, dy, dz) on the modelview matrix before drawing the object:

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();
glTranslatef(10., 0., 0.);
glDrawArrays(GL_TRIANGLES, 0, 1000);

glLoadIdentity();
glTranslatef(0., 10., 0.);
glDrawArrays(GL_TRIANGLES, 0, 1000);

...etc.