Skip to content

Commit

Permalink
fix frame background if a texture is present
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Jan 16, 2025
1 parent f28c570 commit dcd0cad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class SOFA_GL_COMPONENT_RENDERING3D_API OglSceneFrame : public core::visual::Vis

Data<Alignment> d_alignment; ///< Alignment of the frame in the view
Data<int> d_viewportSize; ///< Size of the viewport where the frame is rendered
Data<bool> d_solidBackground;

OglSceneFrame();

Expand Down

0 comments on commit dcd0cad

Please sign in to comment.