Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -




Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno

Go back

Topic review (newest first)

2008-06-25 19:27:40

hmmm... you're right! Mind you, thats exactly how the matrix equation was displayed in the book. shame

but regardless, that doesn't seem right. OpenGL performs the transformations in the reverse order of when you specify them.

Say you start with the model View matrix as the Identity. Then you specify a rotation matrix R, a translation matrix T, ands a scaler matrix S, in that order. Each transformation right multiplies the new matrix by the old one, so we get: (R*T*S) as our modelview matrix.

If we had to left multiply a 4vector V (or rather, a 1x4 matrix) by this matrix, V(R*T*S), that would result in the transformations occurring in the order in which they were specified, and not in reverse, which is not how its supposed to work. Unless perhaps, the reverse order process is not used for the Projection Matrix.

2008-06-25 18:06:04

opengl doesn't perform its transformations in that order perhaps? tongue, if you do the 4vector multiplied by the matrix, you'll get that result

2008-06-25 11:32:40

am I going mad, or does my openGL book not understand matrix multiplication?

2008-05-28 07:58:31

transformation, that's it!  Translation is a specific type of transformation.

2008-05-28 07:44:19

I think 'translation' or 'transformation' matrix is the term for it?

2008-05-28 07:42:39

You push and pop your "movement" matrices.  Unfortunately I just packed up my OpenGL book last night since I'm moving and thought to myself, "I won't need this in the foreseeable future."  Look up glPushMatrix and glPopMatrix.  The basic thing you would do:

   rotate object at origin;
   translate object to the position you want;
   now work on your next object;

And so on.  The functions involved give a view of what is actually going on in the computer.  Moving points in space is always done by multiplying a coordinate by a matrix.  All movement functions are done by matrix multiplication.  Translating then rotation is done by multiplying a translating matrix by a rotating matrix.  pushing the matrix in effect saves the "movement" matrix where you are currently at, then you make changes to it by multiplying by other matrices.  Popping takes you back to that saved state.

PS: What is the proper word for "movement" matrix?  I know there is one...

2008-05-28 07:42:38

But surely you would know the translation required already and do it first before doing any rotations?

pooossibly! But one thing I like making is a robot model that can be positioned based on a set of angle parameters. When updating its position, I would basically assemble each piece in a series of rotations and translations. For instance, you would rotate the forearm by say, leftElbowAngle, and then move it onto the bottom of the upper arm, and then the two of them would be rotated by leftArmShoulderAngle. The entire upper body could be rotated about its waste, and finally the entire model could be rotated and shifted to its appropriate location.

Now according to that, if different parts of the body are rotated at all these different angles, then calling glTranslate to shift its location would send them off in all different directions.

now i MAY be able to reorder it so that every piece is rotated before its translated, I just suspect that in certain scenarios, you might need to shift after rotating, and it would be a nightmare.

2008-05-28 07:23:58

I havn't really used OpenGL for all that much beyond basic things really, but i know that you can read in the transformation matrix into a float array, and use the methods glMultMatrixf etc, so that you can append a transformation at the beginning rather than the end. I cannot for the sake of me remember if your problem is applicable or not, i can't remember how opengl works its transformation orders.


float cmat [16];
glGetFloatv(GL_MODELVIEW_MATRIX, cmat);

However, constantly retrieving the modelview matrix might have a performance impact. But surely you would know the translation required already and do it first before doing any rotations?

I personally don't like openGL for its ordering, i.e. if you have


that means its going to scale it, then rotate it, then translate it. which is kind of counter intuitive i think tongue

2008-05-28 05:37:40

I once wrote a program to do wire frame projections for me, and I guess I'm kind of used to my own way of doing things. But I got a book on OpenGL that I've been reading over summer break, and the way they do certain things perplexes me.

One thing I read today is that when doing model rotations, you effectively rotate a models coordinate system. This means that when you use GL translate to shift the model over, say by a vector of (1, 0, 0), it gets shifted by that vector, relative to its new coordinate system.

That sounds like a hassle to me. Say you had a 3d object thats been rotated several ways, and you want to transfer the object onto say.... a table, by shifting its location. You'd have to calculate the coordinates of the table with respect to the objects weirdly rotated coordinate system, and that sounds unnecessarily complicated for such a simple thing.

Is there a simpler way to move an object in this fashion?

Board footer

Powered by FluxBB