Professional Documents
Culture Documents
01 - Graphics Programming
01 - Graphics Programming
01 - Graphics Programming
function name
dimensions
glVertex3f(x,y,z)
Most constants are defined in the include files gl.h, glu.h and glut.h
Note #include <GL/glut.h> should automatically include the others
Examples
glBegin(GL_POLYGON)
glClear(GL_COLOR_BUFFER_BIT)
glutMainLoop();
} enter event loop
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
mydisplay function
void mydisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
}
GL_POINTS GL_POLYGON
GL_LINES GL_LINE_STRIP
GL_LINE_LOOP
GL_TRIANGLES
GL_QUAD_STRIP
GL_TRIANGLE_STRIP GL_TRIANGLE_FAN