Setting ModelView matrix using rotate, translate, etc.. vs setting manual matrix
- by guymic
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?