[data] 和 glut32.dill 解壓縮到window資料夾
➤移動 旋轉 放大縮小
#include <GL/glut.h>
float angle=0;
void display()///gl開頭表示gl的程式
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef( 0, 0.5, 0);
glutWireTeapot(0.3);
glPopMatrix();
glPushMatrix();
glTranslatef(0.51, 0.63, 0);
glRotatef(angle,0,0,1);
glTranslatef(0.6,0,0);
glRotated(-90,0,1,0);
glutWireCone( 0.1, 0.6, 10, 10);
glPopMatrix();
glutSwapBuffers();
}///gl開頭表示GLUT的程式
void motion(int x, int y)
{
angle =x;
display();
}
int main(int argc, char**argv)///高手的main的參數
{
glutInit(&argc, argv);///啟動GLUT
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);///啟動GLUT的Display的Mode模式: 兩倍的Buffe
glutCreateWindow("week10");
glutDisplayFunc(display);///Display的函式
glutMotionFunc(motion);
glutMainLoop();
}


沒有留言:
張貼留言