[osg-users] "Error: Not able to create requested visual." for osg application utilizing multi-sampling, ran with optirun.

Hamza Alloush hamzaalloush at live.com
Thu Aug 20 12:43:06 PDT 2015


Hello,

I'v been having trouble using optirun with the virtualgl rendering bridge, and an osg app utilizing multi-sampling.

using this simple example(attached also):



#include <stdio.h>
#include <stdlib.h>
#include <osgViewer/Viewer>
#include <osg/ShapeDrawable>
 
osg::Node* createScene()
{
    osg::Geode* geode = new osg::Geode();

    geode->addDrawable( new osg::ShapeDrawable( new osg::Cylinder(osg::Vec3(-2.0f,0.0f,-2.0f),1.5f,2.0f) ) );
    geode->addDrawable( new osg::ShapeDrawable( new osg::Cylinder(osg::Vec3(2.0f,0.0f,-2.0f),1.5f,2.0f) ) );
    geode->addDrawable( new osg::ShapeDrawable( new osg::Cylinder(osg::Vec3(2.0f,0.0f,2.0f),1.5f,2.0f) ) );
    geode->addDrawable( new osg::ShapeDrawable( new osg::Cylinder(osg::Vec3(-2.0f,0.0f,2.0f),1.5f,2.0f) ) );

    return geode;
}

int main(int argc, char* argv[])
{
    // construct the viewer
    osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;

    // full screen antialiasing (if supported)
    osg::DisplaySettings::instance()->setNumMultiSamples( 4 );

    // make the viewer create a 512x512 window and position it at 32, 32
    viewer->setUpViewInWindow( 32, 32, 512, 512 );

    // set the scene-graph data the viewer will render
    viewer->setSceneData( createScene() );

    // execute main loop
    return viewer->run();
}



, as well as an actual app, like Flight Gear with multi-sampling enabled, would trigger an error such as:

Error: Not able to create requested visual.
  GraphicsWindow has not been created successfully.

if i used a primus rendering bridge(/usr/bin/optirun -b primus), or actually used the Nvidia driver without Optimus technology, the problem does not show. it only does show if i used an osg multi-sampled application using virtualgl as a rendering bridge for optirun, which is the default.

i used GDB to troubleshoot the built example, the problem is that the main function is considered one "frame", so a backtrace was useless, but i was able to narrow it down:

breakpoint at line 27:

(gdb) b 27
Breakpoint 1 at 0x40102d: file mutlisample.cpp, line 27.
(gdb) run
Starting program: /home/hamza/build/fgbuild/openscenegraph/src/multitest 
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=1, argv=0x7fffffffdd48) at mutlisample.cpp:27
27        viewer->setUpViewInWindow( 32, 32, 512, 512 );
(gdb) bt
#0  main (argc=1, argv=0x7fffffffdd48) at mutlisample.cpp:27

breakpoint at line 28:

(gdb) b 28
Breakpoint 2 at 0x401060: file mutlisample.cpp, line 28.
(gdb) run
Starting program: /home/hamza/build/fgbuild/openscenegraph/src/multitest 
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Error: Not able to create requested visual.
  GraphicsWindow has not been created successfully.

Breakpoint 2, main (argc=1, argv=0x7fffffffdd48) at mutlisample.cpp:30
30        viewer->setSceneData( createScene() );
(gdb) bt
#0  main (argc=1, argv=0x7fffffffdd48) at mutlisample.cpp:30



any tips would be appreciated

Thanks
Hamza 		 	   		  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mutlisample.cpp
Type: text/x-c
Size: 1131 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150820/1bfd0567/attachment-0002.bin>


More information about the osg-users mailing list