Setting ModelView matrix using rotate, translate, etc.. vs setting manual matrix

Posted by guymic on Stack Overflow See other posts from Stack Overflow or by guymic
Published on 2010-04-13T00:09:16Z Indexed on 2010/04/13 0:12 UTC
Read the original article Hit count: 320

Filed under:
|
|

When setting the ModelView matrix you normally go through several transformations from the identity matrix. for example:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(270.0f, 0.0f, 0.0f, 1.0f);
glTranslatef(-rect.size.height / 2, -rect.size.width / 2, 0.0f);

Instead of doing those operations one after the other (assume there are more than two), wouldn't it be more efficient to simply pre-calculate the resulting matrix and set the ModelView matrix to this manual matrix?

© Stack Overflow or respective owner

Related posts about opengl

Related posts about opengl-es