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. Stereo QOpenGLWidget surface
Forum Updated to NodeBB v4.3 + New Features

Stereo QOpenGLWidget surface

Scheduled Pinned Locked Moved Solved General and Desktop
qopenglwidgetstereo buffers
2 Posts 1 Posters 1.5k Views
  • 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.
  • S Offline
    S Offline
    Shootfast
    wrote on last edited by
    #1

    Hi,

    I'm attempting to create a quad buffered, stereo OpenGL context to use with QOpenGLWidget, but I'm having difficulty getting things to work as expected.

    I'm setting the Default QSurfaceFormat to what I want, prior to calling QApplication, but inside my QOpenGLWidget derived class's paintGL() method, my surface is not reporting as stereo, and there doesn't appear to be any warning or error to tell me why.

    int main(int argc, char * argv[])
    {
    	QSurfaceFormat format;
    	format.setOptions(QSurfaceFormat::StereoBuffers);
    	format.setProfile(QSurfaceFormat::CoreProfile);
    	format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
    	format.setStereo(true);
    	QSurfaceFormat::setDefaultFormat(format);
    
    	QApplication app(argc, argv);
    
    	ViewportWidget viewport(nullptr);
    	viewport.show();
    	return app.exec();
    }
    
    void ViewportWidget::paintGL()
    {
    	std::cout << "Stereo: " << (format().stereo() ? "true" : "false") << std::endl;
    
    	GLboolean is_stereo = GL_TRUE;
    	glGetBooleanv(GL_STEREO, &is_stereo);
    	std::cout << "GL_STEREO: " << (is_stereo == GL_TRUE ? "true" : "false") << std::endl;
    }
    

    Outputs:
    Stereo: false
    GL_STEREO: false

    I know stereo is working on my machine, as glxgears -stereo works as expected.

    Any ideas what I might be doing wrong?

    I'm running Qt opensource 5.8 on Linux, with a NVidia Quadro 4000 GFX card and proprietary drivers.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Shootfast
      wrote on last edited by
      #2

      I worked it out. It was because the QOpenGLWidget uses an FBO under the hood, and so all calls get redirected to it. I guess Qt doesn't then do any special mapping of FBO color attachments to display buffers to allow for GL_BACK_LEFT and friends to continue working seamlessly.
      Solution was to use a QOpenGLWindow instead, and I'm hoping that QWidget::createWindowContainer() will let me continue to work as expected.

      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