virtual void operator()(osg::RenderInfo& renderInfo) const
{
- const std::string VG_SIGNAL = "/sim/signals/vg-initialized";
+ const long frame = renderInfo.getView()->getFrameStamp()
+ ->getFrameNumber();
- if( fgGetBool(VG_SIGNAL) )
- {
- fgSetBool(VG_SIGNAL, false);
- // If OpenVG has been initialized we need to redraw the frame, because
- // initializing has happened instead of rendering
- _canvas->_render_dirty = true;
- }
- else
- _canvas->_render_dirty = false;
+ // If OpenVG has been initialized we need to redraw the frame, because
+ // initializing has happened instead of rendering.
+ // Otherwise we just reset the _render_dirty flag.
+ _canvas->_render_dirty = (frame == fgGetLong(canvas::VG_INIT_SIGNAL));
}
protected:
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "path.hxx"
+#include <Canvas/canvas_fwd.hpp>
#include <Canvas/property_helper.hxx>
#include <Main/fg_props.hxx>
vgCreateContextSH(vp[2], vp[3]);
_vg_initialized = true;
- fgSetBool("/sim/signals/vg-initialized", true);
+
+ fgSetInt( canvas::VG_INIT_SIGNAL,
+ renderInfo.getView()->getFrameStamp()->getFrameNumber() );
+
return;
}