2021年5月3日 星期一

week11-NMSL

 1.File-New-Project,GLUT專案(把freeglut準備好)

2.source.zip 裡 :glm.h放專案:桌面week11-model

3.glm.c(改成glm.cpp),放專案:豬面week11-model

4.在CodeBlocks裡,左邊Add File,glm.cpp加入

5.接著打自己的程式碼左出車子
#include "glm.h"
GLMmodel* pmodel = NULL;

void drawmodel(void)
{
    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);
}
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    drawmodel();
    glutSwapBuffers();
}
int main(int argc,char** argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week11");

    glutDisplayFunc(display);
    glutMainLoop();
}
6.整合打光
7.copy上週的「打光的陣列」
8.copy上週的「打光的設定」
9.調光的位置(z的正負改一下)
10.模型轉到正面




沒有留言:

張貼留言

Week18期末作業(橘貓的跳舞熊熊)

 期末作業(橘貓的跳舞熊熊) 影片: https://youtu.be/R89tptMaQZw 程式碼: #include <opencv/highgui.h> #include <opencv/cv.h> #include <GL/glut.h...