View Full Version : a simple question on glTranslate
05-10-2004, 02:00 AM
Hi, I have drawn a cube resting on a 3 dimensional rectangle and I want to use glTranslate to move the whole object(cube+rectangle) via keyboard presses, how do I make it so that the cube doesn't move and only the whole object moves? thanks.
05-10-2004, 03:03 AM
You use glPushMatrix and glPopMatrix to do hierarchical transformations.
transform entire object here
transform before cube
transform before rectangle
This way you save do local transformations to modify a single triangle or whatever and also transform the entire shape if you want to.
05-11-2004, 01:10 AM
Hi, they moved uniformly for awhile but doesn't not always stay together when moving. For example, the cube would just be couple of points behind the rectange after a long movement down the plain.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.