建置工作
將glm.c和glm.h拉入建立我們所資料夾內修改glm.c-->glm.cpp
到資料夾內開啟附檔名標示1
到資料夾內開啟附檔名標示2
將window-->data內的posche.mtl和posche.obj複製到freeglut內
開始畫3d
6行#include "glm.h"
GLMmodel* pmodel = NULL;
void display()
{
glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL);
glFlush();
}
int main(int argc, char **argv)
{
pmodel = glmReadOBJ("porsche.obj");
glmUnitize(pmodel);
glmFacetNormals(pmodel);
glmVertexNormals(pmodel, 90.0);
glutInit(&argc, argv);
glutCreateWindow("3D");
glutDisplayFunc(display);
glutMainLoop();
}
GLfloat pos[]={0.0,0.0,-1.0,0.0};
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);///打光
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);///打光
沒有留言:
張貼留言