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 2 of 2

Thread: 3D transformations how gl does?

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2005
    Location
    ind
    Posts
    1

    3D transformations how gl does?

    Hi ,
    consider i want to translate a object inthe shape of 'W' made of 4 line Segments so wat is open gl doing internally to tanslate it will it do the matrix operatopn on the four lines ? ie 8 matrix multiplicatios (2 for each line)?
    hoping some valuable comments
    sym_coder

  2. #2
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    288

    Re: 3D transformations how gl does?

    opengl matrices work on vertices.
    the number of matrix-vector mults so depends on how many verts you pass, wich in turn depends on how you want something drawn.

    in your case, i would draw the W this way:
    Code :
    glBegin( GL_LINE_STRIP );
    glVertex2f( -2,1  );
    glVertex2f( -1,-1 );
    glVertex2f(  0,1  );
    glVertex2f(  1,-1 );
    glVertex2f(  2,1  );
    glEnd();
    wich has 5 verts, so opengl will do 5 matrix-vector mults.

    but you can also unwisely do:
    Code :
    glBegin( GL_LINES );
    glVertex2f( -2,1  );   glVertex2f( -1,-1 );
    glVertex2f( -1,-1 );   glVertex2f(  0,1  );
    glVertex2f(  0,1  );   glVertex2f(  1,-1 );
    glVertex2f(  1,-1 );   glVertex2f(  2,1  );
    glEnd();
    same final result, but 8 matrix-vector mults...
    Dolo/\/\ightY

Posting Permissions

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