2022年3月1日 星期二

AhFatKr的電腦圖學筆記week02



step01-1 跑別人的範例

1. https://jsyeh.org/3dcg10/(下載範例):data.zip,windows.zip,glut32.dll三個檔案

2. windows.zip解壓後=>下載\windows\shapes.exe

    data.zip=先解壓在本的地方,再放進下載\windows\data\模型

    glut32.dll複製後=>下載\windows\glut32.dll

3. 跑shapes.exe 看範例,試試看左按右鍵,右按右鍵功能

step01-2 跑上周的程式

1. 上周的安裝 Git for Windows

2. 上周的Git Bash: cd desktop,git clone 我的網址

3. 上周的安裝 freeglut 改檔名 lib\libglut32.a

4.  在CodeBlocks File-Open week01_GLUT專案,執行!


#include <GL./glut.h>


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)

{

    glutInit(&argc, argv);

    glutInitDisplayMode( GLUT_DOUBLE | GLUT_DEPTH );

    glutCreateWindow("第二週的程式喔!");


    glutDisplayFunc(display);


    glutMainLoop();

}


沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

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