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. How properly initialize QOpenGLWidget when moving project from opengl to Qt?
Forum Updated to NodeBB v4.3 + New Features

How properly initialize QOpenGLWidget when moving project from opengl to Qt?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.3k 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.
  • N Offline
    N Offline
    never_ever
    wrote on last edited by A Former User
    #1

    Hi,
    I have program where I initialize OpenGL:

    void initFunc()
    {
        glutInit(&m_argc, m_argv);     //(1)
        glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE);    // (2)
        glutInitWindowSize(m_width, m_height);      //(3)
       //and so on...
    }
    

    I know that first(1) and third(3) line I can omit. I use Qt for this. But what with second line (2). If there is some corresponding function to that or I should also skip it.

    I know that I can enable for example depth_test by using glEnable(GL_DEPTH_TEST); But if it will be enough? What with other properties like rgb or double?

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

      Hi,

      QSufaceFormat is what you are looking for

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

      N 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        QSufaceFormat is what you are looking for

        N Offline
        N Offline
        never_ever
        wrote on last edited by
        #3

        So I can change second line to:

        QSurfaceFormat format;
        format.setDepthBufferSize(16);
        format.setBlueBufferSize(0);
        format.setGreenBufferSize(0);
        format.setRedBufferSize(0);
        this->setFormat(format);
        

        And if I think right, GLUT_DOUBLE I can change to setStereo(true).
        If I have to set all this options or it is default in Qt?

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

          No, setStereo is for stereoscopic view i.e. 3D image one for the left and one for the right eye.

          For double buffering, use setSwapBehavior

          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
          • N Offline
            N Offline
            never_ever
            wrote on last edited by never_ever
            #5

            Oh, thanks, I search for that

            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