<div dir="ltr">Hi Sandro,<br><div class="gmail_extra"><br><div class="gmail_quote">On 21 August 2017 at 17:21, Sandro Mani <span dir="ltr"><<a href="mailto:manisandro@gmail.com" target="_blank">manisandro@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">Are you building the OSG with
            defaults?  Or are you building the OSG for just GL3?<br>
          <span class="gmail-"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra">
        </div>
      </div>
    </blockquote></span>
    %cmake -DBUILD_OSG_EXAMPLES=ON -DBUILD_DOCUMENTATION=ON
    -DOSG_GL1_AVAILABLE=ON -DOSG_GL2_AVAILABLE=ON
    -DOPENGL_PROFILE=GLCORE -DOPENGL_HEADER1="#include <GL/gl.h>"<span class="gmail-"><br></span></div></blockquote><div><br></div><div>That's a bit of ugly mix.  Things should work with just:<br><br></div><div>cmake .<br></div><div>make -j 4   # 4 is number of cores available<br><br></div><div>When you using the OPENGL_PROFILE it'll set the OSG_*_AVAILABLE options for you, but in general build with defaults unless you specifically need a particular feature set.  <br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><span class="gmail-">
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>What viewer are using with osgEarth?  osgEarth itself
              is typically used as NodeKit with end user application
              creating their own viewer and with it graphics contexts. 
              This means even if osgEarth's own example programs changed
              the way they create graphics context you'd end up with
              issues.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote></span>
    Running with osgearth_viewer, I get two calls to
    osgViewer::GraphicsWindowX11::<wbr>init. The first one where, I assume,
    it tries to determine the capabilities of hardware/driver in use,
    and this calls Traits without a DisplaySettings instance:<br>
    <br>
    #0  osgViewer::GraphicsWindowX11::<wbr>init (this=this@entry=0x1004ad330)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/<wbr>GraphicsWindowX11.cpp:915<br>
    #1  0x00007f3e23ae4b50 in
    osgViewer::GraphicsWindowX11::<wbr>GraphicsWindowX11 (traits=0x1003760d0,
    this=<optimized out>)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/include/osgViewer/api/X11/<wbr>GraphicsWindowX11:56<br>
    #2  X11WindowingSystemInterface::<wbr>createGraphicsContext
    (this=<optimized out>, traits=0x1003760d0)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/<wbr>GraphicsWindowX11.cpp:2269<br>
    #3  0x00007f3e241e81b7 in
    osg::GraphicsContext::<wbr>createGraphicsContext
    (traits=traits@entry=<wbr>0x1003760d0)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osg/GraphicsContext.<wbr>cpp:128<br>
    #4  0x00007f3e2350c256 in MyGraphicsContext::<wbr>MyGraphicsContext
    (this=<synthetic pointer>)<br>
        at
/usr/src/debug/osgearth-2.9-0.<wbr>2.git43d4ba5.fc27.x86_64/src/<wbr>osgEarth/Capabilities.cpp:76<br>
    #5  osgEarth::Capabilities::<wbr>Capabilities (this=0x100390f30)<br>
        at
/usr/src/debug/osgearth-2.9-0.<wbr>2.git43d4ba5.fc27.x86_64/src/<wbr>osgEarth/Capabilities.cpp:162<br>
    #6  0x00007f3e236897a5 in osgEarth::Registry::<wbr>initCapabilities
    (this=0x1002a7af0)<br>
        at
/usr/src/debug/osgearth-2.9-0.<wbr>2.git43d4ba5.fc27.x86_64/src/<wbr>osgEarth/Registry.cpp:484<br>
    #7  0x00007f3e23689829 in osgEarth::Registry::<wbr>getCapabilities
    (this=0x1002a7af0)<br>
        at
/usr/src/debug/osgearth-2.9-0.<wbr>2.git43d4ba5.fc27.x86_64/src/<wbr>osgEarth/Registry.cpp:468<br>
    #8  0x00007f3dfa209486 in osgEarth::Registry::<wbr>capabilities ()<br>
        at
/usr/src/debug/osgearth-2.9-0.<wbr>2.git43d4ba5.fc27.x86_64/src/<wbr>osgEarth/Registry:149<br>
    #9 
