// radial.cpp // Author: Kelly Debure // Program to demonstrate the creation of radially symmetric polygons using triangle fans. #include #include float d=0; const float DEG2RAD = M_PI /180.0; void mydisplay(){ glClear(GL_COLOR_BUFFER_BIT); float degOfrotation=0; glBegin(GL_TRIANGLE_FAN); // make a diamond using a triangle fan primitive glColor3ub(125,255,255); glVertex2f(0,0); float r = 0.5; for(int j=0; j<=360; j+=90){ degOfrotation = j*DEG2RAD; glVertex2f(((cos(degOfrotation)*r)),((sin(degOfrotation)*r))); } glEnd(); glFlush(); } int main(int argc, char** argv){ glutInit(&argc, argv); glutInitWindowSize(500, 500); glutCreateWindow("Radial Symmetry"); glutDisplayFunc(mydisplay); glutMainLoop(); return 0; }