OpenGL GL_POLYGON concave polygon doesn't color in
问题 I have a problem when I try to use Polygon in OpenGL. I don't know how to explain this but all my vertices are connected with the beginning one. The problem happens when I try to color the object. I want to draw a simple object. void TOP (float x1, float y1, float x2, float h,float n) { float r = x2-x1; if(n==1){glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);} // FOR FILL OR NO FILL OBJECT glBegin(GL_POLYGON); glVertex2f(x1,y1); glVertex2f(x2,y1); glVertex2f(x2,y1+h/7); y1=y1+h/7; glVertex2f(x2-r