2016年3月1日 星期二

Week02 林庭亘

課堂作業 1
教材:jsyeh.org/3dcg10

下載[data] [win32[glut32.dll]
解壓縮在桌面

打開Shapes

開啟新的glut
先打10行程式

#include <Gl/glut.h>

void display()
{
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello");
    glutDisplayFunc(display);
    glutMainLoop();
}



改變茶壺的顏色和背景顏色
多加3行
#include <Gl/glut.h>

void display()
{
    glColor3f(0,0,1);//藍色
    glClear(GL_COLOR_BUFFER_BIT);//清背景
    glClearColor(1,1,0,0);//黃色背景
    glutSolidTeapot(0.3);//茶壺
    glutSwapBuffers();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello");
    glutDisplayFunc(display);
    glutMainLoop();
}








沒有留言:

張貼留言