Archived

This topic is now archived and is closed to further replies.

matrix issue...

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a linked list system for the entities. Im using glLoadMatrix along with my math class to handle transformations. Im sure this is a trivial question.. Anyway, I added a terrain to the scene graph as the root node and then attached a child entity to the terrain. When I try and move around in the world, nothing happens. So, this is really 2 questions in 1. first off, if your using glLoadmatrix, can you still move the object around using gltranslate/rotate? glTranslatef(cam...) ... DrawObject(); //load matrix is in this function... 2: (vague) is this correct?... child entitie's matrix code (example)
glPushMatrix();
mpTransform.LoadIdentity();
mpTransform.SetTranslation(mpPosition); //vector function

mpTransform.SetRotation(mpRotation);
glLoadMatrix(mpParent->mpTransform);
glMultMatrix(mpTransform);
...
Does anyone see what im doing wrong? (note that I have tried switching mpParent->mpTransform to multmatrix, but no change). Im relatively new to using glLoadMatrix to handel transformations, ive always used glTranslate/rotate before this. Thanks a lot in advance guys! ~No1 [edited by - no one on February 21, 2004 4:11:15 AM]

Share this post


Link to post
Share on other sites
A glMultMatrix call multiplies the current matrix by the matrix you pass. A glLoadMatrix call replaces the current matrix with the matrix you pass. The glTranslate, glRotate and glScale commands are special cases of glMultMatrix, so they multiply the current matrix by a matrix built from the arguments you pass. Therefore if you call glTranslatef and then glLoadMatrix the load matrix call will replace the existing matrix and the glTranslatef call will have no effect.

Enigma

Share this post


Link to post
Share on other sites