2022年4月26日 星期二

´◔౪◔)Morning Star

 Week 10圖學筆記

今日主題:貼圖

#先將上周的project 的cv 10行程式碼複製到新project

#重新做OpenCV設定

    0-1. seting-compiler-serch directories-compiler-add inclode



    0-2. seting-compiler-serch directories-linker-add lib


    0-3. seting-compiler-linker setttings-add咒語 (cv210/cxcore210/highgui210)

    0-4. 再把圖檔放進工作目錄中 (in c:\Users...\freeglut\bin)

#做成背景貼圖,黏在四個點上 (從左下,逆時針繞圈圈)

    完成了

#把上週貼圖貼到圓球上

    1. 開新GLUT專案 (week10_texture_earth)

    2. 貼上前面的程式並加上以下程式碼

        main() : sphere=gluNewQuadric();///準備好二次曲面

        GLUquadric *sphere =  NULL;

        display() : gluQuadricTexture(sphere,1);///設好貼圖、 gluSphere(sphere,1,30,30);///畫圓球

    3. 畫圓球

        3-0. 圓球的座標要用 cos()、sin() 算出來

        3-1. 會用到以下函式

                a. OpenGL (GL) 的函式

                b. OpenGL Utilities (GLU) 的函式 ex: gluSphere(一個指標, r指標, slices經線(直), stacks緯

                    線)

                c. OpenGL User Toolkit (GLUT) 的函式 ex: gluSolidTeapot()

#把地球旋轉

    1. 新增旋轉程式碼在 dispaly() 裡

    2. 在 main() 新增 glutIdleFunc(display); 才能動喔

    3. 再新增一次rotatef在display()裡,把他轉正

    4. 一定要在main()裡,新增glEnable(GL_DEPTH_TEST);///開3D深度測試,才會有3D的效果


#主題三 貼3D模型

    1. 下載 jsyeh.org/3dcg10 的 window、data、source(glm.h、glm.cpp) 放在專案目錄
    2. 開新專案 (week10_texture_model)
    3. 工作目錄裡要放 Gundam 模型

~~~下課了~~~

沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

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