#pragma once
#include "GL/glut.h"GLfloat angle = 0.0;void init(){
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
}void reshape(int w, int h){
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (GLfloat)w / (GLfloat)h, 4.0, 20.0);
glMatrixMode(GL_MODELVIEW);
gluLookAt(0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
}void display(){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glPushMatrix();
glRotatef((GLfloat)angle, 0.0 ,1.0, 0.0);
glTranslatef(2.0, 0.0, 0.0);
glutWireSphere(1.0, 20, 16);
glPopMatrix();
glFlush();
glutSwapBuffers();
}我设置了gluPerspective(60.0, (GLfloat)w / (GLfloat)h, 4.0, 20.0)而为什么glPushMatrix();
glRotatef((GLfloat)angle, 0.0 ,1.0, 0.0);
glTranslatef(2.0, 0.0, 0.0);
glutWireSphere(1.0, 20, 16);
glPopMatrix();
后仍然看得到球体,球体不是在平截头体外么?
还有关于gluLookAt,是不是平截头体所在位置是固定的,然后glLookAt设置从不同方向查看?