2016年3月8日 星期二

Week 03 陳心瑜

一、
1. 請試跑教材範例 jsyeh.org/3dcg10 裡的範例
    下載data,win32,gult32.dll
2. 請做出有點線面色彩的程式
----
POINTS

 LIINES

 LINE_LOOP

LINE_STRIP

二、
1.開啟codeblocks 點選GLUT project
2.去資料夾複製網址C:\Users\USER\Desktop\freeglut-MinGW-2.8.1-1.mp\freeglut
3.開啟GLUT新增Project>修改程式碼>做出有顏色的多邊形
4.Color可以改三角型顏色(看小畫家的顏色要/255.0)
(反黑部分按Tab)
(逗點 , 後面+空格)

程式碼:
#include <GL/glut.h>
void display()
{
    ///glutSolidTeapot(0.3);
    glBegin(GL_POLYGON);
        glColor3f(1, 1, 0);
        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(1.0, 0.0, 0.0);
        glVertex3f(1.0, 1.0, 0.0);
    glEnd();

    glutSwapBuffers();
}
int main(int argc, char**argv)
{

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello");

    glutDisplayFunc(display);
    glutMainLoop();
}

#include <GL/glut.h>
void display()
{
    ///glutSolidTeapot(0.3);
   glClearColor(2, 2, 2, 2);
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
glColor3f(47/255.0,122/255.0,215/255.0);
        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(1.0, 0.0, 0.0);
        glVertex3f(1.0, 1.0, 0.0);
    glEnd();

    glutSwapBuffers();
}
int main(int argc, char**argv)
{

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello");

    glutDisplayFunc(display);
    glutMainLoop();
}

#include <GL/glut.h>
void display()
{
    glClearColor(0.5,0.8,1.0,1);
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
      glColor3f(0, 0, 1);  glVertex3f(0.0, 0.0, 0.0);
      glColor3f(0, 0.5, 0.2);  glVertex3f(1.0, 0.0, 0.0);
      glColor3f(1, 1, 0);  glVertex3f(1.0, 1.0, 0.0);
    glEnd();

    glutSwapBuffers();
}
int main(int argc, char**argv)
{

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello");

    glutDisplayFunc(display);
    glutMainLoop();

}

三、
1.以小畫家設定形狀顏色座標
2.滑鼠點擊印出程式



沒有留言:

張貼留言