From cf43fb60b0800d9f5bf5b7220a86afbb63aaad89 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Mon, 11 Nov 2013 21:40:49 +0100 Subject: Support for anti-aliasing --- .../graphics/openscenegraph/converter/OSGConverter.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp index 06a8a30..c742ec7 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp @@ -250,6 +250,15 @@ void OSGConverter::process(const SendRequest& req) { } } + bool antiAliased = true; + if (req.params.find("antialiased") != req.params.end()) { + if (iequals(req.params.find("antialiased")->second.atom, "off") || + iequals(req.params.find("antialiased")->second.atom, "0") || + iequals(req.params.find("antialiased")->second.atom, "false")) { + antiAliased = false; + } + } + // get the 3D scene osg::ref_ptr model = setupGraph(source, autoRotate); if (model->asGroup()->getNumChildren() == 0) { @@ -307,7 +316,14 @@ void OSGConverter::process(const SendRequest& req) { traits->width = width; traits->height = height; traits->pbuffer = true; + traits->readDISPLAY(); + if (antiAliased) { + traits->samples = 4; // to make anti-aliased. + osg::DisplaySettings* ds = osg::DisplaySettings::instance(); + ds->setNumMultiSamples(4); + viewer.setDisplaySettings(ds); + } osg::GraphicsContext *gc = osg::GraphicsContext::createGraphicsContext(traits.get()); -- cgit v0.12