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. Migrating to QOpenGLWidget: blend problems

Migrating to QOpenGLWidget: blend problems

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.1k 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.
  • Q Offline
    Q Offline
    QtQtQtQt
    wrote on last edited by
    #1

    Hello. I started migration from QGLWidget to QOpenGLWidget. I use glEnable(GL_BLEND) and figured out that blending stopped to work after migration. Everything else works fine.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Its not releated to
      https://forum.qt.io/topic/60770/qpainter-changes-the-rendering-of-openglwidget

      Maybe you show the code and in which way its not working?

      Im not into openGl but many of the others are
      so add some more details and im sure someone knows the answer :)

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QtQtQtQt
        wrote on last edited by QtQtQtQt
        #3
        void Glass::initializeGL()
        {
            initializeOpenGLFunctions();
             glEnable(GL_BLEND);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            ....
        }
        
        void Glass::draw_vert_line(int index)
        {
            glEnableClientState(GL_COLOR_ARRAY);
            glPushAttrib(GL_ENABLE_BIT);
            glLineStipple(1, 0x0101);
            glEnable(GL_LINE_STIPPLE);
            glVertexPointer(2, GL_INT, 0, vert_lines[index]); // clear rect
            glColorPointer(4, GL_FLOAT, 0, color);
            glDrawArrays(GL_LINES, 0, 2);
            glPopAttrib();
            glDisableClientState(GL_COLOR_ARRAY);
        }
        

        Line not blended. When I use QGLWidget it is.

        the_T 1 Reply Last reply
        0
        • Q QtQtQtQt
          void Glass::initializeGL()
          {
              initializeOpenGLFunctions();
               glEnable(GL_BLEND);
              glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
              ....
          }
          
          void Glass::draw_vert_line(int index)
          {
              glEnableClientState(GL_COLOR_ARRAY);
              glPushAttrib(GL_ENABLE_BIT);
              glLineStipple(1, 0x0101);
              glEnable(GL_LINE_STIPPLE);
              glVertexPointer(2, GL_INT, 0, vert_lines[index]); // clear rect
              glColorPointer(4, GL_FLOAT, 0, color);
              glDrawArrays(GL_LINES, 0, 2);
              glPopAttrib();
              glDisableClientState(GL_COLOR_ARRAY);
          }
          

          Line not blended. When I use QGLWidget it is.

          the_T Offline
          the_T Offline
          the_
          wrote on last edited by
          #4

          @QtQtQtQt

          Would be easier to read if you put your code between
          ```
          ```

          -- No support in PM --

          1 Reply Last reply
          1
          • Q Offline
            Q Offline
            QtQtQtQt
            wrote on last edited by
            #5

            This is because of using QPainter in paintGL() after drawing lines

            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