《基于MFC的OpenGL编程》Part 19 Creating a Virtual Reality Walkthrough…2010-05-02 博客园 Phinecos(洞庭散人)《基于MFC的OpenGL编程》Part 19 Creating a Virtual Reality Walkthrough Application本文是整个系列文章的最后一篇,将创建一个完整的虚拟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();
}