2016年5月10日 星期二

Week12 林明萱

課堂作業1:

jsyeh/3dcg10

下載 Windows,data,glut32.dll

















將window與data及glut放入資料夾裡
 glm.h glm.c transformation.c 拉出原本資料夾 放到外面的資料夾中


課堂作業2:

開啟新的貝殼專案檔


































Build option

C:\Users\USER\Desktop\freeglut\include

















C:\Users\USER\Desktop\freeglut\lib


















加入freeglut、opengl32 、glu32、gdi32、winmm





































課堂作業3:
#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();
}




將程式碼增加

#include "glm.h"
GLMmodel * pmodel=NULL;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    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("3D Model ready YA!");

    glutDisplayFunc(display);

    glLightfv(GL_LIGHT0, GL_POSITION,pos);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHTING);
    glEnable(GL_DEPTH_TEST);

    glutMainLoop();
}

沒有留言:

張貼留言