<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Robert,<div><br></div><div>Your answer almost fixed my issue. There is just one problem wsi->getScreenSettings(), still queries the wrong session:</div><div><br></div><div><div>1 screen(s) detected</div><div>Invalid MIT-MAGIC-COOKIE-1 keyUnable to open display ":0.1".</div><div> Screen #0 : 0x0 0Hz 0 bit</div></div><div><br></div><div>The problem is screen_id(screen), since it is not 0. The proper call would be:</div><div><br></div><div>osg::GraphicsContext::ScreenIdentifier screen_id(main_screen_id.hostName, main_screen_id.displayNum, screen);<br></div><div><br></div><div>I will update the test repo with the proper code. </div><div><br></div><div>Thank you very much for your time. If nobody else feels like doing it, I can help with updating <span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">osg::GraphicsContext::</span><wbr style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">WindowingSystemInterface.</span></div><div><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Cheers,</span></div><div><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:12.8px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Omar.</span></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-09-05 16:50 GMT+02:00 Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 5 Sep 2018 at 15:22, Julien Valentin <<a href="mailto:julienvalentin51@gmail.com">julienvalentin51@gmail.com</a>> wrote:<br>
> for your code you should replace<br>
> wsi->getNumScreens()<br>
> with<br>
> wsi->getNumScreens(osg::<wbr>GraphicsContext::<wbr>ScreenIdentifier(1))<br>
> to work on DISPLAY=:1.0<br>
<br>
</span>Sounds like we are getting to the bottom of things now :-)<br>
<br>
FYI, WindowingSystemInterface::<wbr>getNumScreens() is implemented in<br>
include/osg/GraphicsContext as:<br>
<br>
virtual unsigned int getNumScreens(const ScreenIdentifier&<br>
screenIdentifier = ScreenIdentifier()) = 0;<br>
<br>
The default constructed ScreenIdentifier is:<br>
<br>
GraphicsContext::<wbr>ScreenIdentifier::<wbr>ScreenIdentifier():<br>
displayNum(0),<br>
screenNum(0) {}<br>
<br>
Which is fine if the system doesn't change the default DISPLAY from 0.0.<br>
<br>
Support for DISPLAY is actually built into ScreenIdentifier via the<br>
readDISPLAY() method:<br>
<br>
/** Read the DISPLAY environmental variable, and set the<br>
ScreenIdentifier accordingly.<br>
* Note, if either of displayNum or screenNum are not<br>
defined then -1 is set respectively to<br>
* signify that this parameter has not been set. When<br>
parameters are undefined one can call<br>
* call setUndefinedScreenDetailsToDef<wbr>aultScreen() after<br>
readDISPLAY() to ensure valid values. */<br>
void readDISPLAY();<br>
<br>
To is not called by the constructor though, so you need to call it<br>
explicitly. The various Viewer config implementations do actually<br>
call readDISPLAY:<br>
<br>
~/OpenSceneGraph/src/<wbr>osgViewer$ grep readDISPLAY */*.cpp<br>
config/AcrossAllScreens.cpp: si.readDISPLAY();<br>
config/<wbr>PanoramicSphericalDisplay.cpp: si.readDISPLAY();<br>
config/SingleWindow.cpp: traits->readDISPLAY();<br>
config/SingleWindow.cpp: si.readDISPLAY();<br>
config/SphericalDisplay.cpp: si.readDISPLAY();<br>
config/WoWVxDisplay.cpp: si.readDISPLAY();<br>
<br>
So I'd suggest using this, such as (modified main.cpp for osgtest:<br>
<span class=""><br>
std::cout << wsi->getNumScreens() << " screen(s) detected" << std::endl;<br>
for ( unsigned int screen=0 ; screen <<br>
</span>wsi->getNumScreens(main_<wbr>screen_id); screen++ )<br>
<span class=""> {<br>
osg::GraphicsContext::<wbr>ScreenIdentifier screen_id(screen);<br>
osg::GraphicsContext::<wbr>ScreenSettings screen_settings;<br>
wsi->getScreenSettings( screen_id, screen_settings );<br>
std::cout << " Screen #" << screen << " : "<br>
<< screen_settings.width << "x" <<<br>
screen_settings.height << " "<br>
<< screen_settings.refreshRate << "Hz "<br>
<< screen_settings.colorDepth << " bit" << std::endl;<br>
}<br>
<br>
</span>I have also attached the full modified file.<br>
<span class="HOEnZb"><font color="#888888"><br>
Robert.<br>
</font></span><br>______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
<br></blockquote></div><br></div>