2016年3月1日 星期二

WEEK02

作業 01
step 1 : 從網址下載: sorce , date , win32 ,glut32.dll ( jsyeh.org/3dcg10 )

1.調整顏色glColor3f(1,0,0);
(紅,綠,藍)

程式碼

#include<GL/glut.h>  //標頭檔
void display()
{
     glColor3f(1,0,0);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}
int main(int argc,char**argv)
{
    glutInit(&argc, argv);  //引入程式
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);  //雙視窗
    glutCreateWindow("hello 3D");  //視窗名稱
    glutDisplayFunc(display);  //展示
    glutMainLoop();
}

調整背景
#include <GL/glut.h>
void display()
{
    glClearColor(1,1,0,0);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1,0,0);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
}
int main(int argc ,char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello 3D");
    glutDisplayFunc(display);
    glutMainLoop();
}

沒有留言:

張貼留言