Gui: workaround to show content of image plane

This workaround is needed on some platforms after the refactoring of the NaviCube code. For more details see also:
https://github.com/FreeCAD/FreeCAD/pull/9356#issuecomment-1529521654
This commit is contained in:
wmayer
2023-05-01 14:36:01 +02:00
committed by wwmayer
parent 3fabd940dd
commit 39fb455af2
2 changed files with 35 additions and 0 deletions

View File

@@ -2102,6 +2102,7 @@ void View3DInventorViewer::renderScene()
SoGLWidgetElement::set(state, qobject_cast<QtGLWidget*>(this->getGLWidget()));
SoGLRenderActionElement::set(state, glra);
SoGLVBOActivatedElement::set(state, this->vboEnabled);
drawSingleBackground(col);
glra->apply(this->backgroundroot);
navigation->updateAnimation();
@@ -3310,6 +3311,39 @@ void View3DInventorViewer::drawArrow()
glEnd();
}
void View3DInventorViewer::drawSingleBackground(const QColor& col)
{
// Note: After changing the NaviCube code the content of an image plane may appear black.
// A workaround is this function.
// See also: https://github.com/FreeCAD/FreeCAD/pull/9356#issuecomment-1529521654
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glBegin(GL_TRIANGLE_STRIP);
glColor3f(col.redF(), col.greenF(), col.blueF());
glVertex2f(-1, 1);
glColor3f(col.redF(), col.greenF(), col.blueF());
glVertex2f(-1, -1);
glColor3f(col.redF(), col.greenF(), col.blueF());
glVertex2f(1, 1);
glColor3f(col.redF(), col.greenF(), col.blueF());
glVertex2f(1, -1);
glEnd();
glPopAttrib();
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
// ************************************************************************
// Set cursor graphics according to mode.