Results 1 to 8 of 8

Thread: Qt as guest dll to act as GUI for existing OpenGL engine.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question Qt as guest dll to act as GUI for existing OpenGL engine.

    Hi,

    I'm trying to figure out how connect Qt with existing application as a GUI component.
    This application loads dll, and in this dll I can do whatever I want, there is function "update" called in main thread of application.

    As far I created a QLabel, and it shows as separate window but my goal is to paint some GUI on top of game scene rendered by the engine. I'm going to use QtQuick for GUI.

    Unfortunately, every sample assumes that Qt is main application that runs the whole world including OpenGL. I can't find any sample of embedding Qt in existing 3rd party opengl application.

    Has any one faced use case like this?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    What is the 3rd party application using for showing a GL window?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    Barok Engine: http://barokengine.com/

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    How does it render the scene?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    What do you mean?
    It creates everything it need to work and final result is rendered with OpenGL.

    You are able to create and load your own library (dll) to operate with that engine. For eg. CEGUI (placed in this dll) works with that engine, bu I want to use Qt if possible.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    Quote Originally Posted by travick View Post
    What do you mean?
    It creates everything it need to work and final result is rendered with OpenGL.
    I'm asking you to analyze what it creates and how the final result is rendered.

    In general it makes more sense to make Qt the primary event handler (a.k.a. the main framework) and make the game engine render into something that can be used with Qt (preferably into an FBO or into a current OpenGL context Qt may provide). Otherwise you end up with a need to forward all input events to Qt with the need of mapping it from the game's coordinate space into the UI coordinate space. Furthermore if you want to have an animating UI, you'd need to tap into some low-level event handling in Qt to be able to render each frame of the UI into something you can display with your game engine. It's much easier to do it the other way if the engine itself doesn't provide enough infrastructure to make it easier.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    Quote Originally Posted by wysota View Post
    I'm asking you to analyze what it creates and how the final result is rendered.
    Still don't know what you mean. It uses OpenGL what more do you need to know? Write more details or an example here.

    As far as I imagine the situation the main problem is to tell Qt to use an existing OpenGL context instead of creating new one but at this point I could be wrong. What's more I didn't find any example, tutorial, explanation, documentation for similar case.

    P.S. Replay with quote doesn't work: after sending a post it redirects to "reply to thread" and what you've wrote is gone... (or it works randomly for me)

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt as guest dll to act as GUI for existing OpenGL engine.

    Quote Originally Posted by travick View Post
    It uses OpenGL what more do you need to know?
    How it uses OpenGL.

    Write more details or an example here.
    OpenGL is just a language of programming a graphics rendering pipeline. It does not deal with windows, keyboard or mouse input, etc. All this has to be provided by an external mechanism, such as GLUT, Qt, WinAPI or a few dozen different frameworks. You need to find out how this particular framework works, how it handles events, what its display architecture looks like, etc. There is no magical "merge two totally different frameworks together" approach you can take.

    As far as I imagine the situation the main problem is to tell Qt to use an existing OpenGL context
    No, it's not that big of a deal and it's more than trivial in Qt5. But it won't allow you to implement a UI since you need access to key and mouse events. If Qt's event loop is not running, you have to periodically trigger it by hand and you have post input events to the event loop yourself instead of relying on Qt's platform integration to do it for you. If you have access to all the data in your game engine then you can even make a custom platform plugin for your game engine and have the UI render using your platform plugin. But first you need to get all the data from your game engine.

    P.S. Replay with quote doesn't work: after sending a post it redirects to "reply to thread" and what you've wrote is gone... (or it works randomly for me)
    You're pushing the wrong button. Push "Post Quick Reply" instead of "Reply to Thread".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QWidgets Rendered in an opengl graphics engine
    By hypnotic401 in forum Qt Programming
    Replies: 0
    Last Post: 14th August 2012, 14:22
  2. Replies: 0
    Last Post: 8th September 2011, 07:53
  3. XSL-FO to PDF engine
    By thefatladysingsopera in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2011, 20:10
  4. 2D OpenGL text rendering with existing app
    By bytebucket in forum Newbie
    Replies: 7
    Last Post: 11th March 2010, 20:28
  5. Scripting engine
    By stevey in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2006, 11:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.