OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

getWindowingSystemInterface() fails on Ubuntu 18.04


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Omar Álvarez
Guest





PostPosted: Wed Sep 05, 2018 10:43 am    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

    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?

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Wed Sep 05, 2018 11:21 am    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Hi Omar,

What happens when you run osgviewer? Do you get errors output to the console?

Do any of the OSG examples fail?

If we can't see the error in standard OSG examples then it may be
worth creating a small test program so that others can run it on their
own systems to see if we can establish a pattern and get to the bottom
of the issue.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Omar Álvarez
Guest





PostPosted: Wed Sep 05, 2018 11:58 am    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Hi Robert,

Thanks for the quick response.


I have created an example:


https://github.com/omaralvarez/osgtest



osgviewer runs fine, no errors in console. But if I use INFO, I can see:


Viewer::realize() - No valid contexts found, setting up view across all screens.



It may be related, but I'm not sure.


None of the examples I've tried have failed.


Cheers,


Omar. 




2018-09-05 13:19 GMT+02:00 Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>:
Quote:
Hi Omar,

What happens when you run osgviewer?  Do you get errors output to the console?

Do any of the OSG examples fail?

If we can't see the error in standard OSG examples then it may be
worth creating a small test program so that others can run it on their
own systems to see if we can establish a pattern and get to the bottom
of the issue.

Robert.
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 514
Location: France

PostPosted: Wed Sep 05, 2018 2:03 pm    Post subject:
Re: getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

WindowingSystemInterface is an interface implemented in system dependant osgViewer::XXXWindowingSystemInterface
What may be done is to add a system agnotistic windowInterface in osgviewer

#ifdef SYS
typedef osgViewer::SYSWindowingSystemInterface osgViewer::WindowingInterface
#else if SYS2
typedef osgViewer::SYS2WindowingSystemInterface osgViewer::WindowingInterface

In your case try to use osgUtil::X11WindowingSystemInterface

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Wed Sep 05, 2018 2:15 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

HI Julian,

On Wed, 5 Sep 2018 at 15:10, Julien Valentin <> wrote:
Quote:
WindowingSystemInterface is an interface implemented in system dependant osgViewer::XXXWindowingSystemInterface
What may be done is to add a system agnotistic windowInterface in osgviewer

#ifdef SYS
typedef osgViewer::SYSWindowingSystemInterface osgViewer::WindowingInterface
#else if SYS2
typedef osgViewer::SYS2WindowingSystemInterface osgViewer::WindowingInterface

In your case try to use osgUtil::X11WindowingSystemInterface

The WindowingSystemInterface is meant to be accessed in a windowing
agnostic way, end user application shouldn't need to access the
windowing specific version. Omar's code look normal in this respect.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 514
Location: France

PostPosted: Wed Sep 05, 2018 2:17 pm    Post subject:
Re: getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Sorry I misinterpreted the code and said bullshit
there's really bug in X11WindowingSystemInterface reporting 0 screens

mp3butcher wrote:
WindowingSystemInterface is an interface implemented in system dependant osgViewer::XXXWindowingSystemInterface
What may be done is to add a system agnotistic windowInterface in osgviewer

#ifdef SYS
typedef osgViewer::SYSWindowingSystemInterface osgViewer::WindowingInterface
#else if SYS2
typedef osgViewer::SYS2WindowingSystemInterface osgViewer::WindowingInterface

In your case try to use osgUtil::X11WindowingSystemInterface

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 514
Location: France

PostPosted: Wed Sep 05, 2018 2:23 pm    Post subject:
Re: getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Sorry again
After a lot of bullshit here's a correct answer
for your code you should replace
wsi->getNumScreens()
with
wsi->getNumScreens(osg::GraphicsContext::ScreenIdentifier("",1,0))
to work on DISPLAY=:1.0

mp3butcher wrote:
Sorry I misinterpreted the code and said bullshit
there's really bug in X11WindowingSystemInterface reporting 0 screens

mp3butcher wrote:
WindowingSystemInterface is an interface implemented in system dependant osgViewer::XXXWindowingSystemInterface
What may be done is to add a system agnotistic windowInterface in osgviewer

#ifdef SYS
typedef osgViewer::SYSWindowingSystemInterface osgViewer::WindowingInterface
#else if SYS2
typedef osgViewer::SYS2WindowingSystemInterface osgViewer::WindowingInterface

In your case try to use osgUtil::X11WindowingSystemInterface

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Wed Sep 05, 2018 2:52 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

