下載教材 jsyeh.org/3dcg10
windows data.zip glut32.dll source.zip→glm.h glm.c transformation.c

以notepad++開啟

課堂作業2
glm.c transformation.c→改成.cpp

codeblocks


include
C:\users\user\Desktop\freeglut\include
lib
C:\users\user\Desktop\freeglut\lib
linker
freeglut
opengl32
glu32
gdi32
winmm


課堂作業3
Remove 刪除 transformation.cpp
再 file-new-empty file(加入專案)
#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();
}
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("car");
glutDisplayFunc(display);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
}




沒有留言:
張貼留言