2016年5月10日 星期二

week 12 賀冠傑

下載 jsyeh.org/3dcg10

1.

windows -- 桌面/2016GG/exe檔

data.zip -- 桌面/2016GG/data/*.obj *.mtl

glut32.dll -- 桌面/2016GG/glut32.dll

source.zip -- {glm.h、glm.c、transformation.c} 

2.
C -> C++ 檔

Add files




設定 Build options





3.
Remove  "transformation.cpp"
Add files "myModel.cpp"

程式碼
#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();
}


沒有留言:

張貼留言