hw01
照之前步驟開啟
2.source.zip拉進
3.glm.h\glm.c案右鍵(用Notepad++開)
hw02
1.修改附檔名
glm.cpp
transformation.cpp
2.開啟貝殼專案
設定目錄
include
lib
ADD Link setting
freeglut
opengl32
glu32
gdi32
winmm
3.拉進專案資料夾
date
glm.cpp
glm.h
transformation.cpp
freeglut.dall
4.Add files to progect...
選取
glm.cpp
transformation.cpp
5.成功執行
hw03
Maya匯出3D模型
使用glm讀OBJ
#include <GL/glut.h>
#include "glm.h"
GLMmodel * pmodel=NULL;
void display()
{
glClearColor(0,1,1,0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
if(!pmodel)
{
pmodel=glmReadOBJ("data/porsche.obj");
if(!pmodel) exit(0);
glmUnitize(pmodel);
glmFacetNormals(pmodel);
glmVertexNormals(pmodel,90.0);
}
glPushMatrix();
glRotatef(180,0,1,0); ///轉180度
glmDraw(pmodel,GLM_SMOOTH|GLM_MATERIAL);
glPopMatrix();
glutSwapBuffers();
}
GLfloat pos[]={0.0,0.0,-1.0,0.0};
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("GLM model is great!");
glutDisplayFunc(display);
glLightfv(GL_LIGHT0,GL_POSITION,pos); ///加燈光
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST); ///加深度測試
glutMainLoop();
}
pmodel=glmReadOBJ("data/AL.obj");///換模型








沒有留言:
張貼留言