kazmalak

11-11-2005, 12:46 AM

I have encountered a strange problem when I was drawing a polygon having 7 vertices. The problem is that when one of the interior angle of the polygon is greater than 180 degrees, the polygon is not correctly drawn at that vertex. The code which I used to draw polygon is below;

glBegin(GL_POLYGON);

glVertex3f(-22.60,0,0);

glVertex3f(-22.60,0,40.49);

glVertex3f(-50,0,40.49);

glVertex3f(-50,0,100);

glVertex3f(50,0,100);

glVertex3f(50,0,27.80);

glVertex3f(24.57,0,0);

glEnd();The second vertex causes this problem.

Does it mean that I always have to draw polygons that have interior angles smaller than 180 degrees?

If so, is there another way to draw these kind of polygons?

glBegin(GL_POLYGON);

glVertex3f(-22.60,0,0);

glVertex3f(-22.60,0,40.49);

glVertex3f(-50,0,40.49);

glVertex3f(-50,0,100);

glVertex3f(50,0,100);

glVertex3f(50,0,27.80);

glVertex3f(24.57,0,0);

glEnd();The second vertex causes this problem.

Does it mean that I always have to draw polygons that have interior angles smaller than 180 degrees?

If so, is there another way to draw these kind of polygons?