//gradatePolygon //showing the function of gradatePolygon() //A gradated square turns round counter clockwise. //The colors of the vertices are defined and colors //of inner points are interpolated. // T. Kosaka CS TNCT 2001 #include #include #include typedef struct { float x; float y; } point_t; typedef struct { float r; float g; float b; } color_t; void setColor(float red,float green,float blue) { glColor3f(red, green, blue); } void setColor(color_t col) { glColor3f(col.r, col.g, col.b); } 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