1.Transformation
網址:http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/(1)到上面網址下載data 、win32 、glut.32dll重複week2的動作
(2)開啟Transformation
(3)可在裡面控制位置(Translate)、角度(Rotatef)、大小(Scale)
(4)按右鍵可更換物體

2.讓茶壺移動
(1)按照week01的動作下載好freeglutfile >new >project >點 glut project >go>改名子>選擇freeglut資料夾
(2)移動茶壺程式碼:
這是錯誤的!!
執行出來的茶壺會有多個分身
正解如下!!!
#include <GL/glut.h>
void display()
{
glPushMatrix();///備份矩陣,保護好
glTranslatef(0.2,0.2,0);///移動x,y,z
glutSolidTeapot(0.3);
glPopMatrix();///還原矩陣保護好
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("translate");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言