On Wed, 5 Sep 2018 at 15:22, Julien Valentin <> wrote:
Quote:
for your code you should replace
wsi->getNumScreens()
with
wsi->getNumScreens(osg::GraphicsContext::ScreenIdentifier(1))
to work on DISPLAY=:1.0

Sounds like we are getting to the bottom of things now :-)

FYI, WindowingSystemInterface::getNumScreens() is implemented in
include/osg/GraphicsContext as:

virtual unsigned int getNumScreens(const ScreenIdentifier&
screenIdentifier = ScreenIdentifier()) = 0;

The default constructed ScreenIdentifier is:

GraphicsContext::ScreenIdentifier::ScreenIdentifier():
displayNum(0),
screenNum(0) {}

Which is fine if the system doesn't change the default DISPLAY from 0.0.

Support for DISPLAY is actually built into ScreenIdentifier via the
readDISPLAY() method:

/** Read the DISPLAY environmental variable, and set the
ScreenIdentifier accordingly.
* Note, if either of displayNum or screenNum are not
defined then -1 is set respectively to
* signify that this parameter has not been set. When
parameters are undefined one can call
* call setUndefinedScreenDetailsToDefaultScreen() after
readDISPLAY() to ensure valid values. */
void readDISPLAY();

To is not called by the constructor though, so you need to call it
explicitly. The various Viewer config implementations do actually
call readDISPLAY:

~/OpenSceneGraph/src/osgViewer$ grep readDISPLAY */*.cpp
config/AcrossAllScreens.cpp: si.readDISPLAY();
config/PanoramicSphericalDisplay.cpp: si.readDISPLAY();
config/SingleWindow.cpp: traits->readDISPLAY();
config/SingleWindow.cpp: si.readDISPLAY();
config/SphericalDisplay.cpp: si.readDISPLAY();
config/WoWVxDisplay.cpp: si.readDISPLAY();

So I'd suggest using this, such as (modified main.cpp for osgtest:

std::cout << wsi->getNumScreens() << " screen(s) detected" << std::endl;
for ( unsigned int screen=0 ; screen <
wsi->getNumScreens(main_screen_id); 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;
}

I have also attached the full modified file.

Robert.



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Wed Sep 05, 2018 2:56 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

I missed changing one of the getScreen() calls in main, so please use
the attached version.



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 514
Location: France

PostPosted: Wed Sep 05, 2018 3:05 pm    Post subject:
Re: getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Okay that's how it works
it would be good to integrate these changes in all examples using
osg::GraphicsContext::WindowingSystemInterface

robertosfield wrote:
I missed changing one of the getScreen() calls in main, so please use
the attached version.



------------------
Post generated by Mail2Forum

_________________
Twirling twirling twirling toward freedom
Back to top
View user's profile Send private message Visit poster's website
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Wed Sep 05, 2018 3:33 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

On Wed, 5 Sep 2018 at 16:10, Julien Valentin <> wrote:
Quote:
Okay that's how it works
it would be good to integrate these changes in all examples using
osg::GraphicsContext::WindowingSystemInterface

That sounds like you are volunteering :-)

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Omar Álvarez
Guest





PostPosted: Wed Sep 05, 2018 4:08 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Hi Robert,

Your answer almost fixed my issue. There is just one problem  wsi->getScreenSettings(), still queries the wrong session:


1 screen(s) detected
Invalid MIT-MAGIC-COOKIE-1 keyUnable to open display ":0.1".
  Screen #0 : 0x0 0Hz 0 bit



The problem is screen_id(screen), since it is not 0. The proper call would be:


osg::GraphicsContext::ScreenIdentifier screen_id(main_screen_id.hostName, main_screen_id.displayNum, screen);



I will update the test repo with the proper code. 


Thank you very much for your time. If nobody else feels like doing it, I can help with updating osg::GraphicsContext::WindowingSystemInterface.


Cheers,


Omar.







2018-09-05 16:50 GMT+02:00 Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>:
Quote:
On Wed, 5 Sep 2018 at 15:22, Julien Valentin < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
for your code you should replace
wsi->getNumScreens()
with
wsi->getNumScreens(osg::GraphicsContext::ScreenIdentifier(1))
to work on DISPLAY=:1.0

Sounds like we are getting to the bottom of things now Smile

FYI, WindowingSystemInterface::getNumScreens() is implemented in
include/osg/GraphicsContext as:

            virtual unsigned int getNumScreens(const ScreenIdentifier&
screenIdentifier = ScreenIdentifier()) = 0;

The default constructed ScreenIdentifier is:

GraphicsContext::ScreenIdentifier::ScreenIdentifier():
    displayNum(0),
    screenNum(0) {}

Which is fine if the system doesn't change the default DISPLAY from 0.0.

Support for DISPLAY is actually built into ScreenIdentifier via the
readDISPLAY() method:

            /** Read the DISPLAY environmental variable, and set the
ScreenIdentifier accordingly.
              * Note, if either of displayNum or screenNum are not
defined then -1 is set respectively to
              * signify that this parameter has not been set. When
parameters are undefined one can call
              * call setUndefinedScreenDetailsToDefaultScreen() after
readDISPLAY() to ensure valid values. */
            void readDISPLAY();

