2024年5月27日 星期一

哈囉你好嗎隨便 week15

安裝 OpenCV 和設定 CodeBlocks

1. 安裝 OpenCV

  1. 安裝過程中勾選 Add PATH (第二個選項)。
  2. 將 OpenCV 安裝在預設目錄。

2. 設定 CodeBlocks

  1. 打開 CodeBlocks,進入 Settings -> Compiler
  2. 重啟 CodeBlocks。
  3. View -> Start Page 找到原本的檔案。
  4. Settings -> Compiler -> Search directories 添加以下目錄:
    • Compiler: C:\OpenCV2.1\include
    • Linker: C:\OpenCV2.1\lib
  5. Linker settings 中添加以下項目:
    • cv210
    • cxcore210
    • highgui210



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();


我們需要最下面的mainLoop 來卡住程式不要太快結束









## 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();
}

改成這樣 確定有畫出模型就可以把背景顏色刪掉










沒有留言:

張貼留言