1.示範程式

2.實作


附錄1:今天的程式
#include <GL/glut.h>
float x=0,y=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(x,0,1,0);
//glTranslatef((x-150)/150.0,-(y-150)/150.0,0);
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
void motion(int a,int b)
{
x=a;y=b;
display();
}
int main(int argc,char ** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week4");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}






沒有留言:
張貼留言