青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Shuffy

不斷的學(xué)習(xí),不斷的思考,才能不斷的進(jìn)步.Let's do better together!
posts - 102, comments - 43, trackbacks - 0, articles - 19

        本文是整個(gè)系列文章的最后一篇,將創(chuàng)建一個(gè)完整的虛擬office應(yīng)用程序(如圖所示)來(lái)做為ending.

1,CCY457OpenGLView類中加入下述變量,用來(lái)保存office內(nèi)各個(gè)物體的顯示列表

    //Display List Names
    GLuint m_SceneList;
    GLuint m_ComputerList;
    GLuint m_ChairList;
    GLuint m_BlindsList;
    GLuint m_MonitorList;
    GLuint m_BooksList;
    GLuint m_PhoneList;
    GLuint m_DoorList;

2,創(chuàng)建房間內(nèi)部場(chǎng)景


//Create the Display List for the Scene
void CCY457OpenGLView::CreateSceneList()
{
    m_SceneList 
= glGenLists(1);
    glNewList(m_SceneList, GL_COMPILE);
    
/******************Setup Lighting**********************/
    SetupLighting();
    
/***************Draw the Scene*************************/
    
//Draw the Walls
    DrawWalls();            
    
//Draw the Wall Tops, Sides and Desks
    DrawWallTopsAndSides();
    
//Draw the desks
    DrawDesks();
    
//Draw the computers
    DrawComputers();    
    
//Draw the Chairs
    DrawChairs();
    
//Draw the Blinds
    DrawBlinds();
    
//Draw Phones
    DrawPhones();
    
//Draw Floor and Ceiling
    DrawFloorAndCeiling();
    glEndList();
}

3,Obj文件中加載各個(gè)物件的3D模型

//Load all the Models from the Files of type .obj
void CCY457OpenGLView::LoadModelsFromFiles()
{
    GLfloat scalefactor 
= 0.0;
    
//Load Computer from file
    GLMmodel *object1;
    object1 
= glmReadOBJ("Data/models/computer.obj");
    
if(!scalefactor) 
    {
        scalefactor 
= glmUnitize(object1);
    } 
    
else 
    {
        glmScale(object1, scalefactor);
    }
    glmScale(object1, 
1.5);    
    
/* build a display list */
    m_ComputerList 
= glmList(object1, GLM_SMOOTH);
    
/* nuke it, we don't need it anymore */
    glmDelete(object1);    
    
//Load Chair From File
    GLMmodel *object2;
    scalefactor 
= 0.0;
    object2 
= glmReadOBJ("Data/models/chair04.obj");
    
if(!scalefactor) 
    {
        scalefactor 
= glmUnitize(object2);
    } 
    
else 
    {
        glmScale(object2, scalefactor);
    }
    glmScale(object2, 
2.5);    
    
/* build a display list */
    m_ChairList 
= glmList(object2, GLM_SMOOTH);
    
/* nuke it, we don't need it anymore */
    glmDelete(object2);    
    
//Load Blinds Object From File
    GLMmodel *object3;
    scalefactor 
= 0.0;
    object3 
= glmReadOBJ("Data/models/blinds.obj");
    
if(!scalefactor) 
    {
        scalefactor 
= glmUnitize(object3);
    } 
    
else 
    {
        glmScale(object3, scalefactor);
    }
    glmScale(object3, 
1.0);    
    
/* build a display list */
    m_BlindsList 
= glmList(object3, GLM_SMOOTH);
    
/* nuke it, we don't need it anymore */
    glmDelete(object3);    
    
//Load Books Object from file
    GLMmodel *object4;
    scalefactor 
= 0.0;
    object4 
= glmReadOBJ("Data/models/books.obj");
    
if(!scalefactor) 
    {
        scalefactor 
= glmUnitize(object4);
    } 
    
else 
    {
        glmScale(object4, scalefactor);
    }
    glmScale(object4, 
1.2);    
    
/* build a display list */
    m_BooksList 
= glmList(object4, GLM_SMOOTH);
    
/* nuke it, we don't need it anymore */
    glmDelete(object4);    
    
//Load Monitor from file
    GLMmodel *object5;
    scalefactor 
= 0.0;
    object5 
= glmReadOBJ("Data/models/samsung.obj");
    
if(!scalefactor) 
    {
        scalefactor 
= glmUnitize(object5);
    } 
    
else 
    {
        glmScale(object5, scalefactor);
    }
    glmScale(object5, 
0.20);    
    
/* build a display list */
    m_MonitorList 
= glmList(object5, GLM_SMOOTH);
    
/* nuke it, we don't need it anymore */
    glmDelete(object5);    
    
//Load Phone Object from file
    GLMmodel *object6;
    scalefactor 
= 0.0;
    object6 
= glmReadOBJ("Data/models/phone.obj");
    
if(!scalefactor) 
    {
        scalefactor 
= glmUnitize(object6);
    } 
    
else 
    {
        glmScale(object6, scalefactor);
    }
    glmScale(object6, 
0.08);    
    
/* build a display list */
    m_PhoneList 
= glmList(object6, GLM_SMOOTH);
    
/* nuke it, we don't need it anymore */
    glmDelete(object6);        
}

4,創(chuàng)建各個(gè)具體物件的代碼:


