顯示具有 05161145_洪毓謙 標籤的文章。 顯示所有文章
顯示具有 05161145_洪毓謙 標籤的文章。 顯示所有文章

2018年6月4日 星期一

week15 1000

學期內容回顧

Week1

(1)GLUT 專案
(2)跑OpenGL專案

Week2

(1)GLUT專案
(2)茶壺


Week3 

移動 旋轉 縮放
(1)跑Transformation.exe
(2) glutSolidTeapot(半徑)
      glutSolidSphere(半徑 切 切 ) 
      glutSolidCone(半徑 切 切)


Week4 

Rotate 矩陣

Week5 

T-R-T 指定軸

Week6 

glm 3D模型
#include "glm.h"
GLM*pmodel= NULL;
畫圖:
if (pmodel=NULL)
{
  glmRead OBJ(".....")

}

Week7 

小心CodeBlocks專案&Setting-compiler
work-dir射程"."libfreeglut.dll

Week 8 

打光 陣列

Week 10 

貼圖 Open CV 安裝openCV
                                        設目錄

Week 11

Keyboard 配 PlaySound ()
變鍵盤鋼琴
mouse    配 PlaySound ()
變射擊遊戲
C MP3_MCI.可播MP3

                                       


2018年5月28日 星期一

week14 1000

作業四Q&A
主題: 攝影機 投影矩陣
實作:gluLookA+() glutReshapeFunc()
期末作品

windows.zip 下載 \ windows \ Projection.exe
data.zip 下載 \ windows \ data \ 模型
glut32.dll 下載 \ windows \ glut32.dll
gluPerspective(fovy, aspect, zNear, zFar)
fovy:張開的角度
aspect:寬常比例
zNeaar:近的裁一刀
zFar:遠的裁一刀

轉茶壺角度
(老師sorry這張圖沒有截好 但是是我自己做的!)

2018年5月21日 星期一

week13 1000

主題:寫檔 讀檔
主題:控制關節
主題:動作內插




float a=0,b=30,c=90;
fprintf(fout,"%.3f %.3f %.3f\n",a,b,c);




茶壺






2018年5月14日 星期一

week12 1000

下載聲音存到C:\Users\user\Desktop\freeglut\bin
  file-New-Project,GLUT專案
(week12_mp3)

#include <mmsystem.h>
int main(int argc, char *argv[])
{
    PlaySound("Shot.wav", NULL, SND_ASYNC);


加入計時器
#include <mmsystem.h>
#include "CMP3_MCI.h"
CMP3_MCI myMP3;
void timer(int t)
{
    glutTimerFunc(2000, timer, 0);
    PlaySound("Shot.wav", NULL, SND_ASYNC);
}
int main(int argc, char *argv[])
{
    ///myMP3.Load("123.mp3");
    ///myMP3.Play();
    .
    .
    .
    .
    .
    glutReshapeFunc(resize);
    glutDisplayFunc(display);
    glutKeyboardFunc(key);
    glutIdleFunc(idle);
    glutTimerFunc(3000, timer, 0);






2018年5月7日 星期一

week11 1000


到wav下載音訊檔
放進 C:\Users\user\Desktop\freeglut\bin
#include <mmsystem.h> 多媒體系統
到140行加入PlaySoundA("madmoo.wav", NULL, SND_ASYNC);
(madmoo是音訊檔名)
有聲音!



要記得把音訊移到hello.music


 case '1':PlaySound("Do.wav",NULL, SND_ASYNC);
            break;
        case '2':PlaySound("Re.wav",NULL, SND_ASYNC);
            break;
        case '3':PlaySound("Mi.wav",NULL, SND_ASYNC);
            break;
        case '4':PlaySound("Fa.wav",NULL, SND_ASYNC);
            break;
        case '5':PlaySound("Sol.wav",NULL, SND_ASYNC);
            break;
        case '6':PlaySound("La.wav",NULL, SND_ASYNC);
            break;
        case '7':PlaySound("Si.wav",NULL, SND_ASYNC);
            break;


彈鋼琴!



2018年4月30日 星期一

week10 1000

 jsyeh.org/3dcg10/ 
下載 data.zip、windows.zip、glut32.dll
把windows.zip解壓縮 把 data.zip、 glut32.dll 移到 windows 資料夾裡 點選Texture.exe











3D地球
讀入會轉的地球
用Notepad++編輯myEarth.cpp
複製freeglut.dll放進myEarth資料夾

地球轉起來

寶藍的地球 讚讚






2018年4月16日 星期一

week08 1000

下載
window.zip
data.zip
glut32.dll
source .zip
換模型,調位子,換Matericl

右鍵 Ruby






隱藏 glutSolidCone(1,1,slices,stacks);
前面加 glutSolidTeapot(1);
(茶壺)

車子






2018年4月9日 星期一

2018年3月26日 星期一

Week05 1000

前往網址: http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/

下載windows / data / glut32.dll
解壓縮 把 data / glut32.dll移到windows

glTranslatef(...);移動下面的旋轉大車子

按滑鼠右鍵[s]


隱藏//glTranslated(-2.4,1.2,-6);
放到glRotated(a,0,0,1); 下排

茶壺

code程式碼
#include <GL/glut.h>

void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glutSolidTeapot(0.3);
    glutSwapBuffers();
}
int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week05step");
    glutDisplayFunc(display);
    glutMainLoop();
}

