在OpenGL中使用多边形平滑时,在多边形内部出现了一些虚线,如在图像中可以看到的那样:
我的代码如下:
glEnable(GL_POLYGON_SMOOTH)
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST)
glPolygonMode(GL_FRONT, GL_FILL)
glPolygonMode(GL_BACK, GL_LINE)
glLineWidth(5)
glBegin(GL_QUADS)
glVertex3f(0.1, 0.1, 0)
glVertex3f(0.2, 0.1, 0)
glVertex3f(0.2, 0.2, 0)
glVertex3f(0.1, 0.2, 0)
glEnd()
glDisable(GL_POLYGON_SMOOTH)
为什么会发生这种情况,我该如何解决?