Hi,
you could have a look at the OSG-integration into our rendering
framework gloperate (github/hpicgs/gloperate), where I have implemented
a very similar setup. The OpenGL context is managed from the outside,
and OSG rendering is set up with setUpViewerAsEmbeddedInWindow, which
means that the OSG does not really know about the context and you have
to make sure the context is made current before rendering.
I also had the problem that it worked with OSG but not osgEarth, which I
tracked down to the following problem: On the first frame, osgEarth
initializes itself and queries its capabilities (see
osgEarth/Capabilities.cpp). To do that, it initializes a temporary
OpenGL context, queries OpenGL version and available functions, and then
releases the context. With a typical OSG setup, we have an OSG context
object that will be made current before rendering, so this makes no
problems. But when using setUpViewerAsEmbeddedInWindow, the OSG has no
way to make your context current, because it does not know about it. So,
after osgEarth is initialized, you have lost your OpenGL context and
have to make it current again before rendering.
Hope this helps,
Stefan
On 24/03/15 15:49, Sascha Voth wrote:
Hi,
I'm trying to render a scene node in a QtQuickItem. For this I used the Qt example
Scene Graph - Rendering FBOs as a base template:
qtquick-scenegraph-textureinsgnode-fboinsgrenderer-cpp @ qt.io
Additionally I found a Gists which does nearly the same thing I'm trying to
achieve:
gist:9bf4cec0aee18fc6e27b
On construction I create an EmbeddedWindow and a Viewer, and setup my scene.
Afterwards the createFramebufferObject is used to allocate the FBO and resize
the EmbeddedViewer and the Viewport. Rendering is triggered with a frame() call
inside the render function and the osg::Viewer is set up to run SingleThreaded.
As long as I use/add a simple osg::Node to the scene, e.g. cow.osg, everything
seems to work fine. As soon I start to change the CameraManipulator to
osgEarth::Util::EarthManipulator and use a osgearth::MapNode instead, the first
drawn frame is black, and changes only on re-sizing and recreating the FBO, but
only once. Afterwards, the render function is called, but frame() seems to not
render anything anymore.
I suppose something gets messed up with the OpenGLContext or osgEarth does not
work SingleThreaded, but I'm currently not able to understand the problem as a
whole. I even tried to create a new shared context like rickyviking/qmlosg at
github did, but could not get it to render a propre scene.
Any help would be appreciated!
Thank you!
Cheers,
Sascha
p.s.: I've tried different other approaches in advance, where many of them seem
to be outdated or lacking simple re-sizing functionality. My current
implementation uses a QQuickItem which has a re-implemented
QSGSimpleTextureNode which shares an FBO with an osg::Camera. But i cannot
manage to resize the fbo texture ...
p.p.s.: Sorry for not posting the links directly, but You must have 2 posts before
you can post URL's/Links. ...
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63192#63192
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org