Skip to content

Commit

Permalink
+ fix transparency problem, support antialiasing, background color issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 8, 2014
1 parent 99caf6d commit efe414e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Gui/View3DInventorViewer.cpp
Expand Up @@ -1235,6 +1235,7 @@ void View3DInventorViewer::renderToFramebuffer(QGLFramebufferObject* fbo)
glDepthRange(0.1,1.0);

SoGLRenderAction gl(SbViewportRegion(width, height));
gl.setTransparencyType(SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND);
gl.apply(this->backgroundroot);
gl.apply(this->getSoRenderManager()->getSceneGraph());
gl.apply(this->foregroundroot);
Expand Down
9 changes: 6 additions & 3 deletions src/Gui/View3DPy.cpp
Expand Up @@ -658,7 +658,10 @@ Py::Object View3DInventorPy::isAnimationEnabled(const Py::Tuple& args)

void View3DInventorPy::createImageFromFramebuffer(int width, int height, const QColor& bgcolor, QImage& img)
{
QGLFramebufferObject fbo(width, height, QGLFramebufferObject::Depth);
QGLFramebufferObjectFormat format;
format.setSamples(8);
format.setAttachment(QGLFramebufferObject::Depth);
QGLFramebufferObject fbo(width, height, format);
const QColor col = _view->getViewer()->backgroundColor();
bool on = _view->getViewer()->hasGradientBackground();

Expand All @@ -683,7 +686,7 @@ Py::Object View3DInventorPy::saveImage(const Py::Tuple& args)

QColor bg;
QString colname = QString::fromLatin1(cColor);
if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive))
if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive) == 0)
bg = QColor(); // assign an invalid color here
else
bg.setNamedColor(colname);
Expand Down Expand Up @@ -743,7 +746,7 @@ Py::Object View3DInventorPy::saveVectorGraphic(const Py::Tuple& args)

QColor bg;
QString colname = QString::fromLatin1(name);
if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive))
if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive) == 0)
bg = _view->getViewer()->backgroundColor();
else
bg.setNamedColor(colname);
Expand Down

0 comments on commit efe414e

Please sign in to comment.