PDA

View Full Version : How to enable OpenGL after porting from Qt 4 to Qt 5.1.1



zach
7th October 2013, 20:58
I compiled and installed Qt 5.1.1 on Ubuntu 12.04.
I ported our code from Qt 4 to Qt 5.1.1. The code runs with "-opengl false" option, but when OpenGL is used it crashes with the following message:

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

What do I need to do to enable these features?

Below is the call stack from gdb at the crash point:

#1 0x00007fffeeb804c6 in ?? () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
(gdb)
#2 0x00007fffeeb8060b in QOpenGLFunctions::initializeOpenGLFunctions() () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
(gdb)where
#0 0x00007fffee963c80 in QOpenGLContext::shareGroup() const () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#1 0x00007fffeeb804c6 in ?? () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#2 0x00007fffeeb8060b in QOpenGLFunctions::initializeOpenGLFunctions() () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#3 0x00007fffede3fe2e in QGL2PaintEngineEx::begin(QPaintDevice*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5OpenGL.so.5
#4 0x00007fffeeb0b967 in QPainter::begin(QPaintDevice*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#5 0x00007fffee4ad0a9 in QGraphicsView::paintEvent(QPaintEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#6 0x00007fffee1d1740 in QWidget::event(QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#7 0x00007fffee2b8d06 in QFrame::event(QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#8 0x00007fffee4ae3bb in QGraphicsView::viewportEvent(QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#9 0x00007fffef108c6d in QCoreApplicationPrivate::sendThroughObjectEventFil ters(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Core.so.5
#10 0x00007fffee19ab3f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#11 0x00007fffee19e006 in QApplication::notify(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#12 0x00000000018dccee in azui::Application::notify (this=0x2eba040, receiver=0x4ad4330, qevent=0x7fffffffccd0) at /home/zach/p5/arptop/arp/ui5/azmain/azmain.cpp:390
#13 0x00007fffef108a44 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Core.so.5
#14 0x00007fffee1ce61b in ?? () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#15 0x00007fffee1a2c18 in QWidgetPrivate::repaint_sys(QRegion const&) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#16 0x00007fffee1f2778 in ?? () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#17 0x00007fffee19ab74 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#18 0x00007fffee19e006 in QApplication::notify(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Widgets.so.5
#19 0x00000000018dccee in azui::Application::notify (this=0x2eba040, receiver=0x4b5c140, qevent=0x7fffffffd5c0) at /home/zach/p5/arptop/arp/ui5/azmain/azmain.cpp:390
#20 0x00007fffef108a44 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Core.so.5
#21 0x00007fffee92eec5 in QGuiApplicationPrivate::processExposeEvent(QWindow SystemInterfacePrivate::ExposeEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#22 0x00007fffee9373fd in QGuiApplicationPrivate::processWindowSystemEvent(Q WindowSystemInterfacePrivate::WindowSystemEvent*) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#23 0x00007fffee920568 in QWindowSystemInterface::sendWindowSystemEventsImpl ementation(QFlags<QEventLoop::ProcessEventsFlag>) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Gui.so.5
#24 0x00007fffe08633d0 in ?? () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/stow/qt-everywhere-opensource-src-5.1.1/plugins/platforms/libqxcb.so
#25 0x00007fffef10780b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Core.so.5
#26 0x00007fffef10b82e in QCoreApplication::exec() () from /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/lib/libQt5Core.so.5
#27 0x00000000018dc4b5 in azui::Arp::start_gui (this=0x2efe000) at /home/zach/p5/arptop/arp/ui5/azmain/azmain.cpp:301
#28 0x00000000018db0a8 in azui::Arp::run (this=0x2efe000, argc=15, argv=0x7fffffffd9d8) at /home/zach/p5/arptop/arp/ui5/azmain/azmain.cpp:100
#29 0x00000000018dac74 in main (argc=15, argv=0x7fffffffd9d8) at /home/zach/p5/arptop/arp/ui5/azmain/azmain.cpp:48

Thanks, Zach.

zach
8th October 2013, 19:54
I resolved the issue. I am running Ubuntu 12.04 under VirtualBox. I ran glxinfo and it told me to enable 3D acceleration.
I had to power down the VM to change display settings. OpenGL works after that.