To is not called by the constructor though, so you need to call it
explicitly.  The various Viewer config implementations do actually
call readDISPLAY:

~/OpenSceneGraph/src/osgViewer$ grep readDISPLAY */*.cpp
config/AcrossAllScreens.cpp:    si.readDISPLAY();
config/PanoramicSphericalDisplay.cpp:    si.readDISPLAY();
config/SingleWindow.cpp:    traits->readDISPLAY();
config/SingleWindow.cpp:        si.readDISPLAY();
config/SphericalDisplay.cpp:    si.readDISPLAY();
config/WoWVxDisplay.cpp:    si.readDISPLAY();

So I'd suggest using this, such as (modified main.cpp for osgtest:

    std::cout << wsi->getNumScreens() << " screen(s) detected" << std::endl;
    for ( unsigned int screen=0 ; screen <
wsi->getNumScreens(main_screen_id); 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;
    }

I have also attached the full modified file.

Robert.

_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Wed Sep 05, 2018 4:38 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Hi Omar,

On Wed, 5 Sep 2018 at 17:07, Omar Álvarez <> wrote:
Quote:
Thank you very much for your time. If nobody else feels like doing it, I can help with updating osg::GraphicsContext::WindowingSystemInterface.

This hasn't looked like an OSG bug too me, just a usage issue. What
specifically do you think might need changing with
WindowingSystemInterface?

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Omar Álvarez
Guest





PostPosted: Wed Sep 05, 2018 4:48 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Sorry, I meant the samples that use it. You're right. 

On Wed, Sep 5, 2018, 18:37 Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Omar,

On Wed, 5 Sep 2018 at 17:07, Omar Álvarez < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Thank you very much for your time. If nobody else feels like doing it, I can help with updating osg::GraphicsContext::WindowingSystemInterface.

This hasn't looked like an OSG bug too me, just a usage issue.  What
specifically do you think might need changing with
WindowingSystemInterface?

Robert.
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
ravidavi
User


Joined: 06 Nov 2015
Posts: 57

PostPosted: Thu Sep 06, 2018 4:18 pm    Post subject:
getWindowingSystemInterface() fails on Ubuntu 18.04
Reply with quote

Thanks guys for figuring this out. I ran into the exact same problem earlier this week with Ubuntu 18.04. I'm using CompositeViewer similar to the "-3" case of the osgcompositeviewer example (multiple Views in one window). I call osg::GraphicsContext::createGraphicsContext(traits) with my custom Traits, and of course was getting the "Unable to open display ":0.0""  error.


Robert's suggestion of calling "traits->readDISPLAY()" before creating the graphics context seems to have fixed it.


Ravi

On Wed, Sep 5, 2018 at 12:47 PM Omar Álvarez < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Sorry, I meant the samples that use it. You're right. 

On Wed, Sep 5, 2018, 18:37 Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Omar,

On Wed, 5 Sep 2018 at 17:07, Omar Álvarez < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Thank you very much for your time. If nobody else feels like doing it, I can help with updating osg::GraphicsContext::WindowingSystemInterface.

This hasn't looked like an OSG bug too me, just a usage issue.  What
specifically do you think might need changing with
WindowingSystemInterface?

Robert.
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Compiling vertext shader fails on Intel loopy General 7 Fri Dec 14, 2018 7:28 pm View latest post
No new posts CMake fails to find latest FBX SDK fo... a.terenzi Build system [build] 0 Fri Jan 19, 2018 9:45 am View latest post
No new posts CMake fails to generate project for iOS a.terenzi Build system [build] 0 Fri Jan 19, 2018 9:32 am View latest post
No new posts Osg 3.4.1 - Tutorial 12 Fails on Mac ... digitorus General 1 Sat Nov 04, 2017 12:32 pm View latest post
No new posts OpenThreads Pthread.cpp fails to comp... crubel@compro.net Submission 3 Tue Nov 29, 2016 9:26 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP