Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Urgent:Modelview-Matrix!!

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    235

    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!

  2. #2
    Intern Newbie
    Join Date
    Mar 2000
    Location
    UK
    Posts
    36

    Re: Urgent:Modelview-Matrix!!

    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...)

  3. #3
    Junior Member Regular Contributor
    Join Date
    Apr 2000
    Posts
    112

    Re: Urgent:Modelview-Matrix!!

    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.

  4. #4
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: Urgent:Modelview-Matrix!!

    to better clarify:

    float mv_matrix[4][4];
    glGetFloatv(GL_MODELVIEW_MATRIX,mv_matrix);

    you'll get:

    Code :
     
    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).]
    Dolo/\/\ightY

  5. #5
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    235

    Re: Urgent:Modelview-Matrix!!

    Thanx alot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •