Hi, I am really new to OpenGL,
I draw the polygon using the code below:
glBegin(GL_LINE_LOOP);
glVertex2f(10.0f, 10.0f);
glVertex2f(10.0f, 50.0f);
glVertex2f(30.0f, 80.0f);
glVertex2f(50.0f, 80.0f);
glVertex2f(30.0f, 50.0f);
glVertex2f(50.0f, 20.0f);
glVertex2f(30.0f, 30.0f);
glEnd();
But when I change the coding above to:
glBegin(GL_POLYGON);
glVertex2f(10.0f, 10.0f);
glVertex2f(10.0f, 50.0f);
glVertex2f(30.0f, 80.0f);
glVertex2f(50.0f, 80.0f);
glVertex2f(30.0f, 50.0f);
glVertex2f(50.0f, 20.0f);
glVertex2f(30.0f, 30.0f);
glEnd();
The polygon shape is changed. Can anyone help me in this. I try to fix the problem for a long time, but I still can’t solve the problem. I hope anyone can help me this.