2017年5月9日 星期二

Week12 ─ 沒有最狂只有更狂,狂日記

一、寫一個簡單的MP3撥放程式碼

程式碼如下:

#include "CMP3_MCI.h"           //檔案放同目錄
 CMP3_MCI  myMP3;               //宣告變數
 
int main(....)                  //Load檔案
{                                       
        myMP3.Load("音樂mp3");
        myMP3.Play( );          //Play播放
 
//小心,要卡住;
}
二、調整視角

程式碼如下:

float eyeX=0,eyeY=0,eyeZ=1;
float centerX=0,centerY=0,centerZ=0;
float upX=0,upY=1,upZ=0;
static void display(void)
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3d(1,0,0);
    glPushMatrix();
        gluLookAt(eyeX,eyeY,eyeZ,
                  centerX,centerY,centerZ,
                  upX,upY,upZ);
        glutSolidTeapot(0.3);
    glPopMatrix();
    glutSwapBuffers();
}


沒有留言:

張貼留言