Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLContext without QScreen?
Forum Updated to NodeBB v4.3 + New Features

QOpenGLContext without QScreen?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    danielmohr
    wrote on last edited by
    #1

    I use Qt to create a Crossplatform OpenGL context. I started with a GUI application. Now I want to turn that into a command-line application, that does not try to open any window at all.

    My Question: Is there a way to use QOpenGLContext without a QScreen?
    Currently, I basically have

    QGuiApplication app(argc, argv);
    QScreen* screen = app.primaryScreen();
    QOffscreenSurface offSurf(screen);
    QOpenGLContext* context = new QOpenGLContext;
    context->makeCurrent(&offSurf);

    Why I want to avoid using/creating a Screen:
    I want to start my application on several remote machines because the program does some very time consuming computation. Thus, I created a version of my program that does not raise a window.

    BUT: When I start the application on a remote machine (ssh -Y remotemachine01 myapp) I only get OpenGL version 2.1.2. When I start the application locally (on the same machine, I have opengl 4.4). I suppose the X forwarding is the problem. All machines run on Linux.

    So I need a way to avoid X forwarding. I suppose that QScreen is the reason X forwarding is needed in my application.

    Thanks a lot in advance for any idea/help!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I would create a cli that does everything you need and a second GUI application using e.g. QProcess to run the cli and communicate with it. Something like most mplayer GUI are doing

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        danielmohr
        wrote on last edited by
        #3

        First, thx a lot for your fast response.

        I'm not sure if I understand your suggested approach. How does this help to get an OpenGL context without a window at all, such that I can run my program remotely without the need of X forwarding?

        My cli does the following computation:

        @for thousands of objects:
        randomly modify the geometry of the object
        render the generated geometry in OpenGL to a framebuffer object
        do some very time consuming computation with all rendered images (common properties, differences, and so forth)@

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If I understood you correctly you don't want any GUI on your remote session right ? So making a complete cli allows you to just call it however you want and have your GUI application only where you want/need it

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            danielmohr
            wrote on last edited by
            #5

            Yes, I don't want a GUI on my remote session. But I want to use the GPU-power of remote PC's, using OpenGL and rendering to Framebuffer Objects.

            But recently, I realized, that this seem to be impossible because of the X forwarding. If I understand that correctly, X forwarding means that the OpenGL commands are executed on my local machine. That conflicts with my intention to use the remote GPU's.

            I consider using Mesa with software rendering, but I don't know if that helps.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Do you want to use the GPU for image rendering or for computation ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • D Offline
                D Offline
                danielmohr
                wrote on last edited by
                #7

                Unfortunately, for image rendering. Otherwise I could use Cuda or OpenCL.

                I'm wondering if there exist a library for graphics rendering in Cuda. Have not found one with a quick Google search.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Do you mean something like the examples "here":http://www.nvidia.com/content/cudazone/cuda_sdk/Graphics_Interop.html ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    danielmohr
                    wrote on last edited by
                    #9

                    With Cuda Graphics Interop one can share memory between Cuda and OpenGL for e.g. do general computation in Cuda and render/visualize the result in OpenGL.
                    And that is the problem. It still needs OpenGL for rendering.

                    Besides that, Mesa + OSMesa (for Off-screen Rendering) seems to avoid without X forwarding. But I get only OpenGL 2.1 :(. I need 3.x.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved