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

QOpenGLWidget gives black

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 935 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.
  • P Offline
    P Offline
    Piero
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      codeling
      wrote on last edited by codeling
      #2

      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)...

      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