How do you move multiple objects in your view independently of each other?
... And then again as a whole (for viewing changes). I'm sure this is a
simple thing but I've never seen code for it in my examples.
I guess you'd have to use a different matrix for each object. Does
translating and rotating a matrix change the original values in that matrix
or copy them somewhere?
Can (will) anyone walk me through this?
Thanks in advance.
Mike.
Mike Willhide wrote in message <78p7tn$13...@r02n01.cac.psu.edu>...
Give eavh object a different modelview matrix.
>... And then again as a whole (for viewing changes).
Give each object the same modelview matrix as all other objects.
>I'm sure this is a
>simple thing but I've never seen code for it in my examples.
>
>I guess you'd have to use a different matrix for each object. Does
>translating and rotating a matrix change the original values in that matrix
>or copy them somewhere?
Calls to glRotate and glTranslate will multiply a rotation or a translation
matrix onto the top of the current matrix stack, so yes, it changes the
matrix. If you don't want the matrix permanently altered, you would use
glPushMatrix and glPopMatrix around your changes; after the pop, the matrix
is restored.
An application will typically do the following to render a dynamic scene:
glMatrixMode (GL_MODELVIEW)
glLoadIdentity ()
// Set camera transform
loop (i) over objects
glPushMatrix
// set transform for object(i)
// render object(i)
glPopMatrix
endloop
I hope that is helpful.
-Paul Martz
Hewlett Packard Workstation Systems Lab
To reply, remove "DONTSPAM" from email address.