2015年6月11日 星期四

20150513_譚崇彣_HW10

#include "glm.h"            ///引入glm.h和glm.c(要copy到目錄)
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("carrrrrrrrr!!");
    glutDisplayFunc(display);
    glutMainLoop();
}


打燈

#include "glm.h"
GLMmodel * pmodel = NULL;

void display(){
    GLfloat pos[] = {0.0, 0.0, -1.0, 0.0};
    glLightfv(GL_LIGHT0, GL_POSITION, pos);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    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("carrrrrrrrr!!");
    glutDisplayFunc(display);
    glutMainLoop();
}

沒有留言:

張貼留言