Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. How should applications with OpenGL viewports be setup in QT6?
Forum Updated to NodeBB v4.3 + New Features

How should applications with OpenGL viewports be setup in QT6?

Scheduled Pinned Locked Moved Solved Qt 6
3 Posts 3 Posters 844 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.
  • A Offline
    A Offline
    AlekM
    wrote on last edited by
    #1

    Hello,
    I am trying to create an application with an embedded openGL "viewport" to see levels from my game engine.

    I see there is a QOpenGLWidget class from a "Qt OpenGL Widgets" (openglwidgets) module. However in the MSVC modules picker, it only gives "Qt OpenGL" (opengl) as an available module.

    With the Qt OpenGL module added to the project, I can include <QOpenGLWindow>, but I can't include <QOpenGLWidget>. Is there a way to embed this window into my application so that it's not a separate popup?

    Also, does the QT backend have to use the same graphics library as I use in a Qt OpenGL Widget/Window? If I want to use OpenGL 4 in my window, do I have to force QT to use OpenGL 4 as well?

    Thanks for any help,
    Alek

    Chris KawaC 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      The documentation properly states on what to add to qmake pro-files or CMakeLists.txt when you want to use this class.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • A AlekM

        Hello,
        I am trying to create an application with an embedded openGL "viewport" to see levels from my game engine.

        I see there is a QOpenGLWidget class from a "Qt OpenGL Widgets" (openglwidgets) module. However in the MSVC modules picker, it only gives "Qt OpenGL" (opengl) as an available module.

        With the Qt OpenGL module added to the project, I can include <QOpenGLWindow>, but I can't include <QOpenGLWidget>. Is there a way to embed this window into my application so that it's not a separate popup?

        Also, does the QT backend have to use the same graphics library as I use in a Qt OpenGL Widget/Window? If I want to use OpenGL 4 in my window, do I have to force QT to use OpenGL 4 as well?

        Thanks for any help,
        Alek

        Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @AlekM said:

        However in the MSVC modules picker, it only gives "Qt OpenGL" (opengl) as an available module.

        Yes, for some reason it's missing in the picker dialog, but you can just type it in manually in the property editor and it works fine.

        Is there a way to embed this window into my application so that it's not a separate popup?

        Yes. There's static QWidget::createWindowContainer for that. It creates a widget host for QWindow, but if you're using widgets it's easier to use QOpenGLWidget, as it handles all the events and has fewer issues with stacking order and focus handling.

        1 Reply Last reply
        1

        • Login

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