GillesDebunne / libQGLViewer

libQGLViewer is an open source C++ library based on Qt that eases the creation of OpenGL 3D viewers.
Other
241 stars 94 forks source link

Recent versions using QOpenGLWidget does not support Stereo Mode #44

Closed saedrna closed 6 years ago

saedrna commented 6 years ago

I have tried both 2.7.1 and 2.6.4. The stereo example in 2.6.4 works fine and not work for 2.7.1. This may be related to the default frame buffer object in QOpenGLWidget.

Is it possible to fix this in QOpenGLWidget? Because QGLWidget is an obselete widget.

Han

GillesDebunne commented 6 years ago

Indeed, this is probably related. Can you try to add this code in your viewer constructor.

QSurfaceFormat format;
format.setStereo(true);
setFormat(format);

Maybe the difference is simply that stereo is now disabled by default. Your case is interesting since your hardware obviously supports this feature (mine does not), so it should just be a matter of enabling it.

saedrna commented 6 years ago

It won't work. And it seems that only the right eye is drawn. In addition, I have added some test in the preDrawStereo

  // Set buffer to draw in
  // Seems that SGI and Crystal Eyes are not synchronized correctly !
  // That's why we don't draw in the appropriate buffer...
  if (!leftBuffer)
    glDrawBuffer(GL_BACK_LEFT);
  else
    glDrawBuffer(GL_BACK_RIGHT);
  cout << glGetError() << std::endl;

It will return 1282, which is caused by

GL_INVALID_OPERATION is generated if the default framebuffer is affected and none of the buffers indicated by buf exists. GL_INVALID_OPERATION is generated if a framebuffer object is affected and buf is not equal to GL_NONE or GL_COLOR_ATTACHMENT$m$, where $m$ is a value between 0 and GL_MAX_COLOR_ATTACHMENTS.

GillesDebunne commented 6 years ago

At that point, it looks more like an issue with QOpenGLWidget and how it handles stereo.

Feel free to re-open if you think this is somehow related to QGLViewer.