Quantcast

ModelLayer not displaying when adding a FeatureDisplayLayout

classic Classic list List threaded Threaded
12 messages Options
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ModelLayer not displaying when adding a FeatureDisplayLayout

I'm basically trying to recreate the boston_buildings.earth example programmatically.  Here is my function that adds the ModelLayer:

void Earth::addModelLayer(QString fileName, QString layerName)
{
    OGRFeatureOptions featureOptions;
    featureOptions.url() = fileName.toStdString();
    featureOptions.buildSpatialIndex() = true;

    Style style("buildings");
    ExtrusionSymbol *exSymbol = style.getOrCreateSymbol<ExtrusionSymbol>();
    exSymbol->heightExpression() = NumericExpression("3.5 * max([story_ht_], 1)");

    //FeatureDisplayLayout layout;
    //layout.tileSizeFactor() = 45;

    //FeatureLevel level(0, 20000, "buildings");
    //layout.addLevel(level);

    FeatureGeomModelOptions featureGeomModelOptions;
    featureGeomModelOptions.featureOptions() = featureOptions;
    featureGeomModelOptions.styles() = new StyleSheet();
    featureGeomModelOptions.styles()->addStyle(style);
    //featureGeomModelOptions.layout() = layout;

    ModelLayerOptions layerOptions(layerName.toStdString(),
                                   featureGeomModelOptions);
    layerOptions.lightingEnabled() = true;

    ModelLayer *modelLayer = new ModelLayer(layerOptions);

    addModelLayer(modelLayer);
}

This works great.  It takes a minute or two to load and locks up the application, but the buildings eventually show (they're not textured, but I'm taking it one step at a time).  When I uncomment the commented code, the function finishes instantly (as I expected thinking it will load in the background now), there are no errors output when setting OSGEARTH_NOTIFY_LEVEL to DEBUG, and the geometry never shows.  I waited for a good 10 minutes.  After reading the documentation, I was thinking maybe the min_expiry_time had something to do with it, but I can't figure out how to set it programmatically.  Am I missing something?

Thank you,
Scott
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

I found the osgearth_city example.  Unfortunately none of the ModelLayers are showing in that either.  I get 3 "[osgEarth]* [FeatureModelSource] Invalid feature source" errors as well.  I'm using osgEarth 2.7.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Hi Scott,
osgearth_city seems to be working in 2.8 and master. Can you try updating to a newer version?
Glenn Waldron / Pelican Mapping
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Hi Glenn,

osgearth_city still doesn't work for me.  I get this error now.

[osgEarth]* [FeatureFilterRegistry] ILLEGAL- no driver set for feature filter

Thank you,
Scott
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

In reply to this post by gwaldron
I updated to 2.8 and I'm linking against OSG 3.4.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

In reply to this post by Scott Shaw
Not enough info. Doesn't start? Doesn't show any buildings?
Please post the entire output log. Thanks.
Glenn Waldron / Pelican Mapping
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Same issue (none of the shape files are loading).  Attached is the entire log.debug.log
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Scott,
The only off thing I see is an OpenGL error:
Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)

Otherwise, hard to say what the problem is. Perhaps you can try with the master branch which has better error reporting.
Glenn Waldron / Pelican Mapping
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Glenn,

Thanks for your help!  Here is the new debug log.  Not sure it's going to help, but it's worth a try.  Maybe you'll see something I don't.

Thanks again,
Scott
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Glenn,

Here is something interesting that was output from my code that might shed some light on the issue.  I have OpenGL 3.3 installed:

VERTEX glCompileShader "main(vertex)" FAILED
VERTEX Shader "main(vertex)" infolog:
WARNING: 0:3: extension 'GL_ARB_gpu_shader5' is not supported
ERROR: 0:21: 'flat' : syntax error syntax error


FRAGMENT glCompileShader "main(fragment)" FAILED
FRAGMENT Shader "main(fragment)" infolog:
WARNING: 0:3: extension 'GL_ARB_gpu_shader5' is not supported
ERROR: 0:7: 'flat' : syntax error syntax error


glLinkProgram "" FAILED
VERTEX glCompileShader "main(vertex)" FAILED
VERTEX Shader "main(vertex)" infolog:
WARNING: 0:3: extension 'GL_ARB_gpu_shader5' is not supported
ERROR: 0:25: 'flat' : syntax error syntax error


FRAGMENT glCompileShader "main(fragment)" FAILED
FRAGMENT Shader "main(fragment)" infolog:
WARNING: 0:3: extension 'GL_ARB_gpu_shader5' is not supported
ERROR: 0:7: 'flat' : syntax error syntax error


glLinkProgram "osgEarth.engine_mp.TerrainNode" FAILED

Thank you,
Scott
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

Scott,
Thanks. For now, I recommend you install a newer driver for your Intel HD 4000.
Glenn Waldron / Pelican Mapping
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ModelLayer not displaying when adding a FeatureDisplayLayout

For anyone having the same issue, it seems after reading this that setting tileSizeFactor and min/maxRange and setting a level don't work well together.  I replaced the commented code with this:

FeatureDisplayLayout layout;
layout.tileSize() = 1000;

FeatureLevel level(0.0f, FLT_MAX);
layout.addLevel(level);

and added the layout (uncomment featureGeomModelOptions.layout() = layout) and it seems to work.
Loading...