Canvas::Path: also restore glBlendFunc.

This commit is contained in:
Thomas Geymayer 2014-04-01 12:35:43 +02:00
parent 8c45796dc8
commit 338a748823

View File

@ -219,6 +219,8 @@ namespace canvas
bool was_blend_enabled = state->getLastAppliedMode(GL_BLEND); bool was_blend_enabled = state->getLastAppliedMode(GL_BLEND);
bool was_stencil_enabled = state->getLastAppliedMode(GL_STENCIL_TEST); bool was_stencil_enabled = state->getLastAppliedMode(GL_STENCIL_TEST);
osg::StateAttribute const* blend_func =
state->getLastAppliedAttribute(osg::StateAttribute::BLENDFUNC);
// Initialize/Update the paint // Initialize/Update the paint
if( _attributes_dirty & STROKE_COLOR ) if( _attributes_dirty & STROKE_COLOR )
@ -268,8 +270,11 @@ namespace canvas
if( err != VG_NO_ERROR ) if( err != VG_NO_ERROR )
SG_LOG(SG_GL, SG_ALERT, "vgError: " << err); 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_blend_enabled ) glEnable(GL_BLEND);
if( was_stencil_enabled ) glEnable(GL_STENCIL_TEST); if( was_stencil_enabled ) glEnable(GL_STENCIL_TEST);
if( blend_func ) blend_func->apply(*state);
} }
osg::BoundingBox getTransformedBounds(const osg::Matrix& mat) const osg::BoundingBox getTransformedBounds(const osg::Matrix& mat) const