I'm use same code with Qt 5.5
class MyGlWidget : public QOpenGLWidget
{
Q_OBJECT
public:
explicit MyGlWidget(QWidget* parent = 0);
virtual ~MyGlWidget();
protected:
virtual void initializeGL()
{
QOpenGLContext* context = QOpenGLContext::currentContext();
QSurfaceFormat format = context->format();
format.setVersion(2,1);
context->setFormat(format);
...
}
virtual void paintGL() { ... }
And in that case "format" is:
QSurfaceFormat(version 2.1, options QFlags(0x4), depthBufferSize 24,
redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8,
stencilBufferSize 8, samples 0, swapBehavior 2, swapInterval 1, profile 2)
But in Qt 5.7 "format" is:
QSurfaceFormat(version 2.1, options QFlags(0x4), depthBufferSize -1,
redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1,
stencilBufferSize -1, samples -1, swapBehavior 2, swapInterval 1, profile 0)
So, textures with alpha channel draws incorrectly. I tried to set format with right params manually, but it doesn't take effect.