]> git.mxchange.org Git - flightgear.git/commitdiff
Canvas: Redraw if OpenVG has been initialized.
authorThomas Geymayer <tomgey@gmail.com>
Tue, 25 Sep 2012 19:34:37 +0000 (21:34 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Tue, 25 Sep 2012 19:34:58 +0000 (21:34 +0200)
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
src/Canvas/elements/path.cxx
src/Canvas/elements/path.hxx

index ddc9e7225357422adaaa6d3e69e9d695d888a140..d0f4b956781694761afba97c319f8c850086dbec 100644 (file)
@@ -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,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:
index a9ab7e22703199ccaf0dd06199cd4ad4b4067290..31cc52d2754c2a2aea30e8d050a04258262279b7 100644 (file)
@@ -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):
index 2d39cfe2dd0349d1f3005495840da659e1f1fd90..abc463c762647a466d8be0981092ca7986a660d8 100644 (file)
@@ -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);