Removed display lists.

This commit is contained in:
leo 2014-01-31 00:29:09 +00:00
parent ac6a61768c
commit 3b08ba7a0b
3 changed files with 4 additions and 24 deletions

View file

@ -536,14 +536,14 @@ void Piece::RenderBox(bool bHilite, float fLineWidth)
glLineWidth(2*fLineWidth); glLineWidth(2*fLineWidth);
glPushAttrib(GL_POLYGON_BIT); glPushAttrib(GL_POLYGON_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glCallList(mPieceInfo->GetBoxDisplayList()); mPieceInfo->RenderBox();
glPopAttrib(); glPopAttrib();
glLineWidth(fLineWidth); glLineWidth(fLineWidth);
} }
else else
{ {
lcSetColor(mColorIndex); lcSetColor(mColorIndex);
glCallList(mPieceInfo->GetBoxDisplayList()); mPieceInfo->RenderBox();
} }
glPopMatrix(); glPopMatrix();
} }

View file

@ -14,7 +14,6 @@ PieceInfo::PieceInfo(int ZipFileIndex)
mFlags = 0; mFlags = 0;
mMesh = NULL; mMesh = NULL;
mRefCount = 0; mRefCount = 0;
m_nBoxList = 0;
} }
PieceInfo::~PieceInfo() PieceInfo::~PieceInfo()
@ -33,14 +32,8 @@ void PieceInfo::CreatePlaceholder(const char* Name)
mFlags = LC_PIECE_PLACEHOLDER; mFlags = LC_PIECE_PLACEHOLDER;
} }
void PieceInfo::CreateBoxDisplayList() void PieceInfo::RenderBox()
{ {
if (m_nBoxList)
return;
// Create a display for the bounding box.
m_nBoxList = glGenLists(1);
glNewList(m_nBoxList, GL_COMPILE);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
float box[24][3] = float box[24][3] =
@ -73,7 +66,6 @@ void PieceInfo::CreateBoxDisplayList()
glVertexPointer(3, GL_FLOAT, 0, box); glVertexPointer(3, GL_FLOAT, 0, box);
glDrawArrays(GL_QUADS, 0, 24); glDrawArrays(GL_QUADS, 0, 24);
glEndList();
} }
void PieceInfo::Load() void PieceInfo::Load()
@ -110,10 +102,6 @@ void PieceInfo::Unload()
delete mMesh; delete mMesh;
mMesh = NULL; mMesh = NULL;
if (m_nBoxList != 0)
glDeleteLists(m_nBoxList, 1);
m_nBoxList = 0;
} }
// Zoom extents for the preview window and print catalog // Zoom extents for the preview window and print catalog

View file

@ -76,14 +76,8 @@ public:
// Operations // Operations
void ZoomExtents(float Fov, float Aspect, float* EyePos = NULL) const; void ZoomExtents(float Fov, float Aspect, float* EyePos = NULL) const;
void RenderPiece(int nColor); void RenderPiece(int nColor);
void RenderBox();
// Implementation
GLuint GetBoxDisplayList()
{
if (!m_nBoxList)
CreateBoxDisplayList();
return m_nBoxList;
};
void CreatePlaceholder(const char* Name); void CreatePlaceholder(const char* Name);
public: public:
@ -98,11 +92,9 @@ public:
protected: protected:
int mRefCount; int mRefCount;
GLuint m_nBoxList;
void Load(); void Load();
void Unload(); void Unload();
void CreateBoxDisplayList();
}; };
#endif // _PIECEINF_H_ #endif // _PIECEINF_H_