// Modified from one of the GLUT sample files by Mark Kilgard simple.c #include #include "glut.h" using namespace std; void display(void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); glColor3f(0.0, 0.0, 1.0); // blue glVertex2f(-0.5, -0.5); glVertex2f(0.0, 1.0); glColor3f(0.0, 1.0, 0.0); // green glVertex2f(0.0, 1.0); glVertex2f(0.5, -0.5); glColor3f(1.0, 0.0, 0.0); // red glVertex2f(0.5, -0.5); glVertex2f(-0.5, -0.5); glEnd(); glFlush(); } int main(int argc, char **argv) { glutInit(&argc, argv); glutCreateWindow("triangle"); glutDisplayFunc(display); glutMainLoop(); return 0; }