/* Demo of drawing points Implemented Fall 2005 Scott D. Anderson */ #include #include const int NUM_POINTS = 8; // Vertices for quads have to be given in counterclockwise order // These vertices make flat quads. twTriple points[NUM_POINTS] = { {0,0,0}, {1,0,0}, {2,1,0}, {3,3,0}, {3,3,3}, {2,4,2}, {-1,6,0}, {0,5,1}, }; void drawPicture() { glBegin(GL_QUADS); twColorName(TW_RED); glVertex3fv(points[0]); glVertex3fv(points[1]); glVertex3fv(points[2]); glVertex3fv(points[3]); twColorName(TW_GREEN); glVertex3fv(points[4]); glVertex3fv(points[5]); glVertex3fv(points[6]); glVertex3fv(points[7]); glEnd(); } void display(void) { twDisplayInit(); twCamera(); drawPicture(); glFlush(); glutSwapBuffers(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); twInitWindowSize(500,500); glutCreateWindow(argv[0]); glutDisplayFunc(display); twVertexArray(points, NUM_POINTS); // determines bounding box from array twMainInit(); glutMainLoop(); return 0; }