shading model – FLAT/SMOOTH
shademodel.cpp
if (shading == GL_FLAT)
glShadeModel(GL_FLAT);
else if (shading == GL_SMOOTH)
glShadeModel(GL_SMOOTH);
glPushMatrix();
glTranslatef(-1.0, 0.0, 0.0);
glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0); // red
glVertex3f(-1, -1, 4);
glColor3f(0, 1, 0); // green
glVertex3f(1, -1, 4);
glColor3f(0, 0, 1); // blue
glVertex3f(0, 1, 4);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(1.0, 0.0, 0.0);
glBegin(GL_TRIANGLES);
glColor3f(0, 0, 1); // blue
glVertex3f(-1, -1, 4);
glColor3f(0, 1, 0); // green
glVertex3f(1, -1, 4);
glColor3f(1, 0, 0); // red
glVertex3f(0, 1, 4);
glEnd();
glPopMatrix();