Fix compilation of manual Open GL tests with Dynamic GL.

Change-Id: Iffd57f26dfc9d6a00cab855270207fc4da7eb1ab
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-01-15 14:02:57 +01:00
parent f342bf2533
commit 23f663cad6
2 changed files with 10 additions and 7 deletions

View File

@ -35,6 +35,7 @@
#include <QtGui/QPainter>
#include <QtGui/QOpenGLTexture>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QMatrix4x4>
#include <QtCore/QCoreApplication>
@ -67,10 +68,11 @@ void QOpenGLTextureBlitWindow::render()
m_context->makeCurrent(this);
QRect viewport(0,0,dWidth(),dHeight());
glViewport(0,0,dWidth(), dHeight());
QOpenGLFunctions *functions = m_context->functions();
functions->glViewport(0,0,dWidth(), dHeight());
glClearColor(0.f, .6f, .0f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
functions->glClearColor(0.f, .6f, .0f, 0.f);
functions->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QOpenGLTexture texture(m_image);
texture.setWrapMode(QOpenGLTexture::ClampToEdge);

View File

@ -85,9 +85,10 @@ public:
"}");
prog.bind();
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, width(), height());
QOpenGLFunctions *functions = gl->functions();
functions->glClearColor(0, 0, 0, 1);
functions->glClear(GL_COLOR_BUFFER_BIT);
functions->glViewport(0, 0, width(), height());
prog.enableAttributeArray("a_Pos");
prog.enableAttributeArray("a_Color");
@ -104,7 +105,7 @@ public:
prog.setAttributeArray("a_Pos", GL_FLOAT, coords, 2, 0);
prog.setAttributeArray("a_Color", GL_FLOAT, colors, 4, 0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
functions->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
prog.disableAttributeArray("a_Pos");
prog.disableAttributeArray("a_Color");