2021年6月7日 星期一

電腦圖學 week13

 

到moodle下載OpenCV-2.1.0-win32-vs2008.exe
下載的時候要選第2個 Add OpenCV to PATH(執行的目錄之一)
位置用預設的 C:\OpenCV2.1
安裝完再重開codeblocks



        在codeblocks的setting點選Compiler

      Search directories 

        Compiler   C:\OpenCV2.1\include

        Linker  C:\OpenCV2.1\lib


在Linker setting 加入3個檔案
cv210   cxcore210   highgui210
鋼彈圖片加入桌面/freeglut/bin
https://hackmd.io/@jsyeh/opengl有 貼圖範例程式


把 freeglut\bin 的 freeglut.dll copy到專案目錄 week13.01
       把 Diffuse.jpg 及 bg.jpg 移到專案目錄 week13.01

到week13.01裡面貼上
 week13.01\week13.01.cbp 專案檔打開
       兩個working_dir 要改成 "."  再存檔
從source.zip選取glm.c ,glm.h,transformation.c複製到week13.01

gundam還沒切開.zip裡Gundam.mtl , Gundam.obj , Diffuse.jpg複製到week13.01


glm.c改成glm.cpp
 開 transformation.c 複製裡面的程式
 1.  #include "glm.h"
 2.     GLMmodel * pmodel = NULL;
 
3. 再 copy drawmodel() 的函式, 改glmReadOBJ("
Gundam.obj") 及 改右邊 glmDraw(... GLM_TEXTURE) , 並在 display()裡叫 drawmodel()



圖檔Diffuse.jpg看起來需要上下反過來, 可用小畫家幫忙,存檔後再執行即可


先整體旋轉 glPushMatrix(); glRotatef(角度, 0,1,0); 畫圖; glPopMatrix();




沒有留言:

張貼留言

距地表面160 Week11

 #include "glm.h" GLMmodel* pmodel = NULL; void drawmodel(void) {     if (!pmodel) { pmodel = glmReadOBJ("data/porsche.obj...