glBegin(GL_TRIANGLES);
glVertex3f(0.0f,0.0f,0.0f); //1
glVertex3f(0.0f,0.3f,0.0f); //2
glVertex3f(0.4f,0.3f,0.0f); //3
glEnd();
在使用opengl的时候这句话一直就显示不了,并不是因为背景颜色,也不是因为线的颜色,其实是因为环绕方式有问题。
顺时针:图像的背面,不能显示
逆时针:图像的正面,可以显示
这三个点正好组成了顺时针,于是显示不了图片。
若改成
glBegin(GL_TRIANGLES);
glVertex3f(0.0f,0.0f,0.0f); //1
glVertex3f(0.4f,0.3f,0.0f); //3
glVertex3f(0.0f,0.3f,0.0f); //2
glEnd();
就变成了逆时针,于是就到了正面,就可以看到图像。
还有一点是,可以用这个解决:
glFrontFace(GL_CW);