为什么四元组没有被渲染出来?我已经尝试使用glOrtho和glFrustrum,输出结果都是黑屏。从我的理解来看,这段代码设置相机位置为(0,0,-3),并且观察原点。近面位于-2(离相机1米远)。我做错了什么?
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
//glOrtho (-5,5,-5,5,-5,5);
glFrustum(-5,5,-5,5,1,1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,-3,0,0,0,0,1,0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_QUADS);
glVertex3f(-0.5,-0.5,-0.5);
glVertex3f(0.5,-0.5,-0.5);
glVertex3f(0.5,0.5,-0.5);
glVertex3f(-0.5,0.5,-0.5);
glEnd();
// Don't wait start processing buffered OpenGL routines
glFlush();
glutSwapBuffers();