很好,我的短期失憶症又更嚴重了
1.複習旋轉
(其實老師在中間講了有關數學的運作,但我突然失意以致我忘了)
2.實作
附錄:今天的程式
#include <GL/glut.h>
float angle=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(0,0.5,0);
glutWireTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslatef(0.52,0.63,0.0);
glRotatef(angle,0,0,1);
glTranslatef(0.6,0.0,0.0);
glRotatef(-90,0,1,0);
glutWireCone(0.1,0.6,10,10);
glPopMatrix();
glutSwapBuffers();
}
void motion(int x,int y)
{
angle=x;
display();
}
int main(int argc,char ** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week10");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}
沒有留言:
張貼留言