iDevGames Forums
Moving an object - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Moving an object (/thread-1195.html)



Moving an object - TimMcD - Jun 3, 2009 09:20 PM

So, I hear that transformations are relative to the object. What if I wanted to move the object's X to 0.1 and Y to 0.2? Not relative to the object, but those definate coordinates? How would I go about doing this? I would just like to be able to move about my 'glutSolidCube(0.1)' this way. Any help?


Moving an object - ThemsAllTook - Jun 4, 2009 07:14 AM

You need to keep track of your transforms and move things as appropriate for the current state of the modelview matrix. Everything is relative, so it doesn't really make sense to talk about absolute position in this way. You can try glPushMatrix(), glLoadIdentity(), glTranslatef(0.1f, 0.2f, 0.0f), draw, and glPopMatrix(), which may or may not be what you actually want to do...