Use OpenGL 3.2 Core

This commit is contained in:
2022-04-07 09:58:52 +02:00
parent b67c2d520e
commit 888e3d86a9
3 changed files with 7 additions and 5 deletions
+3 -2
View File
@@ -173,8 +173,9 @@ void ImageWidget::resizeGL(int w, int h)
void ImageWidget::initializeGL()
{
f = context()->versionFunctions<QOpenGLFunctions_3_0>();
f = context()->functions();
f->glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
QOpenGLFunctions_3_2_Core *f3 = context()->versionFunctions<QOpenGLFunctions_3_2_Core>();
m_vao = std::unique_ptr<QOpenGLVertexArrayObject>(new QOpenGLVertexArrayObject);
m_vao->create();
@@ -209,7 +210,7 @@ void ImageWidget::initializeGL()
m_program = std::unique_ptr<QOpenGLShaderProgram>(new QOpenGLShaderProgram);
m_program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shaders/image.vert");
m_program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shaders/image.frag");
f->glBindFragDataLocation(m_program->programId(), 0, "color");
if(f3)f3->glBindFragDataLocation(m_program->programId(), 0, "color");
if(!m_program->link())
{
qDebug() << "Link failed" << m_program->log();