How to set program run environment variables for the user

  • Hey, so my program uses OpenGL and if the computer uses something else than mesa drivers, my program somehow gets very weird with drawings... It took me very long to find out how to fix this, but I found this page, where it says something about QSG_RENDER_LOOP. So if someone without mesa drivers runs my program from CLI normally, the drawing is very laggy, but if he starts the program from CLI by writing QSG_RENDER_LOOP=basic before it, the program performs fine without mesa drivers too. So my question is how do I set this variable for the user, for example in the .pro file, such that the user does not have to struggle with this one himself. I tried just writing QSG_RENDER_LOOP=basic in the .pro file, but that doesn't seem to do it. I would very appreciate any help on this one! :)

    Or even better... someone helps me understand why my program is weird with QSG_RENDER_LOOP=threaded on graphics cards that do not use the mesa driver. When I start the program on these graphics cards, the drawing is fluid for a few seconds, but then immidiately gets laggy (one frame every 10 seconds or so). Btw you can also reproduce the bug with mesa driver, if you explicitly set QSG_RENDER_LOOP=threaded before the program starts. What exactly is different with that environment variable QSG_RENDER_LOOP, I cannot find any documentation on this one. Also what do I have to pay attention to, to not interfere with that threaded drawing? If someone knows what I am dealing with here, that would be super awesome! I am though happy if I get help with my first part, however in the case that someone is interested in helping me with the main problem, here is the src code:
    The main QSGNode gets created in game.cpp, but several classes append their nodes to that main node, for example segment.cpp is the main child node creator. I really don't see why my code should not work on threaded renderings, when it works not threaded. The really strange thing is that threaded it also works glitchless, the only problem is that it runs with 0.1 FPS, intuitively threaded renderings should be faster, not slower.

  • Lifetime Qt Champion


    You can use qputenv to set that environment variable before you create your app object.

    For the details of what it changes, it recommend asking on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

  • Thanks, qputenv totally worked for me :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.