osgEarth::Drivers::<wbr>MPTerrainEngine::<wbr>MPTerrainEngineNode::<wbr>MPTerrainEngineNode
    (this=0x100a1ac60)<br>
        at
/usr/src/debug/osgearth-2.9-0.<wbr>2.git43d4ba5.fc27.x86_64/src/<wbr>osgEarthDrivers/engine_mp/<wbr>MPTerrainEngineNode.cpp:202<br>
    [...]<br>
    <br>
    Then, a second time here:<br>
    <br>
    #0  osgViewer::GraphicsWindowX11::<wbr>init (this=this@entry=0x100676840)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/<wbr>GraphicsWindowX11.cpp:915<br>
    #1  0x00007f3e23ae4b50 in
    osgViewer::GraphicsWindowX11::<wbr>GraphicsWindowX11 (traits=0x10052c100,
    this=<optimized out>)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/include/osgViewer/api/X11/<wbr>GraphicsWindowX11:56<br>
    #2  X11WindowingSystemInterface::<wbr>createGraphicsContext
    (this=<optimized out>, traits=0x10052c100)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/<wbr>GraphicsWindowX11.cpp:2269<br>
    #3  0x00007f3e241e81b7 in
    osg::GraphicsContext::<wbr>createGraphicsContext
    (traits=traits@entry=<wbr>0x10052c100)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osg/GraphicsContext.<wbr>cpp:128<br>
    #4  0x00007f3e23a7ab62 in osgViewer::SingleWindow::<wbr>configure
    (this=0x100a2a370, view=...)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/config/<wbr>SingleWindow.cpp:72<br>
    #5  0x00007f3e23a7a80a in osgViewer::SingleScreen::<wbr>configure
    (this=<optimized out>, view=...)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/config/<wbr>SingleScreen.cpp:29<br>
    #6  0x00007f3e23a75207 in osgViewer::AcrossAllScreens::<wbr>configure
    (this=<optimized out>, view=...)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/config/<wbr>AcrossAllScreens.cpp:48<br>
    #7  0x00007f3e23ab79c2 in osgViewer::View::apply
    (this=0x7fffffffdb00, config=0x1002a3770)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/View.cpp:456<br>
    #8  0x00007f3e23ab7b00 in osgViewer::View::<wbr>setUpViewAcrossAllScreens
    (this=<optimized out>)<br>
        at
/usr/src/debug/OpenSceneGraph-<wbr>3.5.7-0.2.gitbfbaeca.fc27.x86_<wbr>64/src/osgViewer/View.cpp:463<br>
    [...]<br>
    <br>
    using ViewAcrossAllScreens as you anticipated and hence the default
    DisplaySettings. Since by default a "1.0" context is created, the
    result is:<br>
    <br>
    FRAGMENT glCompileShader "main(fragment)" FAILED<br>
    FRAGMENT Shader "main(fragment)" infolog:<br>
    0:1(10): error: GLSL 3.30 is not supported. Supported versions are:
    1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES<br>
    <br>
    etc.<br>
    <br>
    If I add<span class="gmail-"><br>
    <br>
    osg::DisplaySettings::<wbr>instance()-><wbr>setGLContextVersion( "4.0" );<br>
    osg::DisplaySettings::<wbr>instance()-><wbr>setGLContextProfileMask( 0x1 );<br>
    <br></span>
    at the beginning of a tweaked osgearth_viewer.cpp@main, things work
    (though possibly osgEarth::Capabilities::<wbr>Capabilities will have
    incorrectly determined some things since a "1.0" context was created
    there). The same effect can indeed be achieved by using the
    environment variables you mention.<br></div></blockquote><div><br></div><div>Try using the OSG_GL_CONTEXT_VERSION and OSG_GL_CONTEXT_PROFILE_MASK env vars instead of the above DisplaySettings::instance() code i,e,<br><br></div><div>export OSG_GL_CONTEXT_VERSION=4.0<br></div><div>export OSG_GL_CONTEXT_PROFILE_MASK=1</div><div> <br></div><div>This will still require the merged changes to OSG master, but as long as the ViewAcrossAllScreens is used the DisplaySettings::instance() should automatically initialize with the correct values.<br><br></div><div>Robert.<br></div></div></div></div>