earth file model feature upgrade question

classic Classic list List threaded Threaded
4 messages Options
jeladi jeladi
Reply | Threaded
Open this post in threaded view
|

earth file model feature upgrade question

I am trying to get country boundaries to show up in my osgEarth application but am not having much luck.  It worked in v2.8 but doesn't work in 3.0 on either Windows or Linux.  I am using the shapefile that I got from here in the Admin 0 - Countries section:

https://www.naturalearthdata.com/downloads/10m-cultural-vectors/

My 2.8 earth file looked like this for the country boundaries.  It starts off with visiblity off since I make this setting toggle-able in the menu:

<model name="borders" driver="feature_geom" overlay="true">
        <features name="10m_admin_0_countries" driver="ogr">
            <url>../data/country_boundaries/ne_10m_admin_0_countries.shp</url>
        </features>
        <styles>
            <style type="text/css"> borders { stroke: #ffffff; stroke-width: 2; altitude-clamping: terrain; altitude-technique: gpu; render-lighting: false; } </style>                </styles>
        <lighting>false</lighting>
        <visible>false</visible>
</model>

My 3.0 earth file looks like this:

<OGRFeatures name="10m_admin_0_countries">
    <url>../data/country_boundaries/ne_10m_admin_0_countries.shp</url>
        </OGRFeatures>
       
<FeatureModel name="borders" features="10m_admin_0_countries">
    <styles>
        <style type="text/css"> borders { stroke: #ffffff; stroke-width: 2; altitude-clamping: terrain; altitude-technique: gpu; render-lighting: false; }</style>             </styles>
</FeatureModel>

Did I convert that section to 3.0 correctly?  It never shows up on my globe.  If I run with debug messages on I get some messages that look like this:

[osgEarth]  [osgEarth]  [OGRFeatureSource] SQL: SELECT * FROM "ne_10m_admin_0_countries"
{
   "query" : {
      "extent" : {
         "xmax" : "0",
         "xmin" : "-45",
         "ymax" : "61.92983807137511576",
         "ymin" : "40.225575489750099223"
      }
   }
}

However, I also get a lot of messages that look like this:

[osgEarth]  [ClampingCullSet] Pushed 0x3cc9dd10 on frame 2c


gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: earth file model feature upgrade question

Your earth file is correct.
Maybe sure you are enabling the GL defaults in your application.

#include <osgEarth/GLUtils> 

GLUtils::setGlobalDefaults(camera->getOrCreateStateSet());

Glenn Waldron / Pelican Mapping
jeladi jeladi
Reply | Threaded
Open this post in threaded view
|

Re: earth file model feature upgrade question

I think I tried that GLUtils call yesterday after comparing ExampleResources.cpp against my own viewer initialization but for some reason it didn't work.  It works today so I must have had the call in the wrong place or something else I had done was interfering with it.

The country boundaries are showing up now but I am getting a lot of GL errors from Qt:

QOpenGLDebugMessage("APISource", 2311, "glEnable parameter <active texture> has an invalid value '31': must be less than 8 (GL_INVALID_VALUE)", "HighSeverity", "ErrorType")

When I look at the GLIntercept output I get this:
glActiveTexture(GL_TEXTURE31)
glEnable(GL_TEXTURE_2D) glGetError() = GL_INVALID_VALUE

I will step through the code in the debugger to see what is trying to use GL_TEXTURE31.

I also see this but I don't think it is part of the issue:

QOpenGLDebugMessage("APISource", 102, "glDrawElements uses element index type 'GL_UNSIGNED_BYTE' that is not optimal for the current hardware configuration; consider using 'GL_UNSIGNED_SHORT' instead", "MediumSeverity", "PerformanceType")
jeladi jeladi
Reply | Threaded
Open this post in threaded view
|

Re: earth file model feature upgrade question

Ok I figured out the reason for the error.  I needed to include a call to MapNode::open() that I missed during the port from 2.8 to 3.0.  That was the last remaining difference between my existing application and the new examples & ExampleResources.cpp.

So for those who may be experiencing similar issues when trying to upgrade from 2.8 to 3.0 -- in addition to porting my existing osgEarth API usage I had to add three calls at the proper places:

osgEarth::initialize()
GLUtils::setGlobalDefaults()
MapNode::open()

Anything else I may have missed?