2022年3月1日 星期二

ఠ_ఠ week02

 Week02

(1)載檔案

1-1.到https://jsyeh.org/3dcg10 下載 [data] [win32][glut32.dll]



1-2.windows.zip =解壓=> 開Shapes.exe

     data.zip =解壓=> 拉到windows

     glut32.dll =複製=> windows

1-3.跑Shape.exe看範例

     左按右鍵選單:頂點,顏色

     右按右鍵選單:point ...polygon


(2)跑Git hub

2-1. cd desktop --> git clone https://github.com/ajie4jellyfish/2022graphics1 --> cd 2022graphics1


(3)GLUT_COLOR

3-1. File-New-Project , 開GLUT

3-2. 設定freeglut

3-3. 程式碼全刪

3-4. 

#include <GL/glut.h> ///GLUT外掛,簡化程式

void display()

{

    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glColor3f(1,1,0); ///設定色彩

    ///glutSolidTeapot(0.3); ///實心茶壺

    glBegin(GL_POLYGON);

        glColor3f(1,0,0);

        glVertex2f(-1,-1);


        glColor3f(0,1,0);

        glVertex2f(+1,-1);


        glColor3f(0,0,1);

        glVertex2f(0,+1);

    glEnd();

    glutSwapBuffers();///畫好交換出來

}

int main(int argc,char**argv)///main()主函式進階版

{

    glutInit(&argc,argv);///參數給glutInit初始化

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);///雙緩衝區+3D深度功能

    glutCreateWindow("week02程式");

    glutDisplayFunc(display); ///顯示函式

    glutMainLoop();///主要程式迴圈

}




沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...