旋轉的茶壺

code程式碼
#include <GL/glut.h>///開啟GL外掛
#include <stdio.h>
float angle=0;
void motion(int x, int y)
{
    angle=x;///改變angle值
    glutPostRedisplay();///重畫
}
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///清理畫面
    glPushMatrix();
        glRotatef(angle,0,0,1);///轉動
        glutSolidTeapot(0.3);
    glPopMatrix();
    glutSwapBuffers();///秀出東西

}
int main(int argc, char**argv)///主函式
{
   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
   glutCreateWindow("05160400Week5");
   glutMotionFunc(motion);
   glutDisplayFunc(display);
   glutMainLoop();

}
連在一起的茶壺

code程式碼
#include <GL/glut.h>///開啟GL外掛
#include <stdio.h>
float angle=0;
void motion(int x, int y)
{
    angle=x;///改變angle值
    glutPostRedisplay();///重畫
}
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);///清理畫面
    glPushMatrix();
    glutSolidTeapot(0.3);

    glTranslatef(0.5,0.15,0);
        glRotatef(angle,0,0,1);///轉動
        glTranslatef(0.45,-0.08,0);
        glutSolidTeapot(0.3);

    glPopMatrix();///還原矩陣
    glutSwapBuffers();///秀出東西

}
int main(int argc, char**argv)///主函式
{
   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
   glutCreateWindow("05160400Week5");
   glutMotionFunc(motion);
   glutDisplayFunc(display);
   glutMainLoop();

}

2018年3月19日 星期一

Week04 1000

前往網址: http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/

下載windows / data / glut32.dll
解壓縮 把 data / glut32.dll移到windows
座標

案右鍵選可以有足球

還有人,還有其他可以選



把const double a = 0;//t*90.0;
//glRotated(60,1,0,0); 變成註解

旋轉茶壺

跑程式碼的茶壺
多家一行printf("%.1f\n", angle);



#include <stdio.h>
#include <GL/glut.h>
float angle=0, teapotX=0, teapotY=0;///Now2:
int oldX=0, oldY=0, nowRotate=0;///0:translate, 1:rotate
void display()
{
     glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     glPushMatrix();
        glTranslatef(teapotX, teapotY, 0);///Now2
        glRotatef(angle,0,0,1);
        glutSolidTeapot(0.3);
     glPopMatrix();
     glutSwapBuffers();
     ///Now: printf("%.1f\n", angle);/// Now: angle++;
}
void mouse(int button, int state, int x, int y)
{
    if(button==GLUT_LEFT_BUTTON && state==GLUT_DOWN) nowRotate=1;///Now2:
    if(button==GLUT_LEFT_BUTTON && state==GLUT_DOWN) nowRotate=0;///Now2:
    oldX=x; oldY=y;///Now2:
}
void motion(int x, int y)
{///Now:
    angle=x;///Now:
    glutPostRedisplay();///Now:
}
int main(int argc, char*argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Week04 transformation");
    glutMouseFunc(mouse); ///Now: mouse
    glutMotionFunc(motion); ///Now: motion
    ///Now: glutIdleFunc(display);
    glutDisplayFunc(display);
    glutMainLoop();
}