diff --git a/include/osg/Drawable b/include/osg/Drawable index 062b8d665..6268a9347 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -164,12 +164,12 @@ class SG_EXPORT Drawable : public Object * Note, draw method should *not* be overridden in subclasses as it * manages the optional display list. */ - inline void draw(State& state); + inline void draw(State& state) const; /** Immediately compile this drawable into an OpenGL Display List. Note I, operation is ignored if _useDisplayList to false. Note II, compile is not intended to be overridden in subclasses.*/ - void compile(State& state); + virtual void compile(State& state) const; struct UpdateCallback : public virtual osg::Referenced @@ -403,7 +403,7 @@ class SG_EXPORT Drawable : public Object }; -inline void Drawable::draw(State& state) +inline void Drawable::draw(State& state) const { if (_useDisplayList) { diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 3ac6418e9..bb25256f2 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -85,7 +85,7 @@ void Drawable::dirtyBound() } } -void Drawable::compile(State& state) +void Drawable::compile(State& state) const { if (!_useDisplayList) return; diff --git a/src/osgUtil/DisplayListVisitor.cpp b/src/osgUtil/DisplayListVisitor.cpp index e07803019..dc95a52d7 100644 --- a/src/osgUtil/DisplayListVisitor.cpp +++ b/src/osgUtil/DisplayListVisitor.cpp @@ -36,12 +36,9 @@ void DisplayListVisitor::apply(osg::Geode& node) for(unsigned int i=0;igetUseDisplayList()) + if (drawable->getStateSet()) { - if (drawable->getStateSet()) - { - drawable->getStateSet()->compile(*_state); - } + drawable->getStateSet()->compile(*_state); } } } @@ -65,10 +62,7 @@ void DisplayListVisitor::apply(osg::Geode& node) { for(unsigned int i=0;igetUseDisplayList()) - { - node.getDrawable(i)->compile(*_state); - } + node.getDrawable(i)->compile(*_state); } } }