QOpenGLWidget gives black



  • Hello,

    We have got a custom widget that inherits from QOpenGLWidget and implements initializeGL and paintGL like this:

    void MyOpenGLWidget::initializeGL()
    {
      initializeOpenGLFunctions();
    }
    
    void MyOpenGLWidget::paintGL()
    {
      glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }
    

    The widget is into a window "tWindow" among other non-openGL widgets.

    Now we have isolated 2 scenarios, that are 2 applications using tWindow in 2 different ways under Windows 7 and QT5.5 and an OpenGL 4.4 graphics card:

    • Scenario A: tWindow is the main window and the only window that has some custom graphics in it.
    • Scenario B: tWindow is NOT the main window and NOT the only window that has some custom graphics in it.

    While the QOpenGLWidget works beautifully in the scenario A, we couldn't make it work in the scenario B. We keep on getting black on the widget area.

    Any suggestion?

    In the scenario B, we have verified that the OpenGL context is valid, that we draw something on an off-screen buffer (supposed the one of the QOpenGLWidget) and we actually get back the expected pixels from it. But we don't see nothing on screen.
    If we use QGLWidget instead, everything works fine in both scenarios.

    Thank you in advance.

    Piero



  • Did you ever resolve this problem? I think I might have a similar problem (also a case where QOpenGLWidget only shows black, or rather, shows something, but after the first update, reverts to only black, but QGLWidget works without a problem)...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.