https://www.youtube.com/watch?v=OvJzlYQdwvw
2017電腦圖學 Computer Graphics 授課教師: 葉正聖 銘傳大學資訊傳播工程系 每週主題: 程式環境、點線面顏色、移動/旋轉/縮放與矩陣(Matrix)、階層性關節轉動(T-R-T)、做出機器人、打光、貼圖、glu/glut函式、鍵盤、滑鼠、計時器(timer)、讀入3D模型、粒子系統、聲音、特效、投影矩陣、攝影機與運鏡、機器人2.0、期末作品
2017年6月30日 星期五
2017年6月12日 星期一
04162532_黃郁嵐,Week14
一.
1.介紹今天內容,直播
2.示範myEarth.zip和freeglut.zip
先安裝opencv2.1
glEnable(GL_DEPTH_TEST); ///要啟動 Detph Test 深度值的測試,3D顯示才正確
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();///自動轉很帥
glBegin(GL_POLYGON);
glTexCoord2f(0,0);glVertex3f(-1,+1,0);
glTexCoord2f(1,0);glVertex3f(+1,+1,0);
glTexCoord2f(1,1);glVertex3f(+1,-1,0);
glTexCoord2f(0,1);glVertex3f(-1,-1,0);
glEnd();
出現地球貼圖
將地球儀設為機器人背景
調亮
glEnable(GL_TEXTURE_2D);
glDisable(GL_POLYGON);
.
.
.
.
glDisable(GL_TEXTURE_2D);
glEnable(GL_POLYGON);
1.介紹今天內容,直播
2.示範myEarth.zip和freeglut.zip
先安裝opencv2.1
![]() |
| 新增說明文字 |
glEnable(GL_DEPTH_TEST); ///要啟動 Detph Test 深度值的測試,3D顯示才正確
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();///自動轉很帥
glBegin(GL_POLYGON);
glTexCoord2f(0,0);glVertex3f(-1,+1,0);
glTexCoord2f(1,0);glVertex3f(+1,+1,0);
glTexCoord2f(1,1);glVertex3f(+1,-1,0);
glTexCoord2f(0,1);glVertex3f(-1,-1,0);
glEnd();
出現地球貼圖
將地球儀設為機器人背景
調亮
glEnable(GL_TEXTURE_2D);
glDisable(GL_POLYGON);
.
.
.
.
glDisable(GL_TEXTURE_2D);
glEnable(GL_POLYGON);
2017年6月5日 星期一
04162532_黃郁嵐,Week13
一.
用Excel使用內差公式
alpha*新+(1-x)*舊
交叉相乘
二.
04160391_robot.zip解壓縮
裝freeglut.bulid
(1)內插公式的函式加入
(2)Timer函式準備好
三.
寫檔案
#include <stdio.h>
FILE * fout=NULL;
FILE * fin=NULL;
.
.
.
.
.
if(key=='s'||key=='S')
{
if(fout==NULL){
fout=fopen("file.txt","w+");
printf("現在我產生一個file.txt的檔案在目錄裡面喔\n");
}
fprintf(fout,"%.3f %.3f %.3f %.3f %.3f\n",angle[0],angle[1],angle[2],angle[3],angle[4]);
printf("現在我把一些數字印到檔案裡面%.3f %.3f %.3f %.3f %.3f\n",angle[0],angle[1],angle[2],angle[3],angle[4]);
}
if(key=='r'||key=='R')
{
if(fin==NULL){
fin=fopen("file.txt","r");
}
fscanf(fin,"%f %f %f %f %f",&angle[0],&angle[1],&angle[2],&angle[3],&angle[4]);
glutPostRedisplay();
}
}
用Excel使用內差公式
alpha*新+(1-x)*舊
交叉相乘
二.
04160391_robot.zip解壓縮
裝freeglut.bulid
(1)內插公式的函式加入
(2)Timer函式準備好
三.
寫檔案
#include <stdio.h>
FILE * fout=NULL;
FILE * fin=NULL;
.
.
.
.
.
if(key=='s'||key=='S')
{
if(fout==NULL){
fout=fopen("file.txt","w+");
printf("現在我產生一個file.txt的檔案在目錄裡面喔\n");
}
fprintf(fout,"%.3f %.3f %.3f %.3f %.3f\n",angle[0],angle[1],angle[2],angle[3],angle[4]);
printf("現在我把一些數字印到檔案裡面%.3f %.3f %.3f %.3f %.3f\n",angle[0],angle[1],angle[2],angle[3],angle[4]);
}
if(key=='r'||key=='R')
{
if(fin==NULL){
fin=fopen("file.txt","r");
}
fscanf(fin,"%f %f %f %f %f",&angle[0],&angle[1],&angle[2],&angle[3],&angle[4]);
glutPostRedisplay();
}
}
2017年5月22日 星期一
04162532_黃郁嵐,Week12
一.計時器
在main()
1.glutDisplayFunc(display);
glutTimerFunc(0,timer,0);
2.void timer(int t)
{
glutTimerFunc(10,timer,t+1);
angle++;
glutPostRedisplay();
}
在main()
1.glutDisplayFunc(display);
glutTimerFunc(0,timer,0);
2.void timer(int t)
{
glutTimerFunc(10,timer,t+1);
angle++;
glutPostRedisplay();
}
2017年5月15日 星期一
04162532_黃郁嵐,Week11
一.老師示範小考
glPushMatrix(); 10%
glTranslatef(0.4,0.5,0); 20%
glRotatef(30,0,0,1); 20%
glTranslatef(0.5,0.3,0); 20%
drawArm(); 20%
glPopMatrix(); 10%
二.
1.下載opencv
2.使用codeblocks讀圖檔
執行結果:
三.轉動的地球
1.下載freeglut解壓縮檔至桌面
2.存地球圖片
執行結果:
將圓形改成茶壺形狀:
glPushMatrix(); 10%
glTranslatef(0.4,0.5,0); 20%
glRotatef(30,0,0,1); 20%
glTranslatef(0.5,0.3,0); 20%
drawArm(); 20%
glPopMatrix(); 10%
二.
1.下載opencv
2.使用codeblocks讀圖檔
執行結果:
三.轉動的地球
1.下載freeglut解壓縮檔至桌面
2.存地球圖片
執行結果:
將圓形改成茶壺形狀:
2017年5月8日 星期一
04162532_黃郁嵐,Week10
一.
1.到jsyeh.org/3dcg10下載
data.zip->桌面\windows\data\模型.obj
windows.zip->桌面\windows\projection.exe
glut32.dll->桌面\windows\glut32.dll
將data解壓縮檔和glut32.dll放進windows解壓縮檔
點選projection
在codeblocks打開04160011_hw1_projection並執行
修改eyeX,eyeY,eyeZ
修改center,up
1.到jsyeh.org/3dcg10下載
data.zip->桌面\windows\data\模型.obj
windows.zip->桌面\windows\projection.exe
glut32.dll->桌面\windows\glut32.dll
將data解壓縮檔和glut32.dll放進windows解壓縮檔
點選projection
在codeblocks打開04160011_hw1_projection並執行
修改eyeX,eyeY,eyeZ
修改center,up
2017年5月1日 星期一
04162532_黃郁嵐,Week09
一.組合機器人
1.下載3d exploration
2.開啟3d exploration
3.到jsyeh.org/3dcg10下載data壓縮檔
4.在3d exploration打開data解壓縮檔
5.將模型存成cpp檔
6.在codeblocks打開
匯出openGL Sample app
刪除main.c
sources按右鍵add files
點選data中的程式碼
執行程式碼時無法執行時將過舊的程式碼註解
執行通過:
7.收到檔案
(1)myGLMsample.zip
(2)data.zip
(3)source.zip->glm.c,glm,h,transformation.c
(4)freeglut.zip
海豚分開顯示
結果:
1.下載3d exploration
2.開啟3d exploration
3.到jsyeh.org/3dcg10下載data壓縮檔
4.在3d exploration打開data解壓縮檔
5.將模型存成cpp檔
6.在codeblocks打開
匯出openGL Sample app
刪除main.c
sources按右鍵add files
點選data中的程式碼
執行程式碼時無法執行時將過舊的程式碼註解
執行通過:
7.收到檔案
(1)myGLMsample.zip
(2)data.zip
(3)source.zip->glm.c,glm,h,transformation.c
(4)freeglut.zip
海豚分開顯示
結果:
訂閱:
文章 (Atom)






















































