下載:01.Windows 02.Data 03.Glut32.dll
然後將Windows解壓縮Data的資料夾直接移入到Windows再把Glut32.dll也移到Windows.
先開啟Transformation:


(用右手比個讚. 可以得知轉的方向)



(可以自己轉它)
拿茶壺做例子:
#include <GL/glut.h>
float myAngle=0;
void motion(int x , int y)
{
myAngle = x;
glutPostRedisplay();
}
void display()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(myAngle, 0,0,1);
glutSolidTeapot( 0.3 );
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week04");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}
(那因為在執行上不像剛剛Transformation一樣的順,會稍微卡卡的,所以我們加了三行程式碼)

沒有留言:
張貼留言