1
0
Fork 0

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.
This commit is contained in:
Thomas Geymayer 2012-09-25 21:34:37 +02:00
parent a10638c6b4
commit 16d73f4012
3 changed files with 17 additions and 5 deletions

View file

@ -21,6 +21,7 @@
#include <Canvas/MouseEvent.hxx> #include <Canvas/MouseEvent.hxx>
#include <Canvas/property_helper.hxx> #include <Canvas/property_helper.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Viewer/CameraGroup.hxx> #include <Viewer/CameraGroup.hxx>
#include <Viewer/renderer.hxx> #include <Viewer/renderer.hxx>
@ -48,7 +49,17 @@ class Canvas::DrawCallback:
virtual void operator()(osg::RenderInfo& renderInfo) const 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: protected:

View file

@ -18,6 +18,7 @@
#include "path.hxx" #include "path.hxx"
#include <Canvas/property_helper.hxx> #include <Canvas/property_helper.hxx>
#include <Main/fg_props.hxx>
#include <vg/openvg.h> #include <vg/openvg.h>
@ -31,8 +32,7 @@ namespace canvas
typedef std::vector<VGubyte> CmdList; typedef std::vector<VGubyte> CmdList;
typedef std::vector<VGfloat> CoordList; typedef std::vector<VGfloat> CoordList;
class Path; class Path::PathDrawable:
class PathDrawable:
public osg::Drawable public osg::Drawable
{ {
public: public:
@ -170,6 +170,7 @@ namespace canvas
vgCreateContextSH(vp[2], vp[3]); vgCreateContextSH(vp[2], vp[3]);
_vg_initialized = true; _vg_initialized = true;
fgSetBool("/sim/signals/vg-initialized", true);
return; 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): Path::Path(SGPropertyNode_ptr node, const Style& parent_style):

View file

@ -23,7 +23,6 @@
namespace canvas namespace canvas
{ {
class PathDrawable;
class Path: class Path:
public Element public Element
{ {
@ -41,6 +40,7 @@ namespace canvas
COORDS = CMDS << 1 COORDS = CMDS << 1
}; };
class PathDrawable;
osg::ref_ptr<PathDrawable> _path; osg::ref_ptr<PathDrawable> _path;
virtual void childRemoved(SGPropertyNode * child); virtual void childRemoved(SGPropertyNode * child);