From 16d73f4012d6560cab2266b31a7c03dd5c41c2d6 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Tue, 25 Sep 2012 21:34:37 +0200 Subject: [PATCH] Canvas: Redraw if OpenVG has been initialized. If OpenVG/ShivaVG is initialized nothing is drawn in the same frame, therefore we need to draw another frame to ensure all paths are rendered correctly. --- src/Canvas/canvas.cxx | 13 ++++++++++++- src/Canvas/elements/path.cxx | 7 ++++--- src/Canvas/elements/path.hxx | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Canvas/canvas.cxx b/src/Canvas/canvas.cxx index ddc9e7225..d0f4b9567 100644 --- a/src/Canvas/canvas.cxx +++ b/src/Canvas/canvas.cxx @@ -21,6 +21,7 @@ #include #include +#include
#include
#include #include @@ -48,7 +49,17 @@ class Canvas::DrawCallback: virtual void operator()(osg::RenderInfo& renderInfo) const { - _canvas->_render_dirty = false; + const std::string VG_SIGNAL = "/sim/signals/vg-initialized"; + + 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; } protected: diff --git a/src/Canvas/elements/path.cxx b/src/Canvas/elements/path.cxx index a9ab7e227..31cc52d27 100644 --- a/src/Canvas/elements/path.cxx +++ b/src/Canvas/elements/path.cxx @@ -18,6 +18,7 @@ #include "path.hxx" #include +#include
#include @@ -31,8 +32,7 @@ namespace canvas typedef std::vector CmdList; typedef std::vector CoordList; - class Path; - class PathDrawable: + class Path::PathDrawable: public osg::Drawable { public: @@ -170,6 +170,7 @@ namespace canvas vgCreateContextSH(vp[2], vp[3]); _vg_initialized = true; + fgSetBool("/sim/signals/vg-initialized", true); return; } @@ -350,7 +351,7 @@ namespace canvas }; }; - bool PathDrawable::_vg_initialized = false; + bool Path::PathDrawable::_vg_initialized = false; //---------------------------------------------------------------------------- Path::Path(SGPropertyNode_ptr node, const Style& parent_style): diff --git a/src/Canvas/elements/path.hxx b/src/Canvas/elements/path.hxx index 2d39cfe2d..abc463c76 100644 --- a/src/Canvas/elements/path.hxx +++ b/src/Canvas/elements/path.hxx @@ -23,7 +23,6 @@ namespace canvas { - class PathDrawable; class Path: public Element { @@ -41,6 +40,7 @@ namespace canvas COORDS = CMDS << 1 }; + class PathDrawable; osg::ref_ptr _path; virtual void childRemoved(SGPropertyNode * child);