It seems to be the standart that polygon are drawn in a convex shape. See stackoverflow.com/questions/15556929/open-gl-polygon However it is not for me if I choose it to be filled. How can I have my polygon filled while maintaining the shape I defined?
void drawFloor(){
// White
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // GL_LINE works the way I want it too
//glDisable(GL_POLYGON_SMOOTH); // has no effect :(
glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(0, 0, 0); //0
glVertex3f(2*boxSize, 0, 0); //1
glVertex3f(2 * boxSize, -boxSize, 0); //2
glVertex3f(5 * boxSize, -boxSize, 0); //3
glVertex3f(5 * boxSize, 4 * boxSize, 0); //4
glVertex3f(6 * boxSize, 4 * boxSize, 0); //5
glVertex3f(6 * boxSize, 6 * boxSize, 0); //6
glVertex3f(0 * boxSize, 6 * boxSize, 0); //7
glVertex3f(0 * boxSize, 2 * boxSize, 0); //8
glVertex3f(1 * boxSize, 2 * boxSize, 0); //9
glVertex3f(1 * boxSize, 4 * boxSize, 0); //10
glVertex3f(2 * boxSize, 4 * boxSize, 0); //11
glVertex3f(2 * boxSize, 3 * boxSize, 0); //12
glVertex3f(3 * boxSize, 3 * boxSize, 0); //13
glVertex3f(3 * boxSize, 2 * boxSize, 0); //14
glVertex3f(2 * boxSize, 2 * boxSize, 0); //15
glVertex3f(2 * boxSize, 1 * boxSize, 0); //16
glVertex3f(0, 1 * boxSize, 0); //17
glEnd();
}
This code results in:
http://postimg.org/image/o4wt9ij33/ with GL_LINE
http://postimg.org/image/l31fltgkf/ with GL_FILL
I want only the inside of the polygon filled, keeping the shape of the version with the GL_LINE. I did not expect the output of GL_FILL to be so different.
What I want (created with MS paint):
http:// postimg.org/image/d3gbf613d/
I am using Win7+ Visula studio express2013+ Renderer Intel HD Graphics Version: 3.1.0 - Bulid 8.15.10.2509+ GLSL Version 1.40
See Question&Answers more detail:
os