2016年5月9日 星期一

Liu Workingshop Week XII

(1)Blog內容複習

(2)GLUT基礎元件
   Search Directory目錄 加  C:\Users\USER\Desktop\freeglut\include
   Linker 加 C:\Users\USER\Desktop\freeglut\lib
   
加咒語freeglut / opengl32 / glu32 / gdi32 / winmm
 
程式碼:

#include <GL/glut.h>
#include "glm.h"
GLMmodel * pmodel=NULL;
void display()
{
    glClearColor(1,0,0,0);
    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();
}
int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("GLM model is great!");
    glutDisplayFunc(display);

    glutMainLoop();
}
 

沒有留言:

張貼留言