PDA

View Full Version : Makeing multiple objects....



unleashed
04-19-2001, 06:07 PM
I have one object doing excatly what i want, how can i make multiple objects?
just looking for an example.

thanks in advance
Unleashed

CoBour
04-19-2001, 10:19 PM
What do you mean, when you say "Object" ?? Be more precise.

Deiussum
04-20-2001, 04:45 AM
Multiple objects aren't really any different from a single object. Probably the most common example of multiple objects would look something like so

for each object
{
glPushMatrix();
DoObjectTransformations();
DrawObject();
glPopMatrix();
}

unleashed
04-20-2001, 07:35 AM
What i mean is i have one object, and i just want to call it in possiblly an array or something like that. I just want the same object to be drawn a # of times. Then on each one do something differnt with it at the same time. Say i have 3 stars as objects.
I want each one to move along the z-axis tward the user, and i want some to move in -y directions +y, -x, +x and -y and-x...etc directions at the same times so that there is more than one star (looking the same as the others) but each is moving in a different direction.

Thanks again, if anything else is need let me know...this is just an idea i had.
Thanks

rts
04-20-2001, 07:48 AM
I think display lists are what you need.

Create a dislpay list for one of your stars, then you can "draw it by number" as many times as you want.

Deiussum
04-20-2001, 09:17 AM
For the movement, just keep track of the position and direction of each object and do the appropriate transformations for each the way I show in my code up above. Using an Object-oriented approach for something like this tends to work quite well.

unleashed
04-21-2001, 07:13 PM
Thanks for the help everyone, but i figured it out. I am just a bit impatient when i have an idea in my head and i want it to work.