+ fix transparency problem, support antialiasing, background color issue

This commit is contained in:
wmayer
2014-11-08 23:06:53 +01:00
parent 99caf6d015
commit efe414e4c2
2 changed files with 7 additions and 3 deletions

View File

@@ -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);

View File

@@ -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();
@@ -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);
@@ -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);