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

Shuffy

不斷的學習,不斷的思考,才能不斷的進步.Let's do better together!
posts - 102, comments - 43, trackbacks - 0, articles - 19

        本文是整個系列文章的最后一篇,將創建一個完整的虛擬office應用程序(如圖所示)來做為ending.

1,CCY457OpenGLView類中加入下述變量,用來保存office內各個物體的顯示列表

    //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,創建房間內部場景


//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文件中加載各個物件的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,創建各個具體物件的代碼:


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/    

本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。
原文鏈接: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>
            亚洲国产天堂久久综合| 亚洲国产cao| 亚洲自拍都市欧美小说| 久久激情综合网| 亚洲国产成人91精品| 欧美激情五月| 亚洲一区影音先锋| 免费一级欧美片在线观看| 亚洲日本成人| 国产精品嫩草影院一区二区| 欧美一区二区视频在线观看2020 | 欧美成人免费在线| 亚洲美女免费精品视频在线观看| 欧美色中文字幕| 欧美一区2区三区4区公司二百| 欧美成人免费全部| 亚洲欧美成人网| 1024国产精品| 国产精品久久一级| 欧美xxxx在线观看| 亚洲欧美成人一区二区在线电影| 欧美凹凸一区二区三区视频| 亚洲图片欧美日产| 亚洲成人在线| 国产久一道中文一区| 欧美国产日韩a欧美在线观看| 亚洲综合久久久久| 最新国产精品拍自在线播放| 久久国产精品久久久久久| 亚洲毛片播放| 伊人久久成人| 国产农村妇女精品一区二区| 欧美韩日一区| 久久青青草原一区二区| 亚洲一区在线播放| 亚洲人成77777在线观看网| 久久久久亚洲综合| 亚洲欧美在线免费| 一区二区国产在线观看| 樱花yy私人影院亚洲| 国产乱人伦精品一区二区| 欧美激情在线有限公司| 久久精品一区中文字幕| 亚洲免费视频一区二区| 亚洲麻豆视频| 亚洲国产婷婷香蕉久久久久久99| 久久经典综合| 午夜精品一区二区三区在线| 日韩午夜精品| 亚洲毛片在线免费观看| 91久久精品国产91久久| 狠狠色丁香婷综合久久| 国产毛片一区二区| 国产精品嫩草影院一区二区 | 国产精品久久久久7777婷婷| 男男成人高潮片免费网站| 久久久青草青青国产亚洲免观| 亚洲欧美久久久久一区二区三区| 一区二区三区欧美亚洲| 亚洲精品视频在线观看网站| 亚洲成色最大综合在线| 欧美电影免费网站| 欧美激情免费观看| 欧美激情第1页| 欧美激情一区二区三区四区| 蜜桃视频一区| 欧美99在线视频观看| 欧美激情黄色片| 欧美刺激性大交免费视频| 欧美va天堂| 欧美国产日韩亚洲一区| 欧美成人精品高清在线播放| 欧美电影在线播放| 亚洲人成小说网站色在线| 亚洲精品久久久久久一区二区| 亚洲国产一区二区三区高清| 亚洲欧洲三级| 亚洲看片网站| 亚洲图片欧洲图片日韩av| 亚洲色图自拍| 欧美伊人久久| 久久一区二区三区四区五区| 蜜桃av综合| 欧美日韩激情网| 国产精品蜜臀在线观看| 国产亚洲精品美女| 亚洲高清在线视频| 日韩网站在线看片你懂的| 亚洲伊人久久综合| 久久激情中文| 亚洲第一精品在线| 制服丝袜激情欧洲亚洲| 新狼窝色av性久久久久久| 久久―日本道色综合久久| 欧美chengren| 国产精品免费在线| 在线成人免费观看| 亚洲视频电影在线| 久久综合中文字幕| 亚洲人成毛片在线播放| 亚洲欧美久久久| 美女露胸一区二区三区| 欧美日韩久久不卡| 国产亚洲一区精品| 日韩一区二区久久| 久久精品视频在线看| 欧美国产一区视频在线观看| 夜夜嗨av一区二区三区网页| 欧美有码视频| 欧美日韩一区二区三区免费看 | 亚洲韩日在线| 亚洲欧美在线另类| 亚洲国产成人在线| 亚洲女女女同性video| 麻豆精品在线播放| 国产精品一级二级三级| 亚洲毛片在线| 久久香蕉精品| 亚洲视频高清| 欧美理论在线播放| 在线免费观看日本欧美| 午夜精品电影| 亚洲日韩欧美视频| 久久久亚洲高清| 国产麻豆精品theporn| 日韩天堂在线观看| 欧美成人国产va精品日本一级| 亚洲嫩草精品久久| 国产精品videosex极品| 亚洲国产一区二区三区高清| 欧美在现视频| 正在播放亚洲一区| 欧美日韩国产三级| 亚洲精品亚洲人成人网| 久久先锋资源| 午夜天堂精品久久久久| 国产精品分类| 一区二区激情小说| 亚洲国产高清自拍| 美女福利精品视频| 在线精品观看| 久久综合色综合88| 欧美在线免费观看视频| 国产精品外国| 午夜精品视频在线| 亚洲视频中文| 国产精品视频免费| 欧美亚洲一区| 亚洲天堂av在线免费| 欧美午夜精品久久久久免费视 | 午夜免费电影一区在线观看| 欧美日韩一区成人| 亚洲午夜影视影院在线观看| 亚洲日本aⅴ片在线观看香蕉| 欧美不卡在线视频| 日韩网站在线观看| 亚洲精品欧美日韩专区| 欧美国产日产韩国视频| 亚洲精品免费在线播放| 欧美岛国激情| 欧美激情第五页| 在线视频精品一区| av成人免费观看| 国产精品v欧美精品v日韩| 亚洲一区综合| 亚洲欧美日韩电影| 狠狠色综合网站久久久久久久| 久久裸体视频| 老牛嫩草一区二区三区日本| 亚洲精品黄色| 一本到高清视频免费精品| 欧美性一区二区| 欧美在线视频观看| 久久亚洲风情| 一本色道久久综合狠狠躁篇怎么玩 | 国产精品www.| 久久国产夜色精品鲁鲁99| 久久不见久久见免费视频1| 悠悠资源网亚洲青| 亚洲国产日韩一区二区| 欧美婷婷六月丁香综合色| 欧美亚洲一区三区| 久久久综合精品| 亚洲精品在线免费| 亚洲欧美日韩一区在线观看| 国内激情久久| 亚洲七七久久综合桃花剧情介绍| 国产精品久久7| 免费一级欧美片在线播放| 欧美巨乳在线| 久久精品欧洲| 欧美日韩国产一区二区| 欧美专区18| 欧美激情91| 久久精品久久99精品久久| 免费观看日韩av| 午夜精品视频在线| 欧美成人激情在线| 久久国产精品网站| 欧美激情久久久久|