View Full Version : Urgent:Modelview-Matrix!!

Can someone please give me a little ascii drawing of the Modelview-Matrix or something like that.I get it with glGetFloatv(....),but to do further calcs with it IŽll have to know how it looks like.I think it must consist of a vector in x-,in z- and in the viewing Direction,but in which order??

Thanks in advance,XBCT!

FATBUDDHA

04-20-2000, 12:24 PM

This is all I know about the model view matrix:

1 ? ? ?

? 1 ? ?

? ? 1 ?

x y z 1

x,y,z, gives you the absoloute coordinates of the current position in the modelview matrix.

It's a while since I looked at this so I'm not sure it's correct. I think at the back of the red book there's some more info about it...

Hope it helps (and hope that I'm not completely wrong...) http://www.opengl.org/discussion_boards/ubb/smile.gif

ribblem

04-20-2000, 12:28 PM

Although I'm not positive how OpenGL does it I am sure that it works the way every graphics textbook teaches it. The way it is done is with transform, rotation, scaling, and other matrixs. What basically happens is you just keep multiping these various matrixs together and matrix math makes it work out. If you need to know how this works get a book on graphics theory and read the chapers on this cause it is much more than I can type out.

So in answer to your question no position is the matrix just holds the x, y, or z translations or the viewing direction. It is all combined. The matrix is a 4x4 matrix though and to make any changes just make a the matrix you want and muliply it to the Modelview matrix to get the desired results (but be warned this making a matrix to muliply the modelview matrix requires quite a bit of knowlegde about matrix math.)

Hope this gets you pointed in the right direction.

to better clarify:

float mv_matrix[4][4];

glGetFloatv(GL_MODELVIEW_MATRIX,mv_matrix);

you'll get:

mv[0][0]=uvx_x; mv[1][0]=uvy_x; mv[2][0]=uvz_x; mv[3][0]=xlt_x;

mv[0][1]=uvx_y; mv[1][1]=uvy_y; mv[2][1]=uvz_y; mv[3][1]=xlt_y;

mv[0][2]=uvx_z; mv[1][2]=uvy_z; mv[2][2]=uvz_z; mv[3][2]=xlt_z;

mv[0][3]=0; mv[1][3]=0; mv[2][3]=0; mv[3][3]=1;

where:

uvx,uvy,uvz unit vectors for rotoscaling

xlt translation vector

Dolo/\/\ightY

[This message has been edited by dmy (edited 04-21-2000).]

Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.