int main(int argc, char** argv) GLUT_RGB); glutCreateWindow("OpenGL 2 Fixed Function"); glutDisplayFunc(display); glutMainLoop(); return 0;
Here’s a minimal working example in C (GLUT/FreeGLUT):
For those who didn't start there, OpenGL 2 introduced the shader model (1.10/1.20) and still fully supported the fixed-function pipeline. But in practice, most people associate "OpenGL 2" with immediate mode ( glBegin/glEnd ), glVertex , glMatrixMode , and lighting via glLight .
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0, 2, 5, 0, 0, 0, 0, 1, 0);
glutSwapBuffers();
#include <GL/glut.h> void display() GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES); glColor3f(1,0,0); glVertex3f(-1,-1,0); glColor3f(0,1,0); glVertex3f( 1,-1,0); glColor3f(0,0,1); glVertex3f( 0, 1,0); glEnd();