void CCY457OpenGLView::DrawPentagonTable()
{
    glBegin(GL_TRIANGLES);
    
//Table Top
    glNormal3f(0.0f,1.0f,0.0f);
    
//Light Brown
    glColor3f(0.7f,0.6f,0.55f);
    glVertex3f(
-0.75f,0.3f,-0.05f);
    glVertex3f(
-0.05f,0.3f,-0.05f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    glVertex3f(
-0.05f,0.3f,-0.05f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.05f,0.3f,-0.05f);
    glVertex3f(
-0.05f,0.3f,-0.75f);
    
//Table Front
    glColor3f(0.9f,0.9f,0.8f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.25f,-0.75f);
    glEnd();
    glDisable(GL_LIGHTING);
    glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
    glPolygonOffset(
1.0f,-3.0f);
    glEnable(GL_POLYGON_OFFSET_LINE);
    
//Front Edge
    glBegin(GL_POLYGON);
    glColor3f(
0.0f,0.0f,0.0f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.25f,-0.75f);
    glEnd();
    glEnable(GL_LIGHTING);
    glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
    glEnable(GL_POLYGON_OFFSET_LINE);
}
void CCY457OpenGLView::DrawWalls()
{
    
//Draw the Walls for which Front Faces can be culled
    
//Cull Front Faces
    
//Enable Culling
    glEnable(GL_CULL_FACE);
    
//Cull Front Faces        
    glCullFace(GL_FRONT);    
    glBegin(GL_TRIANGLES);
    
//Draw the Back Wall
    
//Define Back Wall Normal
    glNormal3f(0.0f,0.0f,1.0f);
    
//Define Back Wall Material - Light Grey
    glColor3f(0.75f,0.75f,0.75f);
    
//Back Wall Triangles
    glVertex3f(0.0f,0.0f,0.0f);
    glVertex3f(
0.0f,1.0f,0.0f);
    glVertex3f(
-5.5f,1.0f,0.0f);
    glVertex3f(
0.0f,0.0f,0.0f);
    glVertex3f(
-5.5f,1.0f,0.0f);
    glVertex3f(
-5.5f,0.0f,0.0f);    
    
//Back Wall Thickness
    glVertex3f(-0.0f,0.0f,-0.05f);
    glVertex3f(
-0.0f,1.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-0.05f);
    glVertex3f(
-0.0f,0.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-0.05f);
    glVertex3f(
-5.5f,0.0f,-0.05f);    
    
//Draw the Right Wall
    
//Define Right Wall Normal
    glNormal3f(1.0f,0.0f,0.0f);
    
//Define Right Wall Material - Light Brown
    glColor3f(0.7f,0.6f,0.55f);
    
//Right Wall Triangles
    glVertex3f(0.0f,0.0f,-0.05f);
    glVertex3f(
0.0f,0.0f,-2.95f);
    glVertex3f(
0.0f,0.6f,-0.05f);
    glVertex3f(
0.0f,0.0f,-2.95f);
    glVertex3f(
0.0f,0.6f,-2.95f);
    glVertex3f(
0.0f,0.6f,-0.05f);
    
//Right Wall Thickness
    glVertex3f(-0.05f,0.0f,-0.05f);
    glVertex3f(
-0.05f,0.0f,-2.95f);
    glVertex3f(
-0.05f,0.6f,-0.05f);
    glVertex3f(
-0.05f,0.0f,-2.95f);
    glVertex3f(
-0.05f,0.6f,-2.95f);
    glVertex3f(
-0.05f,0.6f,-0.05f);
    
//Draw the Left Wall
    
//Define Left Wall Normal
    glNormal3f(-1.0f,0.0f,0.0f);
    
//Left Wall Triangles
    glVertex3f(-5.5f,0.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-2.95f);
glVertex3f(
-5.5f,0.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-2.95f);
    glVertex3f(
-5.5f,0.0f,-2.95f);
    
//Left Wall Thickness
    glVertex3f(-5.45f,0.0f,-0.05f);
    glVertex3f(
-5.45f,1.0f,-0.05f);
    glVertex3f(
-5.45f,1.0f,-2.95f);
    glVertex3f(
-5.45f,0.0f,-0.05f);
    glVertex3f(
-5.45f,1.0f,-2.95f);
    glVertex3f(
-5.45f,0.0f,-2.95f);
    glEnd();
    
//Draw the Pillar
    
//Cull Back Faces for Pillar
    glCullFace(GL_BACK);
    
//Right
    glBegin(GL_POLYGON);        
    glVertex3f(
-3.2f,0.0f,-1.5f);
    glVertex3f(
-3.2f,1.0f,-1.5f);
    glVertex3f(
-3.2f,1.0f,-1.0f);
    glVertex3f(
-3.2f,0.0f,-1.0f);
    glEnd();
    
//Left
    glBegin(GL_POLYGON);
    glVertex3f(
-3.7f,0.0f,-1.5f);
    glVertex3f(
-3.7f,0.0f,-1.0f);
    glVertex3f(
-3.7f,1.0f,-1.0f);
    glVertex3f(
-3.7f,1.0f,-1.5f);
    glEnd();
    
//Front
    glBegin(GL_POLYGON);
    glVertex3f(
-3.2f,0.0f,-1.5f);
    glVertex3f(
-3.7f,0.0f,-1.5f);
    glVertex3f(
-3.7f,1.0f,-1.5f);
    glVertex3f(
-3.2f,1.0f,-1.5f);
    glEnd();
    
//Back
    glBegin(GL_POLYGON);
    glVertex3f(
-3.2f,0.0f,-1.0f);
    glVertex3f(
-3.2f,1.0f,-1.0f);
    glVertex3f(
-3.7f,1.0f,-1.0f);
    glVertex3f(
-3.7f,0.0f,-1.0f);
    glEnd();
    
//Draw the edges
    glColor3f(0.0f,0.0f,0.0f);
    glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
    
//Right
    glBegin(GL_POLYGON);        
    glVertex3f(
-3.2f,0.0f,-1.5f);
    glVertex3f(
-3.2f,1.0f,-1.5f);
    glVertex3f(
-3.2f,1.0f,-1.0f);
    glVertex3f(
-3.2f,0.0f,-1.0f);
    glEnd();
    
//Left
    glBegin(GL_POLYGON);
    glVertex3f(
-3.7f,0.0f,-1.5f);
    glVertex3f(
-3.7f,0.0f,-1.0f);
    glVertex3f(
-3.7f,1.0f,-1.0f);
    glVertex3f(
-3.7f,1.0f,-1.5f);
    glEnd();
    
//Front
    glBegin(GL_POLYGON);
    glVertex3f(
-3.2f,0.0f,-1.5f);
    glVertex3f(
-3.7f,0.0f,-1.5f);
    glVertex3f(
-3.7f,1.0f,-1.5f);
    glVertex3f(
-3.2f,1.0f,-1.5f);
    glEnd();
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    glColor3f(
0.7f,0.6f,0.55f);
    
//Draw the walls for which No faces can be culled
    glDisable(GL_CULL_FACE);
    glBegin(GL_TRIANGLES);
    
//Draw the Front Right Wall            
    
//Define Front Right Wall Normal
    glNormal3f(0.0f,0.0f,-1.0f);
    
//Front Right Wall Triangles
    glVertex3f(0.0f,0.0f,-3.0f);
    glVertex3f(
-3.5f,0.0f,-3.0f);
    glVertex3f(
0.0f,0.6f,-3.0f);
    glVertex3f(
-3.5f,0.0f,-3.0f);
    glVertex3f(
-3.5f,0.6f,-3.0f);
    glVertex3f(
0.0f,0.6f,-3.0f);
    
//Front Right Wall Thickness
    glVertex3f(0.0f,0.0f,-2.95f);
    glVertex3f(
-3.5f,0.0f,-2.95f);
    glVertex3f(
0.0f,0.6f,-2.95f);
    glVertex3f(
-3.5f,0.0f,-2.95f);
    glVertex3f(
-3.5f,0.6f,-2.95f);
    glVertex3f(
0.0f,0.6f,-2.95f);
    
//Draw the Front Left Wall
    
//Front Left Wall Triangles
    glVertex3f(-4.0f,0.0f,-3.0f);
    glVertex3f(
-5.5f,0.0f,-3.0f);
    glVertex3f(
-4.0f,0.6f,-3.0f);
    glVertex3f(
-5.5f,0.0f,-3.0f);
    glVertex3f(
-5.5f,0.6f,-3.0f);
    glVertex3f(
-4.0f,0.6f,-3.0f);
    
//Front Left Wall Thickness
    glVertex3f(-4.0f,0.0f,-2.95f);
    glVertex3f(
-5.5f,0.0f,-2.95f);
    glVertex3f(
-4.0f,0.6f,-2.95f);
    glVertex3f(
-5.5f,0.0f,-2.95f);
    glVertex3f(
-5.5f,0.6f,-2.95f);
    glVertex3f(
-4.0f,0.6f,-2.95f);
    glEnd();
}
void CCY457OpenGLView::DrawWallTopsAndSides()
{
    
//Cull Back Faces
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
    glBegin(GL_TRIANGLES);
    
//Define Normals
    glNormal3f(0.0f,1.0f,0.0f);
    
//Define Material - Light Brown    
    glColor3f(0.7f,0.6f,0.55f);
    
//Back Wall Top
    glVertex3f(0.0f,1.0f,0.0f);
    glVertex3f(
0.0f,1.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,0.0f);
    glVertex3f(
0.0f,1.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,0.0f);
    
//Right Wall Top
    glVertex3f(0.0f,0.6f,-0.05f);
    glVertex3f(
-0.05f,0.6f,-2.95f);
    glVertex3f(
-0.05f,0.6f,-0.05f);
glVertex3f(
0.0f,0.6f,-0.05f);
    glVertex3f(
0.0f,0.6f,-2.95f);
    glVertex3f(
-0.05f,0.6f,-2.95f);
    
//Left Wall Top
    glVertex3f(-5.45f,1.0f,-0.05f);
    glVertex3f(
-5.5f,1.0f,-2.95f);
    glVertex3f(
-5.5f,1.0f,-0.05f);
glVertex3f(
-5.45f,1.0f,-0.05f);
    glVertex3f(
-5.45f,1.0f,-2.95f);
    glVertex3f(
-5.5f,1.0f,-2.95f);
    
//Left Wall Side
    glNormal3f(0.0f,0.0f,-1.0f);
    glVertex3f(
-5.45f,1.0f,-2.95f);
    glVertex3f(
-5.5f,0.0f,-2.95f);
    glVertex3f(
-5.5f,1.0f,-2.95f);
    glVertex3f(
-5.45f,1.0f,-2.95f);
    glVertex3f(
-5.45f,0.0f,-2.95f);
    glVertex3f(
-5.5f,0.0f,-2.95f);
    
//Front Right Wall Top
    glVertex3f(0.0f,0.6f,-2.95f);
    glVertex3f(
0.0f,0.6f,-3.0f);
    glVertex3f(
-3.5f,0.6f,-2.95f);
    glVertex3f(
0.0f,0.6f,-3.0f);
    glVertex3f(
-3.5f,0.6,-3.0f);
    glVertex3f(
-3.5f,0.6f,-2.95f);
    
//Front Left Wall Top
    glVertex3f(-4.0f,0.6,-2.95f);
    glVertex3f(
-4.0f,0.6f,-3.0f);
    glVertex3f(
-5.5f,0.6f,-2.95f);
    glVertex3f(
-4.0f,0.6f,-3.0f);
    glVertex3f(
-5.5f,0.6,-3.0f);
    glVertex3f(
-5.5f,0.6f,-2.95f);
    
//Front Right Wall Left Side
    glNormal3f(-1.0f,0.0f,0.0f);
    glVertex3f(
-3.5f,0.6f,-2.95f);
    glVertex3f(
-3.5f,0.6f,-3.0f);
    glVertex3f(
-3.5f,0.0f,-2.95f);
    glVertex3f(
-3.5f,0.6f,-3.0f);
    glVertex3f(
-3.5f,0.0f,-3.0f);
    glVertex3f(
-3.5f,0.0f,-2.95f);
    
//Front Right Wall Right Side
    glNormal3f(1.0f,0.0f,0.0f);
    glVertex3f(
0.0f,0.0f,-3.0f);
    glVertex3f(
0.0f,0.6f,-2.95f);
    glVertex3f(
0.0f,0.0f,-2.95f);
    glVertex3f(
0.0f,0.0f,-3.0f);
    glVertex3f(
0.0f,0.6f,-3.0f);
    glVertex3f(
0.0f,0.6f,-2.95f);
    
//Front Left Wall Side
    glNormal3f(1.0f,0.0f,0.0f);
    glVertex3f(
-4.0f,0.6f,-3.0f);
    glVertex3f(
-4.0f,0.6f,-2.95f);
    glVertex3f(
-4.0f,0.0f,-3.0f);
    glVertex3f(
-4.0f,0.6f,-2.95f);
    glVertex3f(
-4.0f,0.0f,-2.95f);
    glVertex3f(
-4.0f,0.0f,-3.0f);
}
void CCY457OpenGLView::DrawDesks()
{
    
//Desks
    
//Draw the Front Long Desk
    glNormal3f(0.0f,1.0f,0.0f);
    
//Brown
    glColor3f(0.7f,0.6f,0.55f);
    glVertex3f(
-3.5f,0.3f,-2.55f);
    glVertex3f(
-0.75f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.95f);
    glVertex3f(
-3.5f,0.3f,-2.95f);
    glVertex3f(
-0.75f,0.3f,-2.55f);
    glVertex3f(
-0.75f,0.3f,-2.95f);
    
//Draw the Front Long Desk Thickness
    glVertex3f(-3.5f,0.25f,-2.55f);
    glVertex3f(
-0.75f,0.25f,-2.55f);
    glVertex3f(
-3.5f,0.25f,-2.95f);
    glVertex3f(
-3.5f,0.25f,-2.95f);
    glVertex3f(
-0.75f,0.25f,-2.55f);
    glVertex3f(
-0.75f,0.25f,-2.95f);
    
//Draw the Front Long Desk Front 
    glNormal3f(0.0f,0.0f,1.0f);
    glColor3f(
0.9f,0.9f,0.8f);
    glVertex3f(
-0.75f,0.25f,-2.55f);
    glVertex3f(
-0.75f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.25f,-2.55f);
    glVertex3f(
-3.5f,0.25f,-2.55f);
    glVertex3f(
-0.75f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.55f);
    
//Draw the Front Long Desk Side 
    glNormal3f(-1.0f,0.0f,0.0f);
    glVertex3f(
-3.5f,0.25f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.25f,-2.95f);
    glVertex3f(
-3.5f,0.25f,-2.95f);
    glVertex3f(
-3.5f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.95f);
    
//Draw the Front Short Desk
    glNormal3f(0.0f,1.0f,0.0f);
    glColor3f(
0.7f,0.6f,0.55f);
    glVertex3f(
-4.75f,0.3f,-2.55f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
    glVertex3f(
-4.75f,0.3f,-2.95f);
    glVertex3f(
-4.75f,0.3f,-2.95f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
    glVertex3f(
-4.0f,0.3f,-2.95f);
    
//Draw the Front Short Desk Thickness
    glVertex3f(-4.75f,0.25f,-2.55f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    glVertex3f(
-4.75f,0.25f,-2.95f);
    glVertex3f(
-4.75f,0.25f,-2.95f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    glVertex3f(
-4.0f,0.25f,-2.95f);
    
//Draw the Front Short Desk Front Thickness
    glNormal3f(0.0f,0.0f,1.0f);
    glColor3f(
0.9f,0.9f,0.8f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
    glVertex3f(
-4.75f,0.3f,-2.55f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    glVertex3f(
-4.75f,0.3f,-2.55f);
    glVertex3f(
-4.75f,0.25f,-2.55f);
    
//Draw the Front Short Desk Side Thickness
    glNormal3f(1.0f,0.0f,0.0f);
    glColor3f(
0.9f,0.9f,0.8f);
    glVertex3f(
-4.0f,0.25f,-2.95f);
    glVertex3f(
-4.0f,0.3f,-2.95f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
glVertex3f(
-4.0f,0.25f,-2.95f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    
//Draw the Right Middle Desk 
    glNormal3f(0.0f,1.0f,0.0f);
    glColor3f(
0.7f,0.6f,0.55f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.05f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.3f,-2.25f);
    glVertex3f(
-0.45f,0.3f,-2.25f);
    glVertex3f(
-0.05f,0.3f,-0.75f);
    glVertex3f(
-0.05f,0.3f,-2.25f);
    
//Draw the Right Middle Desk Thickness
    glVertex3f(-0.45f,0.25f,-0.75f);
    glVertex3f(
-0.05f,0.25f,-0.75f);
    glVertex3f(
-0.45f,0.25f,-2.25f);
    glVertex3f(
-0.45f,0.25f,-2.25f);
    glVertex3f(
-0.05f,0.25f,-0.75f);
    glVertex3f(
-0.05f,0.25f,-2.25f);
    
//Draw the Right Middle Desk Front
    glNormal3f(-1.0f,0.0f,0.0f);
    glColor3f(
0.9f,0.9f,0.8f);
    glVertex3f(
-0.45f,0.25f,-0.75f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.25f,-2.25f);
    glVertex3f(
-0.45f,0.25f,-2.25f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.3f,-2.25f);
    
//Draw the Left Middle Desk 
    glNormal3f(0.0f,1.0f,0.0f);
    glColor3f(
0.7f,0.6f,0.55f);
    glVertex3f(
-5.45f,0.3f,-1.15f);
    glVertex3f(
-5.05f,0.3f,-1.15f);
    glVertex3f(
-5.45f,0.3f,-2.25f);
    glVertex3f(
-5.45f,0.3f,-2.25f);
    glVertex3f(
-5.05f,0.3f,-1.15f);
    glVertex3f(
-5.05f,0.3f,-2.25f);
    
//Draw the Left Middle Desk Thickness
    glVertex3f(-5.45f,0.25f,-1.15f);
    glVertex3f(
-5.05f,0.25f,-1.15f);
    glVertex3f(
-5.45f,0.25f,-2.25f);
    glVertex3f(
-5.45f,0.25f,-2.25f);
    glVertex3f(
-5.05f,0.25f,-1.15f);
    glVertex3f(
-5.05f,0.25f,-2.25f);
    
//Draw the Left Middle Desk Front Portion
    glNormal3f(1.0f,0.0f,0.0f);
    glColor3f(
0.9f,0.9f,0.8f);
    glVertex3f(
-5.05f,0.25f,-1.15f);
    glVertex3f(
-5.05f,0.3f,-2.25f);
    glVertex3f(
-5.05f,0.3f,-1.15f);
    glVertex3f(
-5.05f,0.25f,-1.15f);
    glVertex3f(
-5.05f,0.25f,-2.25f);
    glVertex3f(
-5.05f,0.3f,-2.25f);
    
//Draw the Back Wall Desk
    glNormal3f(0.0f,1.0f,0.0f);
    glColor3f(
0.7f,0.6f,0.55f);
    glVertex3f(
-5.45f,0.3f,-0.05f);
    glVertex3f(
-0.75f,0.3f,-0.05f);
    glVertex3f(
-5.45f,0.3f,-0.45f);
    glVertex3f(
-5.45f,0.3f,-0.45f);
    glVertex3f(
-0.75f,0.3f,-0.05f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    
//Draw the Back Wall Desk Thickness
    glVertex3f(-5.45f,0.25f,-0.05f);
    glVertex3f(
-0.75f,0.25f,-0.05f);
    glVertex3f(
-5.45f,0.25f,-0.45f);
    glVertex3f(
-5.45f,0.25f,-0.45f);
    glVertex3f(
-0.75f,0.25f,-0.05f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    
//Draw the Back Wall Desk Front Thickness
    glNormal3f(0.0f,0.0f,-1.0f);
    glColor3f(
0.9f,0.9f,0.8f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    glVertex3f(
-5.45f,0.25f,-0.45f);
    glVertex3f(
-5.45f,0.3f,-0.45f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    glVertex3f(
-5.45f,0.3f,-0.45f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    glEnd();
    
//Desk Front and Side Edges
    glDisable(GL_LIGHTING);
    glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
    glPolygonOffset(
1.0f,-3.0f);
    glEnable(GL_POLYGON_OFFSET_LINE);
    glEnable(GL_POLYGON_SMOOTH);
    
//Front Desk Front
    glBegin(GL_POLYGON);
    glNormal3f(
0.0f,0.0f,1.0f);
    glColor3f(
0.0f,0.0f,0.0f);
    glVertex3f(
-0.75f,0.25f,-2.55f);
    glVertex3f(
-0.75f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.25f,-2.55);
    glEnd();
    
//Front Desk Side
    glBegin(GL_POLYGON);
    glNormal3f(
-1.0f,0.0f,0.0f);
    glVertex3f(
-3.5f,0.25f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.55f);
    glVertex3f(
-3.5f,0.3f,-2.95f);
    glVertex3f(
-3.5f,0.25f,-2.95f);
    glEnd();
    
//Right Desk Front
    glBegin(GL_POLYGON);
    glNormal3f(
-1.0f,0.0f,0.0f);
    glVertex3f(
-0.45f,0.25f,-0.75f);
    glVertex3f(
-0.45f,0.3f,-0.75f);
    glVertex3f(
-0.45f,0.3f,-2.25f);
    glVertex3f(
-0.45f,0.25f,-2.25f);
    glEnd();
    
//Draw the Front Short Desk Front Thickness
    glBegin(GL_POLYGON);
    glNormal3f(
0.0f,0.0f,1.0f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
    glVertex3f(
-4.75f,0.3f,-2.55f);
    glVertex3f(
-4.75f,0.25f,-2.55f);
    glEnd();
    
//Draw the Front Short Desk Side Thickness
    glBegin(GL_POLYGON);
    glNormal3f(
1.0f,0.0f,0.0f);
    glVertex3f(
-4.0f,0.25f,-2.95f);
    glVertex3f(
-4.0f,0.3f,-2.95f);
    glVertex3f(
-4.0f,0.3f,-2.55f);
    glVertex3f(
-4.0f,0.25f,-2.55f);
    glEnd();
    
//Draw the Left Middle Desk Front Portion
    glBegin(GL_POLYGON);
    glNormal3f(
1.0f,0.0f,0.0f);
    glVertex3f(
-5.05f,0.25f,-2.25f);
    glVertex3f(
-5.05f,0.3f,-2.25f);
    glVertex3f(
-5.05f,0.3f,-1.15f);
    glVertex3f(
-5.05f,0.25f,-1.15f);
    glEnd();
    
//Draw the back
    glBegin(GL_POLYGON);
    glNormal3f(
0.0f,0.0f,-1.0f);
    glVertex3f(
-0.75f,0.25f,-0.45f);
    glVertex3f(
-5.45f,0.25f,-0.45f);
    glVertex3f(
-5.45f,0.3f,-0.45f);
    glVertex3f(
-0.75f,0.3f,-0.45f);
    glEnd();
    glDisable(GL_POLYGON_OFFSET_LINE);
    glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
    glEnable(GL_LIGHTING);
    glDisable(GL_POLYGON_SMOOTH);
    
//Computer Tables
    
//Draw the Back Computer Table
    DrawPentagonTable();
    
//Draw the Front Right Computer Table
    glPushMatrix();
    glTranslatef(
0.0f,0.0f,-3.00f);    
    glRotatef(
90.0f,0.0f,1.0f,0.0f);    
    DrawPentagonTable();
    glPopMatrix();
    
//Draw the Front Left Computer Table
    glPushMatrix();
    glTranslatef(
-5.5,0.0f,-3.0f);
    glRotatef(
180.0f,0.0f,1.0f,0.0f);    
    DrawPentagonTable();
    glPopMatrix();
}
void CCY457OpenGLView::DrawComputers()
{
    
//Computers    
    
//Draw the Back Left Corner Computer
    
//Set Color to Light Grey
    glColor3f(0.35,0.35f,0.35f);
    glPushMatrix();
    glTranslatef(
-0.5f,0.42f,-0.4f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
-145.0f,0.0f,0.0f,1.0f);
    glCallList(m_ComputerList);
    glPopMatrix();
    glPushMatrix();
    glTranslatef(
-2.0f,0.42f,-0.25f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
180.0f,0.0f,0.0f,1.0f);
    glCallList(m_ComputerList);
    glPopMatrix();
    glPushMatrix();
    glTranslatef(
-3.5f,0.42f,-0.25f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
180.0f,0.0f,0.0f,1.0f);
    glCallList(m_ComputerList);
    glPopMatrix();
    
//Front Left Computer 1
    glPushMatrix();
    glTranslatef(
-0.5f,0.42f,-2.6f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
-45.0f,0.0f,0.0f,1.0f);
    glCallList(m_ComputerList);
    glPopMatrix();
    
//Front Left Computer 2
    glPushMatrix();
    glTranslatef(
-2.0f,0.42f,-2.75f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glCallList(m_ComputerList);
    glPopMatrix();
    
//Front Right
    glPushMatrix();
    glTranslatef(
-5.1f,0.42f,-2.6);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
45.0f,0.0f,0.0f,1.0f);
    glCallList(m_ComputerList);
    glPopMatrix();
}
void CCY457OpenGLView::DrawChairs()
{
    glColor3f(
0.28f,0.21f,0.0f);
    
//Back Left Chair
    glPushMatrix();
    glTranslatef(
-0.7f0.2f-0.7f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
10.0f,0.0f,0.0f,1.0f);                                
    glCallList(m_ChairList);
    glPopMatrix();
    
//Back Right 1
    glPushMatrix();
    glTranslatef(
-2.0f0.2f-0.7f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
-30.0f,0.0f,0.0f,1.0f);
    glCallList(m_ChairList);
    glPopMatrix();
    
//Back Right 2
    glPushMatrix();
    glTranslatef(
-3.5f0.2f-0.7f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
-30.0f,0.0f,0.0f,1.0f);
    glCallList(m_ChairList);
    glPopMatrix();
    
//Front Left 1
    glPushMatrix();
    glTranslatef(
-0.7f0.2f-2.3f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
110.0f,0.0f,0.0f,1.0f);
    glCallList(m_ChairList);
    glPopMatrix();
    
//Front Left 2
    glPushMatrix();
    glTranslatef(
-2.0f0.2f-2.3f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
150.0f,0.0f,0.0f,1.0f);
    glCallList(m_ChairList);    
    glPopMatrix();
    
//Front Right 
    glPushMatrix();
    glTranslatef(
-4.8f0.2f-2.3f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
-170.0f,0.0f,0.0f,1.0f);
    glCallList(m_ChairList);
    glPopMatrix();
}
void CCY457OpenGLView::DrawBlinds()
{
    glColor3f(
0.97f,0.84f,0.72f);
    
//Draw the Blinds Object 1
    glPushMatrix();
    glTranslatef(
-0.8f,0.7f,-0.1f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glCallList(m_BlindsList);
    glPopMatrix();
    
//Draw the Blinds Object 2
    glPushMatrix();
    glTranslatef(
-1.8f,0.7f,-0.1f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glCallList(m_BlindsList);
    glPopMatrix();
    
//Draw the Blinds Object 2
    glPushMatrix();
    glTranslatef(
-3.8f,0.7f,-0.1f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glCallList(m_BlindsList);
    glPopMatrix();
    
//Draw the Blinds Object 2
    glPushMatrix();
    glTranslatef(
-4.8f,0.7f,-0.1f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glCallList(m_BlindsList);
    glPopMatrix();
}
void CCY457OpenGLView::DrawPhones()
{
    
//Draw the phones
    glColor3f(0.49f,0.35,0.25f);
    glPushMatrix();
    glTranslatef(
-0.25f,0.35f,-1.5f);
    glRotatef(
-90.0f,1.0f,0.0f,0.0f);
    glRotatef(
-90.0f,0.0f,0.0f,1.0f);
    glCallList(m_PhoneList);
    glPopMatrix();
}
void CCY457OpenGLView::DrawFloorAndCeiling ()
{
    
//Draw Floor
    glEnable(GL_TEXTURE_2D);
    glCullFace(GL_BACK);
    glBindTexture(GL_TEXTURE_2D, m_Texture[
1]);
    
//Draw Ceiling
    glBegin(GL_POLYGON);
    glNormal3f(
0.0f,-1.0f,0.0f);
    glColor3f(
1.0f,1.0f,1.0f);
    glTexCoord2f(
0.0f,5.0f);
    glVertex3f(
0.0f,1.0f,-3.0f);
    glTexCoord2f(
0.0f,0.0f);
    glVertex3f(
0.0f,1.0f,0.0f);
    glTexCoord2f(
5.0f,0.0f);
    glVertex3f(
-5.5f,1.0f,0.0f);
    glTexCoord2f(
5.0f,5.0f);
    glVertex3f(
-5.5f,1.0f,-3.0f);
    glEnd();
    glBindTexture(GL_TEXTURE_2D, m_Texture[
0]);
    glBegin(GL_POLYGON);
    glNormal3f(
0.0f,1.0f,0.0f);
    glColor3f(
1.0f,1.0f,1.0f);
    glTexCoord2f(
0.0f,0.0f);
    glVertex3f(
0.0f,0.0f,-3.0f);
    glTexCoord2f(
20.0f,0.0f);
    glVertex3f(
-5.5f,0.0f,-3.0f);
    glTexCoord2f(
20.0f,20.0f);
    glVertex3f(
-5.5f,0.0f,0.0f);
    glTexCoord2f(
0.0f,20.0f);
    glVertex3f(
0.0f,0.0f,0.0f);
    glEnd();
    glDisable(GL_TEXTURE_2D);
}

 

作者:洞庭散人

出處:http://phinecos.cnblogs.com/    

本文版權(quán)歸作者和博客園共有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁(yè)面明顯位置給出原文連接,否則保留追究法律責(zé)任的權(quán)利。
原文鏈接:http://www.cnblogs.com/phinecos/archive/2008/11/07/1328998.html
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美日韩喷水| 亚洲日韩视频| 欧美成人一区在线| 亚洲色图自拍| 亚洲影院污污.| 黄色成人在线观看| 欧美顶级艳妇交换群宴| 欧美日韩一区二区免费视频| 午夜精品一区二区三区在线播放 | 久久国产手机看片| 91久久精品www人人做人人爽| 日韩午夜在线| 国产午夜精品全部视频播放| 欧美激情一区二区三区全黄 | 久久中文欧美| 欧美日韩国产天堂| 久久大逼视频| 欧美精品久久99久久在免费线| 西瓜成人精品人成网站| 久久久水蜜桃av免费网站| 一本色道久久综合狠狠躁篇怎么玩| 亚洲一级免费视频| 亚洲第一网站免费视频| 中日韩美女免费视频网站在线观看| 国产综合色精品一区二区三区| 亚洲国产高清一区| 国产日韩欧美三级| 亚洲国产日韩一级| 国产欧美日本一区视频| 亚洲成人直播| 国产亚洲毛片在线| 亚洲精品日韩精品| 国内成人精品视频| 亚洲最新视频在线播放| 激情久久综合| 亚洲一区二区三区高清| 亚洲欧洲精品一区| 欧美一区二区三区四区在线| 99视频精品在线| 久久久久久国产精品mv| 亚洲在线成人| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美一区二区三区视频在线| 欧美高清一区| 久久综合伊人77777蜜臀| 欧美四级剧情无删版影片| 免费国产一区二区| 国产欧美一区二区三区视频 | 国产一区二区三区久久精品| 亚洲精品一区二区三区婷婷月| 国内精品亚洲| 亚洲一区二区三区欧美 | 欧美/亚洲一区| 久久久噜噜噜久久中文字免| 欧美视频福利| 亚洲第一精品夜夜躁人人躁| 国产午夜精品理论片a级大结局| 亚洲精品欧美日韩专区| 在线观看日韩精品| 欧美亚洲午夜视频在线观看| 亚洲一区成人| 欧美精品 国产精品| 美女999久久久精品视频| 国产农村妇女毛片精品久久麻豆| 亚洲毛片在线| 日韩午夜黄色| 欧美成人福利视频| 免费亚洲网站| 国产自产精品| 午夜久久一区| 欧美亚洲一区二区在线| 欧美性jizz18性欧美| 亚洲欧洲精品一区二区精品久久久| 精品av久久707| 欧美在线网站| 欧美专区福利在线| 国产精品羞羞答答| 中文精品视频| 亚洲五月六月| 欧美日韩免费观看一区二区三区| 亚洲国产精品成人久久综合一区| 亚洲高清激情| 久久亚洲精品中文字幕冲田杏梨| 久久亚洲电影| 一色屋精品视频免费看| 久久av老司机精品网站导航| 久久国产主播| 国产日韩在线一区| 香蕉久久a毛片| 久久精品国产综合| 国产一区二区三区的电影| 午夜精品久久| 久久成人人人人精品欧| 国产日韩一区二区三区| 午夜国产精品视频| 久久成人精品无人区| 国产日韩欧美高清| 久久成人免费日本黄色| 久久一二三国产| 精品不卡在线| 卡一卡二国产精品| 欧美激情亚洲激情| 亚洲精品一二三| 欧美精品福利| 一本久道久久综合狠狠爱| 亚洲天堂黄色| 国产精品盗摄一区二区三区| 亚洲视频久久| 久久黄金**| 伊人成人在线| 男人的天堂亚洲| 亚洲日本理论电影| 亚洲一卡二卡三卡四卡五卡| 国产精品手机在线| 亚洲欧美精品在线观看| 久久久夜精品| 亚洲国产精品嫩草影院| 欧美精品一区二| 一本到12不卡视频在线dvd| 午夜日韩激情| 黄色日韩在线| 欧美激情一区二区久久久| 99热免费精品| 久久精品国产91精品亚洲| 黄色成人在线| 欧美激情第二页| 亚洲社区在线观看| 久久精品国产第一区二区三区| 亚洲成色777777在线观看影院| 蜜臀av一级做a爰片久久| 亚洲精选久久| 久久国产精品免费一区| 伊人精品在线| 欧美精品自拍| 亚洲欧美日本伦理| 欧美aa国产视频| 99精品久久久| 国产情人节一区| 蜜桃精品久久久久久久免费影院| 99精品欧美一区| 久久精品国产99精品国产亚洲性色 | 亚洲午夜未删减在线观看| 国产午夜久久| 久久综合99re88久久爱| 亚洲美女诱惑| 久久久国产亚洲精品| 亚洲人体大胆视频| 国产精品女主播在线观看| 久久精品国产亚洲一区二区| 亚洲国产一二三| 欧美在线999| 91久久精品美女高潮| 国产精品久久久久久久久免费 | 美女精品国产| 亚洲午夜伦理| 欧美成人免费观看| 亚洲欧美日韩精品久久久| 影音欧美亚洲| 国产精品久久二区| 蜜桃精品久久久久久久免费影院| 亚洲私人黄色宅男| 欧美成人官网二区| 欧美一进一出视频| 亚洲精品黄色| 国产一区二区黄色| 欧美色大人视频| 久久免费高清| 亚洲欧美日韩一区二区三区在线观看| 欧美激情视频在线免费观看 欧美视频免费一 | 国产精品一区在线观看你懂的| 免费精品99久久国产综合精品| 亚洲午夜久久久久久尤物| 亚洲国产成人午夜在线一区| 久久久91精品国产| 中文日韩欧美| 亚洲经典在线看| 国产女人水真多18毛片18精品视频| 欧美成人小视频| 久久国产免费| 亚洲摸下面视频| 亚洲精品视频在线播放| 另类欧美日韩国产在线| 亚洲欧美激情视频在线观看一区二区三区| 亚洲国产精品视频| 国产在线观看精品一区二区三区| 欧美日韩国产小视频| 麻豆91精品| 欧美一区二区黄| 中文久久精品| 亚洲美女免费精品视频在线观看| 免费看av成人| 久久久噜噜噜久久中文字幕色伊伊| 亚洲制服少妇| 在线综合+亚洲+欧美中文字幕| 亚洲第一伊人| 狠狠色丁香久久婷婷综合_中| 国产精品日韩精品| 欧美天天综合网| 欧美日韩1区2区3区| 欧美高清在线精品一区|