#include <GL/glut.h>
float a=0;
float angle=0;
float angle01d=0;
float angleNew=90;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle,0,0,1);
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
void keyboard(unsigned char key , int x, int y)
{
if (key=='r')
{
a+=0.1;
angle = angle01d * (1-a) + angleNew *a;
}
glutPostRedisplay();
}
int main()
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week15");
glutKeyboardFunc(keyboard);
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言