Carmine

10-05-2012, 09:51 PM

Suppose this is the Display function for a very simple OpenGL, GLUT, program.

How many matrices would this put on the matrix stack?

I used to think it would be 4. However, now I'm leaning towards 1,

which would be the product of the (Identity matrix) x (the Translation Matrix) x

(the Rotation matrix) x (the Scale Matrix).

void Display (void)

{

glMatrixModel (GL_MODELVIEW);

glLoadIdentity ();

glTranslatef (5,3,1);

glRotatef (30, 1,0,0);

glScalef (2.1, 1.0, 2.1);

glBegin (GL_POINTS);

glVertex2d (5,2);

glEnd ();

}

Thanx.

How many matrices would this put on the matrix stack?

I used to think it would be 4. However, now I'm leaning towards 1,

which would be the product of the (Identity matrix) x (the Translation Matrix) x

(the Rotation matrix) x (the Scale Matrix).

void Display (void)

{

glMatrixModel (GL_MODELVIEW);

glLoadIdentity ();

glTranslatef (5,3,1);

glRotatef (30, 1,0,0);

glScalef (2.1, 1.0, 2.1);

glBegin (GL_POINTS);

glVertex2d (5,2);

glEnd ();

}

Thanx.