[Interest] OpenGL weirdness

Yves Bailly Yves.Bailly at verosoftware.com
Thu Jul 24 14:13:15 CEST 2014


Greetings all,

I'm trying to build a very basic OpenGL program, just displaying a red
triangle.
Context:
- Windows 7 64bits
- Qt 5.3.1 (tested with the official MinGW build and a Visual 2012 build)
- I will need OpenGL 3.3 "core" and have to use GLEW
- using QGLWidget, overriding the usual initializeGL() and paintGL()

When I'm creating my widget like this:
   QGLFormat fmt(
         QGL::DoubleBuffer bitor   // enables double-buffering
         QGL::DepthBuffer bitor    // enables support for depth buffer
         QGL::AlphaChannel bitor   // enables support for alpha-blending
         QGL::StencilBuffer bitor  // enables support for stencil buffer
         QGL::DirectRendering      // enables direct rendering to display
         );
   fmt.setStencilBufferSize(8);
   QGLFormat::setDefaultFormat(fmt);

   Gl_Widget glw;
   glw.show();
...then it works fine, I see my triangle. glGetString(GL_VERSION) gives "4.4.0".

But if I add an explicit request for the GL version:
   fmt.setVersion(4, 4);
   fmt.setProfile(QGLFormat::CoreProfile);
...then I no longer see my triangle, however glGetString(GL_VERSION) still gives
"4.4.0".

If I try using some other version:
   fmt.setVersion(3, 3);
   fmt.setProfile(QGLFormat::CoreProfile);
...getGetString(GL_VERSION) gives "3.3.0" (as expected), but no triangle displayed.

With:
   fmt.setVersion(2, 1);
...getGetString(GL_VERSION) gives "4.4.0" (unexpected), and no triangle displayed.

With simply requesting the profile, without giving a version:
   fmt.setProfile(QGLFormat::CoreProfile);
...getGetString(GL_VERSION) gives "4.4.0" and my triangle is displayed.

Any idea about what's going on? The same thing occures on both MinGW (32bits) and
Visual C++ 2012 (64bits).

I'm investigating this thing because a program that used to work well with Qt 5.2.1
no longer works with Qt 5.3.1.

Any hint highly welcome.

-- 
      /- Yves Bailly - Software developer   -\
      \- Sescoi R&D  - http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."


More information about the Interest mailing list