1
0
Fork 0

Canvas: Proper fix for OpenVG init handling.

- Redraw all canvases in the frame OpenVG is initialized.
   Otherwise if multiple canvases are created in the same frame
   only one of them would get correctly updated.
This commit is contained in:
Thomas Geymayer 2012-09-25 23:06:27 +02:00
parent dac8706e2e
commit 6dd4782254
3 changed files with 13 additions and 11 deletions

View file

@ -49,17 +49,13 @@ class Canvas::DrawCallback:
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;
// initializing has happened instead of rendering.
// Otherwise we just reset the _render_dirty flag.
_canvas->_render_dirty = (frame == fgGetLong(canvas::VG_INIT_SIGNAL));
}
protected:

View file

@ -36,6 +36,8 @@ typedef boost::weak_ptr<PropertyBasedElement> PropertyBasedElementWeakPtr;
namespace canvas
{
const std::string VG_INIT_SIGNAL = "/sim/signals/vg-initialized-frame";
class Group;
class Image;
class MouseEvent;

View file

@ -17,6 +17,7 @@
// 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>
@ -170,7 +171,10 @@ namespace canvas
vgCreateContextSH(vp[2], vp[3]);
_vg_initialized = true;
fgSetBool("/sim/signals/vg-initialized", true);
fgSetInt( canvas::VG_INIT_SIGNAL,
renderInfo.getView()->getFrameStamp()->getFrameNumber() );
return;
}