//drawPolygon //showing the function of drawPolygon() //A square turns round counter clockwise. // T. Kosaka CS TNCT 2001 #include #include #include typedef struct { float x; float y; } point_t; void setColor(float red,float green,float blue) { glColor3f(red, green, blue); } void drawDot(int x,int y) { glBegin(GL_POINTS); glVertex2i(x, y); glEnd(); } void drawLine(int x1, int y1, int x2, int y2) { int dx,dy,dx2,dy2,x,y,inc,c,tmp; dx=0<=x2-x1?x2-x1:x1-x2; dy=0<=y2-y1?y2-y1:y1-y2; dx2=dx<<1;dy2=dy<<1; if (dy<=dx) { if (x2