qtopenscenegraphosgearth

Lines not showing up in osgEarth & Qt


I am attempting to use osgEarth in a Qt (5.12) application on Windows, and I am having some trouble with it showing lines - as in, they are simply not showing up.

Following some of the instructions to build osg, osgQt, and osgEarth here on Stack Overflow, I managed to get everything to build and run.

If I run the osgearth_windows with the annotation.earth file, it runs fine, and I see some shapes with borders, and a few lines on the globe.

If I run with my osgQt app, I see the shapes and labels, but no borders on shapes or separate lines.

I'm curious if anyone has experienced this previously, and if there are some settings I should be doing with Qt that will resolve this issue.

Similarly, if I try some of built osgEarth sample programs, such as the osgearth_features.exe, I will see the globe and yellow borders around every country. If I follow the code in there, (the way it creates a Map, then loads the basemap, then the FeatureSoureLayer, etc), I can see the globe, and labels in my Qt app, but still no lines.

Again, I have also had another at another Stack Overflow question (How to add osgEarth Features at runtime?) and tried the solution of adding a PolygonSymbol to the Map. I can see the green triangle, but do not see the border on it.

Any help would be greatly appreciated!


Solution

  • Make sure you are calling this:

    #include <osgEarth/GLUtils>
    ...
    GLUtils::setGlobalDefaults(camera->getOrCreateStateSet());
    

    Where camera is the camera in the main view, or another node at the top of the scene graph.

    The shader that renders lines needs some default uniform values to be initialized. This code does that.