Use OpenGL 3.2 Core
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user