black screen with drape mode in a QOpenGLWidget

classic Classic list List threaded Threaded
11 messages Options
JD JD
Reply | Threaded
Open this post in threaded view
|

black screen with drape mode in a QOpenGLWidget

I'm using a QOpenGLWidget to display a map loaded with osgearth.
but when one of the model in the .earth is in "drape" the screen remains black. As soon as I remove this parameter the model is displayed but poorly (the drape is necessary).
Any idea of what might cause the problem?

Initialy I used the GLWidget which managed correctly the drape mode but I didn't mix the context with the qt objects that I added to the GLWidget: i.e. if I add a round qt button I have a black box around the button instead of the map.

Thanks in advance for your help,
monitor monitor
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

I've had the same problem,No solution has been found so far!

Did you solve your problem,Thanks in advance for your help!
JD JD
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

Unfortunately no. And you, did you fix the issue?
I think it has something to do with the shaders as the draped technique uses them...
DizL DizL
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

This post was updated on .
Hi,

I've got similar problem.
Initially when I only have Qt&OSG Widget opened everything works ok (even with drape) (thanks to CanOlcek from OpenSceneGraph forum http://forum.openscenegraph.org/viewtopic.php?t=15097), but when I add another QDockWidget which is for example QQuickView or VLC-qt widget again everything becomes black :/

Any help?

regards,
DizL
JD JD
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

For explaining in more details:
My QOpenGLWidget implementation works until I set a drape model visible. In that case I see traces in the console showing that a shader is loaded (no error traces). Then the Osg display is froozen to what was displayed (no back screen but no more repaint). However the application responds to user inputs: Effectively I can manipulate the map with the mouse and I can see the viewpoint modifiction on the traces. It is "just" a repaint problem. I don't where to search... Any idea? (Note that it is not a FrameBufferObject implementation).

Thanks
ShaderMan ShaderMan
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

Hi JD ! It might be related to the fact that the drape technique uses a stencil buffer to project objects on the ground. I dont know the details of QOpenGLWidget but check if it has an active stencil buffer. http://github.com/gwaldron/osgearth/blob/master/src/osgEarth/DrapingTechnique
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

The draping does NOT use a stencil buffer by default (the header comment is wrong and we will correct it).
Glenn Waldron / Pelican Mapping
JD JD
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

It seems to be a problem with the graphiccontext which seems "lost" but i don't understand enough the deep technical aspects.
I let the QOpenGLWidget down and I tried a new approach with the plugins here:
https://github.com/podsvirov/osgqtquick/wiki/osgQtQuick-2.0

Again, It works until I insert a draped model! Does anybody already tried this code? And does it work with draped models?
What are the specificities of the draping technique which might cause the issue?

Thanks all.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

JD,
Sorry for the delay, I have been on travel.

Don't know the answer, but the draping technique works by creating an FBO, rendering a subgraph to that FBO, and then using that FBO as another texture on the terrain. So perhaps Qt is unhappy with the creation of the FBO in some respect. Just speculating though.
Glenn Waldron / Pelican Mapping
JD JD
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

I finally found a patch following the explanations here (thank you Jason for the link):
http://trac.openscenegraph.org/projects/osg//wiki/Support/FAQ#CanIuseOSGwithinanexistingrenderer

Attribs must be saved after frame() and restore before frame().
Moreover a reset of OpenGLState must be called each frame.

The paint method is just:

------------------------------------------------------
    if (! m_rendererInitialised)
    {
        m_rendererInitialised = true;
    }
    else
    {
        glPopAttrib();
    }

    m_viewer->frame();

    glPushAttrib( GL_ALL_ATTRIB_BITS );

    m_window->resetOpenGLState();
-----------------------------------------------------------

Note that I am no more using Q***GLWidget. I worked from the Qt example:
http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

The solution works fine for my needs.
However, the pop/push attrib patch may work for other Qt / Osg mixing methods...
fjouhaud fjouhaud
Reply | Threaded
Open this post in threaded view
|

Re: black screen with drape mode in a QOpenGLWidget

Hello,

I have the same problem.
I use Qt to display osgearth viewer as viewport of a QGraphicsView via a QOpenGlWidget.
Every things is ok except when I try to load an imageoverlay or a model with the clamping style terrain + drape.
I have also a similar problem on IOS when I'm using the osgearth viewer without Qt.
I would like to know if someone have found a solution to this problem.

PS: I think with the JD solution (using QtQuick) the difference is the use of a complete window instead a widget.