2022電腦圖學 Computer Graphics 授課教師: 葉正聖 銘傳大學資訊傳播工程系 每週主題: 程式環境、點線面顏色、移動/旋轉/縮放與矩陣(Matrix)、階層性關節轉動(T-R-T)、做出機器人、打光、貼圖、glu/glut函式、鍵盤、滑鼠、計時器(timer)、讀入3D模型、粒子系統、聲音、特效、投影矩陣、攝影機與運鏡、機器人2.0、期末作品
2022年3月29日 星期二
2022年3月22日 星期二
2022年3月15日 星期二
電腦圖學課堂筆記week04
week04
2.下載data.zip和win32.zip
3.windows.zip ->Transformation.exe
4.data.zip->模型.obj
5.執行Transformation.exe
2022年3月8日 星期二
電腦圖學課堂筆記week03
1.連結http://jsyeh.org/3dcg10/
2.下載data.zip和win32.zip
3.windows.zip ->Transformation.exe
4.data.zip->模型.obj
5.執行Transformation.exe
右鍵更換模型
拖曳滑鼠改變數值
移動
#include<GL/glut.h>
void MyTeaPot(float x, float y)
{
glPushMatrix();
glTranslatef(x, y, 0);
glColor3f(1, 1, 0);
glutSolidTeapot(0.3);
glPopMatrix();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
MyTeaPot(0.5, 0.5);
MyTeaPot(0.5, -0.5);
MyTeaPot(-0.5, -0.5);
MyTeaPot(-0.5, 0.5);
glutSwapBuffers();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week03");
glutDisplayFunc(display);
glutMainLoop();
}
Mouse1
Mouse2
#include<GL/glut.h>
#include <stdio.h>
float mouseX=0, mouseY=0;
void myTeapot(float x, float y)
{
glPushMatrix();
glTranslatef(x, y, 0);
glColor3f(1, 1, 0);
glutSolidTeapot(0.1);
glPopMatrix();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
myTeapot((mouseX-150)/150.0, -(mouseY-150)/150.0);
glutSwapBuffers();
}
void mouse(int button, int state, int x, int y)
{
printf("%d %d %d %d\n", button, state, x, y);
mouseX=x;
mouseY=y;
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week03");
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutMainLoop();
}
2022年3月1日 星期二
電腦圖學課堂筆記week02
2022年2月22日 星期二
電腦圖學課堂筆記Week01
OpenGL
1.安裝freegult
2.把桌面freegult的lib裡面有libfreeglut.a複製,改成libglut32.a
3.Codeblocks選File-New-Project,選GLUT
4.選擇桌面後跑build&run
1.new
2.PUBLIC,ADD README,ADD .gitinore 選C++
4.開啟Git Bash
4.1 cd desktop
4.2 git clone https://網址
4.3 cd 2022graphics1
5.2 cd 2022graphics
5.3 2個程式目錄放到2022graphics
5.4 git status 看狀態
5.5 git add . 加入
5.6 git status 再看狀態(變色)
5.7 git config --global user.email "email"
5.8 git config --global user.name "名字"
5.9 git commit -m "訊息"
5.10 git push 送上雲端 開啟瀏覽器確認
VERY BEAUTIFUL, VERY POWERFUL
一. 一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam, 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...
-
第一個OPENGL程式 0.Codeblocks 17.12 mingw裝好 1.File-New-Project ,選OPENGL專案 2.在[...]的目錄中,選[桌面] Projectsje nir 01_OPENGL 3.下一步,完成後Build&Run 4.可...
-
第一個OpenGL程式 1.安裝好 CodeBlocks 17.12 2. File-New-Project, 選OpenGL專案 2.在[點點點]的目錄中, 選「桌面」,Projectsje nir 01_OPENGL 3.下一步下一步,完成後,Build&Run 4...
-
1. 下載範例 https://jsyeh.org/3dcg10 data.zip windows.zip glut32.dll 2. windows.zip =解壓=> 下載\windows\Shapes.exe data.zip =解壓=> 下載...