2016年5月9日 星期一

小屈男神今天累掛又破褲

作業1:

jsyeh.org/3dcg10 下載 win32.zip 、 data.zip 、 glut32.dll
transform可開啟測試使用

作業2:
開啟貝殼專案

輸入~~~~

咒語

刪除main檔案

作業3:
打上程式碼後執行
(程式碼)
#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();
}

照片白是因為沒有改
(亮度、探測深度和角度)
#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);
    }
    glPushMatrix();
        glRotatef(150, 0,1,0);
        glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL);
    glPopMatrix();

    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("GLM model is great!");
    glutDisplayFunc(display);

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

    glutMainLoop();
}


沒有留言:

張貼留言