安裝 OpenCV 和設定 CodeBlocks
1. 安裝 OpenCV
- 安裝過程中勾選
Add PATH(第二個選項)。 - 將 OpenCV 安裝在預設目錄。
2. 設定 CodeBlocks
- 打開 CodeBlocks,進入
Settings->Compiler。 - 重啟 CodeBlocks。
- 在
View->Start Page找到原本的檔案。 - 在
Settings->Compiler->Search directories添加以下目錄:Compiler:C:\OpenCV2.1\includeLinker:C:\OpenCV2.1\lib
- 在
Linker settings中添加以下項目:cv210cxcore210highgui210
freeglut複製 32搞定
https://github.com/jsyeh/2024graphicsb
https://github.com/jsyeh/2024graphicsb
https://github.com/jsyeh/2024graphicsb
https://github.com/jsyeh/2024graphicsb
https://github.com/jsyeh/2024graphicsb
隨時可以拿老師的
1.全刪,只寫1行
cpp>>>>>>>>>>>>>>>>>>
#incclude<windows.h>
#include <GL/glut.h>
int main()
{
PlaySound (""filename.wav", NULL, SND_SYNC")
/////等待播完音樂才結束
}
就...音樂^^
要找wav檔
路徑下面會跟你講
2.mp3檔用的
CMP3_MCT.h要include
File-New-Project, GLUT專案,week15-2 CMP3 MCI
老師準備了 CMP3 MCI.h傳給你,請放在桌面的 week15-2 CMP3 MCI 目錄裡
因為wav檔案太大很難找到 所以貼一個檔案之後就可以讀入mp3檔案
開啟glut範例檔案 保留 177行 不要刪掉 中間插入四行
在main函式前面插入兩行
#include "CMP3_MCI.h"
CMP3_MCI myMP3;
裡面插入
myMP3.Load("123.mp3");
myMP3.Play();
## week15-3_mouse_motion_glTranslatef_glRotatef
要讓物體可以左右移動位置
先寫完11行程式 再去改
#include <GL/glut.h>
void display(){
glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glutSwapBuffers();
}
int main()(int argc,char**argv){
glutInit(&argc, argv);
glutInitDisplayMode((GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week15-3");
glutDisplayFunc(display);
glutMainLoop();
}
改成這樣 確定有畫出模型就可以把背景顏色刪掉
沒有留言:
張貼留言