Week03
1.去https://jsyeh.org/3dcg10/下載wimdow.zip和data.zip
然後解壓縮,把wimdow資料夾和data拉近另外一個新資料夾,按transformation.exe執行
2.CodeBlock開一個GLUT的新專案
把第二周的茶壺開出來
4.新增glPushMatrix();
glTranslatef(0.5,0.5,0);
glPopMatrix();
這三行程式碼,改變茶壺的位子。
5.用global變數float X=0,Y=0,Z=0;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);清除背景的程式!
glTranslatef(X,Y,Z);參數改X,Y,Z,
新增關於滑鼠的程式
void mouse(int button, int state, int x,int y)
{
X = (x-150)/150.0;
Y = -(y-150)/150.0;
}
等號左邊大寫,右邊小寫
glutMouseFunc(mouse);設定好mouse函式
沒有留言:
張貼留言