hw01
使用glPushMatrix();//備份
glPopMatrix();//還原
glTranslatef(x,y,z);//移動位置
HW02
使用滑鼠移動物件
設float mouseX,mouseY=0;
display改
glTranslatef(mouseX,mouseY,0);
設一個移動函式
void motion(int x,int y)
{
mouseX=(x-150)/150.0;
mouseY=-(Y-150)/150.0;
glutPostRedisplay();
}
在int main()加一個
glutMotionFunc(motion);
HW03
把glTranslatef(mouseX,mouseY,0)改成glScalef(mouseX,mouseY,0)則縮放
HW04
旋轉圖案
設一個float rotX;
寫一行glRotatef(rotX,0,0,1);(旋轉角度,X,Y,Z軸)
在motion加一個 rotX=x;
沒有留言:
張貼留言