#Week15
##week15-1_PlaySound
0.安裝freeglut
1.新增File-New-Project,GLUT專案week15-1_PlaySound
2.全刪,只寫1行
```cpp
#include<windows.h>
#include<GL/glut.h>
int main()
{
PlaySound("filename.wav",NULL,SND_SYNC);
//等待播完音樂才結束
}
```
去找wav檔(不能是MP3檔)
##week15-2_CMP3_MCI
1.新增File-New-Project,GLUT專案week15-2_CMP3_MCI
2.老師準備了CMP3_MCI.h傳給你,請放在桌面的week15-2_CMP3_MCI目錄裡
```cpp
#include<stdio.h>//為了scanf
#include"CMP3_MCI.h"//記得要用雙引號不能用角括號
CMP3_MCI myMP3;//宣告一個變數,名字叫myMP3
int main()
{
myMP3.Load("filename.mp3");
myMP3.Play();
int a;///幫忙卡住,程式不要快速結束!!!
scanf("%d",&a);
}
```
##week15-2_CMP3_MCI_sample
1.新增File-New-Project,GLUT專案week15-2_CMP3_MCI_sample
2.把CPM3_MCI.h放在同一目錄裡,week15-2_CMP3_MCI_sample裡
3.不要刪177行程式碼範例.我們想共存,請插入
```cpp
#include"CMP3_MCI.h"
CMP3_MCI myMP3;
```
再插入
```cpp
myMP3.Load("filename.mp3");
myMP3.Play();
```
4.要把mp3檔,放在工作執行目錄
##week15-3_mouse_motion_glTranslatef_glRotatef
1.新增File-New-Project,GLUT專案week15-3_mouse_motion_glTranslatef_glRotatef
2.貼上11行GLUT簡單版本(今天不用glm.cpp不用OpenCV)
```cpp
#include<GL/glut.h>
int main(int argc, char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMOde(GLUT_DOUBLE|GLUT_DETPH);
glutCreateWindow("week15-3");
glutDisplayFunc(display);
///等一下會有程式放這裡
glutMainLoop();
}
```
沒有留言:
張貼留言