看Transformation.exe
下載網站:http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/
下載windows、data、glut32
程式使用方式參考week02
右鍵互換glTranslatef(...)跟glRotatef(..)
![]() |
| 原地旋轉 |

![]() |
| 原地繞圈圈 |
調glRotate比較滑鼠按住上下拖曳
step02:
codeblocks開啟GLUT
開啟方式
尋找glRotate並按照上面互換glTranslatef(...)→改glRotate的值
step03:
自己做一個茶壺旋轉的程式

#include <GL/glut.h>
float angle=0;
void motion(int x, int y)
{
angle=x;
glutPostRedisplay();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle, 0, 0, 1);
glTranslatef(0.45, -0.08, 0);
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week05");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}
step04:多茶壺(茶壺手臂)



沒有留言:
張貼留言