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
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:
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:
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…