2016年3月7日 星期一

/Noshiro/點 - 線 - 面

點  glVertex2f (X,Y); (OpenGL 裡的 vertex(點) 兩位變數);
色彩 glColor3f(R,G,B);

到 http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/
下載老師編輯的"data","win32(window系統)",和
"glut32.dll"  將其解壓縮後即可操作一些成品


要製作這個三角形

到先網路找Freeglut
http://www.transmissionzero.co.uk/software/freeglut-devel/
找到MinGW的版本

將其解壓縮後要將"libfreeglut"改成"freeglut32"

然後開Code::blocks來開新專案
選用GLUT
然後

#include <GL/glut.h>
void display()
{

    glBegin(GL_POLYGON);
        //拉出一個多邊形(POLYGON)
        glColor3f(1,1,0);
       //將其填入顏色(R.G.B)
        glVertex2f(0.5,0.5);
        glVertex2f(0.5,-0.5);
        glVertex2f(0,0);
拉出多邊形
    glEnd();
    glutSwapBuffers();
}
int main(int argc,char **argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("hello");

    glutDisplayFunc(display);
    glutMainLoop();
}

基礎黃色多邊形(三角形)
回家作業:
used:小畫家和code::blocks

這是作業中第三題的樣子
用的是小畫家的即興創作

第四題則是Nyan Cat
可是程式碼好多(´・ω・`)

沒有留言:

張貼留言