void motion(int x, int y)
{
myAngle = x;
glutPostRedisplay();
}
static void display(void)
{
const double t = glutGet(GLU
T_ELAPSED_TIME) / 1000.0;
const double a = myAngle;
#include <GL/glut.h>
float myAngle=0;
void motion (int x, int y)
{
myAngle = x;
glutPostRedisplay ();
}
void display()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix ();
glRotatef (myAngle, 0,0,1);
glutSolidTeapot( 0.3 );
glPopMatrix ();
glutSwapBuffers ();
}
int main (int argc, char ** argv)
{
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow ("week04");
glutDisplayFunc (display);
glutMotionFunc (motion);
glutMainLoop();
}


沒有留言:
張貼留言