Home arrow C and C+ arrow OpenGL Notes
OpenGL Notes PDF
Thursday, 31 March 2011
OpenGL Functions
glRotatef(angle, x, y, z); 
// will rotate an object with angle, using axis x,y,x
glScalef(x,y,z);     // will scale an object with x,y,z
glPushMatrix();  // save the transformation state (can't use between glBegin() and glEnd()
                            // we can save with glPushMatrix() multiple transformations saves, up to 32
glPopMatrix();   // pop (restore) the transformation state (it uses the stack to push and pop transformation states

glTranslatef(x, y, z); // note that you can't call glTranslatef between glBegin() and glEnd()

glutPostRedisplay();    // tell glut that the scene was changed and must be redraw
glClearColor(r, g, b, alpha);     // sets the background color

When debugging an OpenGL program if your objects does not move as you desire check also the coordinates of vertices of your objects. If one of those coordinates is wrong you might think it is a bat translate or rotate coordinate which is not always the case.

glMatrixMode(GL_PROJECTION); works only when resizing windows. Please note that light does not move with this transformation and we will not use it for camera angle.
Last Updated ( Thursday, 31 March 2011 )

Other BSD Systems





Best BSD firewall?