Migrating to QOpenGLWidget: blend problems
-
wrote on 2 Feb 2017, 14:01 last edited by
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.
-
Hi
Its not releated to
https://forum.qt.io/topic/60770/qpainter-changes-the-rendering-of-openglwidgetMaybe 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 :) -
wrote on 3 Feb 2017, 06:44 last edited by QtQtQtQt 2 Mar 2017, 07:01
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.
-
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.
-
wrote on 3 Feb 2017, 10:58 last edited by
This is because of using QPainter in paintGL() after drawing lines
1/5