#include "Screen.h" #include "screen/ScreenShape.h" using namespace projection; /** * Constructor. * * @param pScreen Screen data. */ ScreenShape::ScreenShape(Screen* pScreen) { m_pScreen = pScreen; m_dlIndex = 0; m_bDirty = true; } /** * Destructor. */ ScreenShape::~ScreenShape() { if (glIsList(m_dlIndex)) glDeleteLists(m_dlIndex, 2); } /** * Draw the shape model in inherited class. * * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model. */ void ScreenShape::draw(bool bFrame) { // cache the model in display lists. // update screen shape model, if modified if (m_bDirty) { if (glIsList(m_dlIndex)) glDeleteLists(m_dlIndex, 2); m_dlIndex = glGenLists(2); glNewList(m_dlIndex, GL_COMPILE); drawShape(false); glEndList(); glNewList(m_dlIndex+1, GL_COMPILE); drawShape(true); glEndList(); m_bDirty = false; } if (!bFrame) glCallList(m_dlIndex); else glCallList(m_dlIndex+1); } /** * Notify to redraw the screen shape. */ void ScreenShape::notifyRedraw() { m_bDirty = true; m_pScreen->notifyRedraw(); }