顯示具有 04160453_蔡明諺 標籤的文章。 顯示所有文章
顯示具有 04160453_蔡明諺 標籤的文章。 顯示所有文章

2017年5月9日 星期二

Week12-蔡明諺

HW1 mp3

1.開啟helllo world專案
(1) #include "CMP3_MCI.h"///(1) 放在同一個程式碼專案的目錄中哦
(2) CMP3_MCI myMP3;       ///(2) 宣告一個變數,叫 myMP3
在 main()函式裡面
(3) myMP3.Load                   ///(3)("C:\\dropbox\\yukai.mp3"); /// "C:/dropbox/yukai.mp3"
(4) myMP3.Play();                /// (4) Play the file

 

2017年4月25日 星期二

Week 10

WEEK 10

HW1

1.去http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/夏在檔案

2.用右鍵Notepad++開啟 soccerball.obj soccerball.mtl

3.myGLMsample.zip解壓縮 並執行

HW2

1.Google:NeHe Lesson 32 射擊遊戲  lesson32.zip解壓縮  執行lesson32.exe

玩遊戲

HW3

1.#include <mmsystem.h>

2.void mouse(int button, int state,int x,int y);

{

    PlaySound("檔名",NULL, SND_ASYNC);

}

3.在main()裡面 glutCreateWindow()之後glutMouseFunc(mouse);

2017年4月11日 星期二

Week08-04160453

Week08

HW1 茶壺打光

1.比照之前下載glut檔案並在Codeblocks打開

2.刪除程式

3.輸入程式出現茶壺

glPushMatrix();
        
    
      glutSolidTeapot(0.3);
    glPopMatrix();

4.刪除鍵盤程式

5.留下Light display含式

6.結果如下

HW2 讓茶壺選轉

輸入 
float angle=0;
angle++;
glRotatef(0,1,0);

HW3  各種形狀

1.輸入 glutSolidSphere( 半徑, 柳丁切,堆疊)



2017年3月21日 星期二

Week5 明諺的日常

Week05

1.登入http://irs.zuvio.com.tw/student/clickers/37585回答上周的問題

2.下載http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/

data.zip-------桌面\windows\data\模型

windows.zip-----桌面\windows\Transformation.exe

glut32.dll------------桌面\windows\glut32.dll






3.茶壺 Translate Rotate Scale

#include <GL/glut.h>
void display()
{
    glPushMatrix();   ///備份起來
        glTranslatef(0, 0, 0);
        glutSolidTeapot(0.3);
    glPopMatrix();   ///還原回去

    glutSwapBuffers(); ///交換繪圖的 memory buffer,才能畫出來
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("04160453 translate rotate scale");


    glutDisplayFunc(display);

    
    
    glutMainLoop();
}

移動

輸入float mouseX=0, mouseY=0; 


輸入mouseX, mouseY


輸入

void motion(int x,int y)

{

    mouseX = (x-150)/150.0;

    mouseY =-(y-150)/150.0;

    glutPostRedisplay();  貼一張3M Post便利貼,告訴電腦的Glut要重畫畫面的Re display

}


輸入glutMotionFunc(motion);


程式執行會像小畫家的橡皮擦

加入glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);   清掉舊畫面

縮放

輸入 glScalef(mouseX, mouseY, 0);  縮放目標大小



旋轉

輸入 rotX=0     glRotatef(rotX, 0,0,1);   rotX = x;

2017年3月7日 星期二

Week03-----明諺的日常

HW1下載檔案

1.進入http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/

2.下載[data][win32] glut32.dll 三個檔案

3.把剛剛下載的[data][win32]解壓縮並把檔案都放進windows資料夾

HW2茶壺變色

1.先完成Week01的茶壺

2.輸入glColor3f( r , g , b );  (rgb要輸入數字小於等於1,如果數字大於1要/255.0)

HW3 glBegin含式

1.留下Week01十行的程式

#include <GL/glut.h>


static void display(void)
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   

    glutSwapBuffers();
}




int main(int argc, char *argv[])
{
    glutInit(&argc, argv);


    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("GLUT Shapes");


    glutDisplayFunc(display);

    glutMainLoop();

    return EXIT_SUCCESS;
}

2.在static void display(void)韓式裡輸入


 glBegin(GL_POLYGON);

        glColor3f(1,0,0);
        glVertex3f(0,0,0);

        glColor3f(0,1,0);
        glVertex3f(1,1,0);

        glColor3f(0,0,1);
        glVertex3f(-1,1,0);


    glEnd();
 ( glColor3顏色  glVertex3f位置)

3.

2017年2月21日 星期二

Week01 明諺的日常

  HW_1    截圖

   網址:  http://madebyevan.com/webgl-water/
  HW_2    GULT
                                   
 Codeblocks opengl
 打開: Codeblocks file>new>project>openGL 
 (要貯存在記得的地方)


  Codeblocks glut
 打開: Coblocks file>new>project>GLUT project
 (要貯存在記得的地方)
打開前先去facebook社團下在freeglut
把程式成這樣9行
(要可以執行)
#include <GL/glut.h>


static void display(void)
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   

    glutSwapBuffers();
}




int main(int argc, char *argv[])
{
    glutInit(&argc, argv);


    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("GLUT Shapes");


    glutDisplayFunc(display);

    glutMainLoop();

    return EXIT_SUCCESS;
}


輸入
static void display(void)
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glutSolidTeapot(0.3);

    glutSwapBuffers();
}
完成如圖