How to draw two objects?

I need to draw a cube and a sphere inside the cube.
the prupose is to move the two object at the same time. just as you are sitting at the center of your room, then you begin to rotate. all the objects in front of you start moving in the same manner.


Using this viewing transformation, i can draw a cube.


by applying this, i can draw a sphere which can be rotate by changing the angle.

The problem is how to rotate two objects at the same time by changing the view point.

:confused: :confused: :confused: :confused:

Thanks for reading and thinking

[ May 25, 2005: Message edited by: lavendersg ]

Your lookat loads the viewing transformation onto the modelview matrix (or should if thatโ€™s the active matrix)

You should call lookat first.

Then pushmatrix

Then apply model the transformation.

Anything you now draw will be positioned with those transformations with the moving object.

Then you popmatrix.

You will be back in world space ready to draw additional objects in different positions by repeating from the pushmatrix call above.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.