2018年4月9日 星期一

Week07_+0筆記

http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/   下載data解壓縮
安裝3DExplorer_v181.rar3DExplorer_v181.rar 開啟data

安裝 執行
 jsyeh.org/3dcg10
data.zip--->桌面/data/一堆3D模型
=> 用3D Explorer 開3D模型
    


創專案將source.zip中的glm.c glc.h transformation.c放入專案資料夾

新增檔案

取消設定勾選

加入DATA在freeglut資料加BIN中

重新編譯



三讀入3D模型


#include "glm.h"///(1)glm的外掛
GLMmodel *pmodel=NULL;///(2)指標
void display()
{
 glClear(GL_COLOR_BUFFER_BIT|GL_COLOR_BUFFER_BIT);///清畫面

    if (!pmodel) {
pmodel = glmReadOBJ("data/porsche.obj");///(3)這段負責畫3D的模型
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("WEEK07");
    glutDisplayFunc(display);
    glutMainLoop();
}

                                           

沒有留言:

張貼留言