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:
parent
a10638c6b4
commit
16d73f4012
3 changed files with 17 additions and 5 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <Canvas/MouseEvent.hxx>
|
||||
#include <Canvas/property_helper.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Viewer/CameraGroup.hxx>
|
||||
#include <Viewer/renderer.hxx>
|
||||
|
@ -48,6 +49,16 @@ class Canvas::DrawCallback:
|
|||
|
||||
virtual void operator()(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "path.hxx"
|
||||
#include <Canvas/property_helper.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
#include <vg/openvg.h>
|
||||
|
||||
|
@ -31,8 +32,7 @@ namespace canvas
|
|||
typedef std::vector<VGubyte> CmdList;
|
||||
typedef std::vector<VGfloat> 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):
|
||||
|
|
|
@ -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<PathDrawable> _path;
|
||||
|
||||
virtual void childRemoved(SGPropertyNode * child);
|
||||
|
|
Loading…
Add table
Reference in a new issue