diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp index 5e6e47ccc7a..52e20e300b6 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp @@ -42,6 +42,7 @@ OglSceneFrame::OglSceneFrame() , d_style(initData(&d_style, defaultStyle, "style", ("Style of the frame\n" + Style::dataDescription()).c_str())) , d_alignment(initData(&d_alignment, defaultAlignment, "alignment", ("Alignment of the frame in the view\n" + Alignment::dataDescription()).c_str())) , d_viewportSize(initData(&d_viewportSize, 150, "viewportSize", "Size of the viewport where the frame is rendered")) + , d_solidBackground(initData(&d_solidBackground, false, "solidBackground", "If true, an opaque bkacground will be rendered; otherwise the frame is rendered on top on the normal viewport.")) {} void OglSceneFrame::drawArrows(const core::visual::VisualParams* vparams) @@ -129,12 +130,19 @@ void OglSceneFrame::doDrawVisual(const core::visual::VisualParams* vparams) glScissor(0,viewport[3]-viewportSize,viewportSize,viewportSize); break; } - - + glEnable(GL_SCISSOR_TEST); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - glClearColor (1.0f, 1.0f, 1.0f, 0.0f); - + if(d_solidBackground.getValue()) + { + // reset color and depth for the mini viewport (setting a background and making render on front) + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + } + else + { + // only reset depth to appear on front + glClear(GL_DEPTH_BUFFER_BIT ); + } + glMatrixMode(GL_PROJECTION); vparams->drawTool()->pushMatrix(); glLoadIdentity(); diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.h b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.h index d834c9584d1..224b81876e8 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.h +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.h @@ -58,6 +58,7 @@ class SOFA_GL_COMPONENT_RENDERING3D_API OglSceneFrame : public core::visual::Vis Data d_alignment; ///< Alignment of the frame in the view Data d_viewportSize; ///< Size of the viewport where the frame is rendered + Data d_solidBackground; OglSceneFrame();