/* Demo of drawing points Implemented Fall 2005 Scott D. Anderson */ #include #include const int NUM_POINTS = 8; twTriple points[NUM_POINTS] = { {0,0,0}, {1,0,0}, {2,1,0}, {3,3,1}, {3,3,3}, {2,4,2}, {0,5,1}, {-1,6,-2}, }; void drawPicture() { glBegin(GL_TRIANGLE_STRIP); twColorName(TW_RED); glVertex3fv(points[0]); glVertex3fv(points[1]); glVertex3fv(points[2]); twColorName(TW_GREEN); glVertex3fv(points[3]); twColorName(TW_BLUE); glVertex3fv(points[4]); twColorName(TW_YELLOW); glVertex3fv(points[5]); twColorName(TW_CYAN); glVertex3fv(points[6]); twColorName(TW_MAGENTA); 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; }