PDA

View Full Version : load and display multiple 3d model



fitt0
09-29-2009, 07:01 PM
hi,

i have a 3D model of marble. i need to display 72 marbles at the same time. how can i load the model without repeating load it for every single one?

thank you.

todayman
09-29-2009, 07:43 PM
So you load the model, and there is some series of commands that draw the model (vertex arrays, vbos, old-style glBegin/End). When you draw the marble at a particular position, you do something like the following:

glPushMatrix();
glTranslatef(x,y,z);
drawMarble();
glPopMatrix();

You can repeat this process with a different x,y,z and the marble will get drawn in a different position in addition to the original one. Basically, you are telling OpenGL to draw something, then you draw something else (which is really the same thing) with a different position/rotation/etc.