顯示具有 09160580_曾冠綸 標籤的文章。 顯示所有文章
顯示具有 09160580_曾冠綸 標籤的文章。 顯示所有文章

2022年3月15日 星期二

電腦圖學課堂筆記week04

week04

1.連結http://jsyeh.org/3dcg10/
2.下載data.zip和win32.zip
3.windows.zip ->Transformation.exe
4.data.zip->模型.obj
5.執行Transformation.exe









2022年3月8日 星期二

電腦圖學課堂筆記week03

1.連結http://jsyeh.org/3dcg10/

2.下載data.zip和win32.zip

3.windows.zip ->Transformation.exe

4.data.zip->模型.obj

5.執行Transformation.exe

右鍵更換模型

拖曳滑鼠改變數值

移動

#include<GL/glut.h>

void MyTeaPot(float x, float y)

{

    glPushMatrix();

        glTranslatef(x, y, 0);

        glColor3f(1, 1, 0);

        glutSolidTeapot(0.3);

    glPopMatrix();

}

void display()

{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    MyTeaPot(0.5, 0.5);

    MyTeaPot(0.5, -0.5);

    MyTeaPot(-0.5, -0.5);

    MyTeaPot(-0.5, 0.5);

    glutSwapBuffers();

}

int main(int argc, char** argv)

{

    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("week03");

    glutDisplayFunc(display);

    glutMainLoop();

}



Mouse1

#include<GL/glut.h>
float mouseX=0, mouseY=0;
void myTeapot(float x, float y)
{
    glPushMatrix();
        glTranslatef(x, y, 0);
        glColor3f(1, 1, 0);
        glutSolidTeapot(0.3);
    glPopMatrix();
}
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    myTeapot((mouseX-150)/150.0, -(mouseY-150)/150.0);
    glutSwapBuffers();
}
void mouse(int button, int state, int x, int y)
{
    mouseX=x;
    mouseY=y;
}
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week03");
    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMainLoop();
}

Mouse2

#include<GL/glut.h>

#include <stdio.h>

float mouseX=0, mouseY=0;

void myTeapot(float x, float y)

{

    glPushMatrix();

        glTranslatef(x, y, 0);

        glColor3f(1, 1, 0);

        glutSolidTeapot(0.1);

    glPopMatrix();

}

void display()

{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    myTeapot((mouseX-150)/150.0, -(mouseY-150)/150.0);

    glutSwapBuffers();

}

void mouse(int button, int state, int x, int y)

{

    printf("%d %d %d %d\n", button, state, x, y);

    mouseX=x;

    mouseY=y;

}

int main(int argc, char** argv)

{

    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("week03");

    glutDisplayFunc(display);

    glutMouseFunc(mouse);

    glutMainLoop();

}

2022年3月1日 星期二

電腦圖學課堂筆記week02



1.連結:https://jsyeh.org/3dcg10

2.下載檔案:windows.zip、data.zip、glut32.dll
3.解壓縮windows.zip和data.zip
4.把data解壓縮後的檔案丟進windows資料夾
5.開啟Shapes後測試polygon

6開啟git bash

freeglut更改檔名 lib\libglut32.a
CodeBlocks 開啟 week01_GLUT
1.cd desktop
2.git clone https://github.com/mischieffuyi/2022graphics1
3.cd 2022 graphics1/


2022年2月22日 星期二

電腦圖學課堂筆記Week01

OpenGL

1.安裝CodeBlocks0
2.New porject 選擇OpenGL
3.選擇桌面後跑build&run
4.最後會出現彩色三角形
w1-GLUT

1.安裝freegult

2.把桌面freegult的lib裡面有libfreeglut.a複製,改成libglut32.a 

3.Codeblocks選File-New-Project,選GLUT

4.選擇桌面後跑build&run



Github

1.new

2.PUBLIC,ADD README,ADD .gitinore 選C++

3.安裝Git

4.開啟Git Bash

4.1 cd desktop 

4.2 git clone https://網址

4.3 cd 2022graphics1

複製
5.1 git clone 網址

5.2 cd 2022graphics

5.3 2個程式目錄放到2022graphics

5.4 git status 看狀態

5.5 git add . 加入

5.6 git status 再看狀態(變色)

5.7 git config --global user.email "email"

5.8 git config --global user.name "名字"

5.9 git commit -m "訊息"

5.10 git push 送上雲端 開啟瀏覽器確認 






VERY BEAUTIFUL, VERY POWERFUL

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