先放一下运行效果:
代码:
/*************************************************************
*Project Name: 实验4-???-???
*Description:
*Author: lishichengyan
*Student ID: ???
*Date: 2017.11.24
**************************************************************/
#include <stdlib.h>
#include "gl/glut.h"
#include <stdio.h>
#include <string.h>
#include "stanford_bunny.h"
#define MAX 16
int rNum=1;//兔子数量,如果可以被4整除要换行
float eye[] = {0, 4, 6};
float center[] = {0, 0, 0};
float fDistance = 0.2f;
float fRotate = 0;
bool bAnim = false;
bool bDrawList = false;
GLint tableList = 0;
GLint rabbitList = 0;
/*用来绘制灰色的、位置正确的兔子。封装成一个函数*/
void draw_good_rabbit()
{
for(int i=1;i<=rNum;i++)
{
if(bDrawList)//如果是列表模式,通过callList的方式来调用
{
glCallList(rabbitList);
}
else//否则直接画
{
DrawBunny();
}
if(i%4==0)//换行
{
glTranslatef(2.0f,0.0f,-0.5f);
}
else//平移
{
glTran