WEEK05_教學主題
旋轉&移動
教材做SWAP交換
mouse轉動
階層式旋轉、移動
課堂(一)
開啟Transformation
glTranslatef 移動
glRotatef 旋轉
glScalef 縮放
程式由下往上跑
A) 以車子為中心點移動
先放大
旋轉
再移動
glBegin => glScalef => glTranslatef => glRotatef
B) 右鍵Swap translate/rotate
以鍋子為中心點來旋轉
mouse轉動
#include<GL/glut.h>
void motion(int x,int y)
{
}
void display()
{
glClearColor(0,0,1,1);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DEPTH);
glutCreateWindow("hello3D");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}
#include<GL/glut.h>
void motion(int x,int y)
{
}
void display()
{
glClearColor(0,0,1,1);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DEPTH);
glutCreateWindow("hello3D");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}

課堂(三)
Q1 Buffer?
Q2 Double?








沒有留言:
張貼留言