[osg-users] Offscreen rendering with multisampling

Krzysztof Rahn Krzysztof.Rahn+OpenSceneGraph at gmail.com
Fri Dec 9 02:01:45 PST 2016


Hello everyone,

I'm working on a company project that displays navigation maps for ships with OpenSceneGraph.
The product we develop is a library that generates map images, so a customer (developer)
can use our library to develop its own navigation system.

This requires to generate a offscreen image and if possible an antialiased one.
Unfortunately we can not generate a antialiased offscreen image.

I already tried 
> osg::DisplaySettings::instance()->setNumMultiSamples(4);

and 
> traits->samples = 4;
 to create a osg::GraphicsContext
but this only works with a window generated from OpenSceneGraph or
with a embedded context (osgViewer::GraphicsWindowEmbedded()).

I know we can enable "GL_LINE_SMOOTH". This is what we use at this moment and it is
working with offscreen rendering but we really need multisampling for better results (or any other form of anitaliasing).

I created a small peace of C++ sourcecode on a Linux system that does offscreen rendering (with a pbuffer)
into a tga image file (I think you also need OpenSceneGraph plugins for that to work),
so you can roughly see how we use it at this moment (without GL_LINE_SMOOTH to keep it simple).

Of course I looked into the examples and this peace of code is based of one of them.
But I could not spot anything in the examples that could help me.
I also searched in the forum on this topic but most threads about offscreen rendering don't consider if multisampling is enabled.

I would really appreciate if someone could help us with this small code in the right direction
or make any suggestion if there is any other way to solve this if OpenSceneGraph is not able to do this.

A main.cpp and a CMakeLists.txt should be attached to this post.

Thank you very much,
  Kris

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=69644#69644




Attachments: 
http://forum.openscenegraph.org//files/cmakelists_664.txt
http://forum.openscenegraph.org//files/main_667.cpp





More information about the osg-users mailing list