[osg-users] getWindowingSystemInterface() fails on Ubuntu 18.04
Omar Álvarez
omar.alvarez at cinfo.es
Wed Sep 5 03:41:26 PDT 2018
osg::GraphicsContext::WindowingSystemInterface* wsi =
osg::GraphicsContext::getWindowingSystemInterface();
if ( !wsi ) {
std::cout << "ERROR. Could not access the Windowing System
Interface" << std::endl;
throw -1;
}
std::cout << wsi->getNumScreens() << " screen(s) detected" << std::endl;
for ( unsigned int screen=0 ; screen < wsi->getNumScreens(); screen++ )
{
osg::GraphicsContext::ScreenIdentifier screen_id(screen);
osg::GraphicsContext::ScreenSettings screen_settings;
wsi->getScreenSettings( screen_id, screen_settings );
std::cout << " Screen #" << screen << " : "
<< screen_settings.width << "x" << screen_settings.height
<< " "
<< screen_settings.refreshRate << "Hz "
<< screen_settings.colorDepth << " bit" << std::endl;
}
This simple code snippet fails for me on Ubuntu 18.04 (OSG 3.6.2 and 3.4.0)
with:
Invalid MIT-MAGIC-COOKIE-1 keyA Unable to open display ":0.0"
Invalid MIT-MAGIC-COOKIE-1 keyA Unable to open display ":0.0"
0 screen(s) detected
Invalid MIT-MAGIC-COOKIE-1 keyA Unable to open display ":0.0"
I have a dedicated NVIDIA GPU with latest drivers (396), running osgviewer
works properly. I also checked that getWindowingSystemInterface is being
called at the correct time. I have tested this after creating a viewer and
it also fails.
RegisterWindowingSystemInterfaceProxy()
X11WindowingSystemInterface()
GraphicsContext::setWindowingSystemInterface() 0x55aada1ee9d0
0x7f69e2fc9978
GraphicsContext::getWindowingSystemInterface() 0x55aada1ee9d0
0x7f69e2fc9978
Another thing that makes no sense is that my X session is not :0.0 but
:1.*, but no matter what $DISPLAY environment variable has, it is ignored,
it is looking for screens in the wrong X session. At this point I don't
know what else to try. Am I doing something wrong? Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180905/5ef0614c/attachment.html>
More information about the osg-users
mailing list