#include<gl/glut.h>
void play(){
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_BACK,GL_LINE);//填充背面
glColor3f(1,0,0);
glRectf(-0.5,0.71,0.5,-0.71);
glFlush();
}
int main(int argc,char **argv){
glutInit(&argc,argv);
glutInitWindowSize(500,500);
glutCreateWindow("矩形");
glClearColor(0,0,1,0.5);
glutDisplayFunc(play);
glutMainLoop();
}
glPolygonMode(GL_BACK,GL_LINE);//填充背面
结果画面是一个只有红色边的矩形
如果把这句改成glPolygonMode(GL_FRONT,GL_LINE);//填充正面
结果出现一个填充满的红色矩形
这我怎么回事?
void play(){
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_BACK,GL_LINE);//填充背面
glColor3f(1,0,0);
glRectf(-0.5,0.71,0.5,-0.71);
glFlush();
}
int main(int argc,char **argv){
glutInit(&argc,argv);
glutInitWindowSize(500,500);
glutCreateWindow("矩形");
glClearColor(0,0,1,0.5);
glutDisplayFunc(play);
glutMainLoop();
}
glPolygonMode(GL_BACK,GL_LINE);//填充背面
结果画面是一个只有红色边的矩形
如果把这句改成glPolygonMode(GL_FRONT,GL_LINE);//填充正面
结果出现一个填充满的红色矩形
这我怎么回事?