]> git.mxchange.org Git - simgear.git/commitdiff
Canvas::Path: also restore glBlendFunc.
authorThomas Geymayer <tomgey@gmail.com>
Tue, 1 Apr 2014 10:35:43 +0000 (12:35 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Tue, 1 Apr 2014 10:35:43 +0000 (12:35 +0200)
simgear/canvas/elements/CanvasPath.cxx

index a2026369f89e7a7957c47fe45abc1345076ba961..ba5351fe6f0ca4053698f254b42dfa0fe033f408 100644 (file)
@@ -219,6 +219,8 @@ namespace canvas
 
         bool was_blend_enabled = state->getLastAppliedMode(GL_BLEND);
         bool was_stencil_enabled = state->getLastAppliedMode(GL_STENCIL_TEST);
+        osg::StateAttribute const* blend_func =
+          state->getLastAppliedAttribute(osg::StateAttribute::BLENDFUNC);
 
         // Initialize/Update the paint
         if( _attributes_dirty & STROKE_COLOR )
@@ -268,8 +270,11 @@ namespace canvas
         if( err != VG_NO_ERROR )
           SG_LOG(SG_GL, SG_ALERT, "vgError: " << err);
 
+        // Restore OpenGL state (TODO check if more is needed or integrate
+        //                            better with OpenSceneGraph)
         if( was_blend_enabled )   glEnable(GL_BLEND);
         if( was_stencil_enabled ) glEnable(GL_STENCIL_TEST);
+        if( blend_func )          blend_func->apply(*state);
       }
 
       osg::BoundingBox getTransformedBounds(const osg::Matrix& mat) const