2024-06-03 Week16
1. 主題: camera 攝影機2. 主題: Projection 投影
3. 主題: 兩張貼圖
4. 主題: glmUnitize() vs. 自己調整大小
5. 期末作品 vs. 作業3
##先用上課的課本教材
1.data.zip
2.windows.zip=>下載\windows\Projection.exe
了解 gluLookAt(eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ);
##week16-0_sample
先設好今天的上課環境
0.安裝freeglut
1.安裝 OpenCV2.1
2.重開 CodeBlocks,設定opencv的3個設定
3.File-New-Project,GLUT專案 week16-0_sample
##week16-1_sample_glutLookAt
1.把剛剛 week16-0整個目錄 ,複製成week16-1
2.複製後,改目錄名 改.cbp專案
我們的眼睛: 0 , 0 , 0
要看的主角: -2.4 , 1.2 , -6
我們的up向量: 0 , 1 , 0
我們要注入的函示, 是:
glutReshapeFunc(resize);
##week16-2_teapot_glutLookAt_glutR
10行程式碼:
#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("week16-2");
glutDisplayFunc(display);
glutMainLoop();
}
gluOrhto(左,右,下,上,進,遠) ;
gluPerspective(張角 ,長寬比 ,遠 ,近) ;
gluFrustum(左, 右, 下, 上, 進, 遠) ;
##week16-3_myTexture_id1_id2_glBindTexture
若想要有『兩張貼圖』(一張背景、一張給模型)
1.File-New-Project,GLUT專案week16-3_myTexture_id1_id2_glBindTexture
2.偷用week05_rotating_earth/main.cpp 裡的程式碼








沒有留言:
張貼留言