source: projectionDesigner/trunk/projdesigner/src/screen/ScreenShape.cpp @ 259

Last change on this file since 259 was 4, checked in by Torben Dannhauer, 15 years ago
File size: 1.2 KB
RevLine 
[4]1#include "Screen.h"
2#include "screen/ScreenShape.h"
3
4using namespace projection;
5
6/**
7 * Constructor.
8 *
9 * @param pScreen Screen data.
10 */
11ScreenShape::ScreenShape(Screen* pScreen)
12{
13    m_pScreen = pScreen;
14
15    m_dlIndex = 0;
16    m_bDirty = true;
17}
18
19/**
20 * Destructor.
21 */
22ScreenShape::~ScreenShape()
23{
24    if (glIsList(m_dlIndex))
25        glDeleteLists(m_dlIndex, 2);
26}
27
28/**
29 * Draw the shape model in inherited class.
30 *
31 * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model.
32 */
33void ScreenShape::draw(bool bFrame)
34{
35    // cache the model in display lists.
36
37    // update screen shape model, if modified
38    if (m_bDirty)
39    {
40        if (glIsList(m_dlIndex))
41            glDeleteLists(m_dlIndex, 2);
42
43        m_dlIndex = glGenLists(2);
44
45        glNewList(m_dlIndex, GL_COMPILE);
46        drawShape(false);
47        glEndList();
48
49        glNewList(m_dlIndex+1, GL_COMPILE);
50        drawShape(true);
51        glEndList();
52
53        m_bDirty = false;
54    }
55
56    if (!bFrame)
57        glCallList(m_dlIndex);
58    else
59        glCallList(m_dlIndex+1);
60}
61
62/**
63 * Notify to redraw the screen shape.
64 */
65void ScreenShape::notifyRedraw()
66{
67    m_bDirty = true;
68
69    m_pScreen->notifyRedraw();
70}
Note: See TracBrowser for help on using the repository browser.