TODO:下載 jsyeh.org/3dcg10
1.
下載 [source] [data] [win32] [glut32.dll]
windows -- 桌面/2016GG/exe檔
data.zip -- 桌面/2016GG/data/*.obj *.mtl
glut32.dll -- 桌面/2016GG/glut32.dll
source.zip -- {glm.h、glm.c、transformation.c} 用Notepad++看

課堂作業二:
1.
File-New-Project 貝殼

2.
將data、glm.h、glm.cpp、transformation.cpp加入專案中(要先改為cpp)

3.
目錄C:\Users\USER\Desktop\freeglut\include
目錄C:\Users\USER\Desktop\freeglut\lib


4.
Build Uptions 加咒語
freeglut
opengl32
glu32
gdi32
winmm

5.
執行(左上角是灰色的話,拉一下視窗即可)

課堂作業三:
TODO:用課堂(2)舊專案(有咒語、有目錄)
1.
Remove刪除transformation.cpp
再File-New-EmptyFile 存myModel.cpp(加入專案)
2.
程式碼
#include "glm.h"
GLMmodel * pmodel=NULL;
void display()
{
if (!pmodel) {
pmodel = glmReadOBJ("data/porsche.obj");
if (!pmodel) exit(0);
glmUnitize(pmodel);
glmFacetNormals(pmodel);
glmVertexNormals(pmodel, 90.0);
}
glmDraw(pmodel,GLM_SMOOTH | GLM_MATERIAL);
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("3D Model ready YA!");
glutDisplayFunc(display);
glutMainLoop();
}

沒有留言:
張貼留言