Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

OpenGL application runs only outside QtCreator



  • Windows platform. A software that used to be compiled with Qt 4.8 and OpenGL (via OpenInventor library with SoQt). Now I am trying the same with Qt 5.6.3, MSVC 2013 (32-bit). I have compiled also all the required libraries with the same toolset, so it should fit.

    The effect is now strange: If I run the compiled exe outside of QtCreator - everything is fine. However, if I run it from inside, this is the message I receive:

    QObject::connect: No such slot SoQtGLWidgetP::gl_changed()
    QObject::connect: (sender name: 'QtGLAreaWindow')
    Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.

    The application does not crash, it shows the OpenGL window - black and empty.

    And the strange thing is: This happens ONLY inside the QtCreator!

    I made sure that both inside and outside the same dlls are found. Also I copied once exactly the same path to a command line, set it there manually and started my appliction: Again it worked perfectly - as soon as it is out of QtCreator!

    This is annoying because I actually need to do some debugging, with debugger or debut output, and with the current situation I am constrained to do this with popping up message boxes here and there...

    Is there anything in QtCreator that blocks proper operation of OpenGL - in some "good old style"? I know that Qt currently uses some Google OpenGL emulator (Angle) - but is it possible that this thing is somehow interfering?




  • Moderators

    @CoBo
    I have a very similar issue with my openglwidget application, every other build/compilation I get a black screen instead of my scene. When that happens I delete the build folder and make a complete rebuild.

    Until it breaks a gain, than rinse and repeat.

    If you find a solution, share it with us :-)


  • Lifetime Qt Champion

    Hi @CoBo,

    could it be QTCREATORBUG-20808?



  • @aha_1980
    +1
    I had the same problem once, and I solved by adding just adding

    application.setAttribute(Qt::AA_UseDesktopOpenGL);
    


  • Thanks for all your competent hints and comments!

    @eti_nne This was actually the kind of solution that I hoped to receive in the first place: some setting, some environment variable, some attribute etc. However also this did not help so far... I just added such a line in my main(), immediately after generating the QApplication, but this had no effect.

    All others assumed that it might be a bug in the QtCreator, which led me to the idea try a more recent version, so I switched from 4.3.1 to 4.7.1 - also no effect so far.

    Two more options are still possible to try:

    a) move from Qt 5.6.3 to a more recent version

    b) try on a "real" Windows 10 machine: so far I am doing all my development and testing in a virtual machine that is actually running on a Linux system (OpenSuse Leap 42.3)

    Both are getting now more and more time consuming (download, install, reconfigure...), so for the moment I will have to switch this project to second priority: Basically I want to run that old software on my recent system - which actually works as long as I do not try to run inside QtCreator! But I found some stupid little bugs that I wanted to debug and remove which is a bit tedious with the need to do all test runs outside of QtCreator.

    Ah, ok, this brings me to still another option that I can try (but also takes time...):

    c) try the compilation and debugging in the Visual Studio


Log in to reply