(用键盘函数实现茶壶的旋转与停止旋转;茶壶的平行投影和透视投影切换;茶壶线框模式切换)
(q旋转与停止旋转;w投影的切换;e线框模式的切换;d退出)
#include <stdlib.h>
#include <GL/glut.h>
float fTranslate;//整体平移因子
float fRotate = 0.0f;//整体旋转因子
float tRotate = 0.0f;//茶壶旋转因子
bool tAnim = false;//茶壶旋转
bool bPersp = false;//渲染
bool bAnim = false;//整体旋转
bool bWire = false;//填充、线框
int wHeight = 0;
int wWidth = 0;
float place[] = { 0, 0, 5 };
void Draw_Scene()
{
glPushMatrix();//当前矩阵压栈
glTranslatef(place[0], place[1], place[2]);//平移,放在桌面上的高度
glRotatef(90, 1, 0, 0); //茶壶绕x轴旋转的角度
glRotatef(tRotate, 0, 1, 0);
glScalef(1.8,1.8, 1.8);
glutSolidTeapot(5);//size
glPopMatrix();
}
void updateView(int width, in