summaryrefslogtreecommitdiffstats
path: root/examples/opengl/contextinfo
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl/contextinfo')
-rw-r--r--examples/opengl/contextinfo/renderwindow.cpp12
-rw-r--r--examples/opengl/contextinfo/widget.cpp9
2 files changed, 12 insertions, 9 deletions
diff --git a/examples/opengl/contextinfo/renderwindow.cpp b/examples/opengl/contextinfo/renderwindow.cpp
index ab8e89fab83..85fb19bd1a6 100644
--- a/examples/opengl/contextinfo/renderwindow.cpp
+++ b/examples/opengl/contextinfo/renderwindow.cpp
@@ -43,6 +43,7 @@
#include <QMatrix4x4>
#include <QOpenGLContext>
#include <QOpenGLShaderProgram>
+#include <QOpenGLFunctions>
RenderWindow::RenderWindow(const QSurfaceFormat &format)
: m_context(0),
@@ -177,10 +178,11 @@ void RenderWindow::render()
return;
}
+ QOpenGLFunctions *f = m_context->functions();
if (!m_initialized) {
m_initialized = true;
- glEnable(GL_DEPTH_TEST);
- glClearColor(0, 0, 0, 1);
+ f->glEnable(GL_DEPTH_TEST);
+ f->glClearColor(0, 0, 0, 1);
init();
emit ready();
}
@@ -189,8 +191,8 @@ void RenderWindow::render()
return;
const qreal retinaScale = devicePixelRatio();
- glViewport(0, 0, width() * retinaScale, height() * retinaScale);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ f->glViewport(0, 0, width() * retinaScale, height() * retinaScale);
+ f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_program->bind();
QMatrix4x4 matrix;
@@ -204,7 +206,7 @@ void RenderWindow::render()
else // no VAO support, set the vertex attribute arrays now
setupVertexAttribs();
- glDrawArrays(GL_TRIANGLES, 0, 3);
+ f->glDrawArrays(GL_TRIANGLES, 0, 3);
m_vao.release();
m_program->release();
diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp
index 6d4b97ca8f0..ff78639e240 100644
--- a/examples/opengl/contextinfo/widget.cpp
+++ b/examples/opengl/contextinfo/widget.cpp
@@ -312,13 +312,14 @@ void Widget::renderWindowReady()
QString vendor, renderer, version, glslVersion;
const GLubyte *p;
- if ((p = glGetString(GL_VENDOR)))
+ QOpenGLFunctions *f = context->functions();
+ if ((p = f->glGetString(GL_VENDOR)))
vendor = QString::fromLatin1(reinterpret_cast<const char *>(p));
- if ((p = glGetString(GL_RENDERER)))
+ if ((p = f->glGetString(GL_RENDERER)))
renderer = QString::fromLatin1(reinterpret_cast<const char *>(p));
- if ((p = glGetString(GL_VERSION)))
+ if ((p = f->glGetString(GL_VERSION)))
version = QString::fromLatin1(reinterpret_cast<const char *>(p));
- if ((p = glGetString(GL_SHADING_LANGUAGE_VERSION)))
+ if ((p = f->glGetString(GL_SHADING_LANGUAGE_VERSION)))
glslVersion = QString::fromLatin1(reinterpret_cast<const char *>(p));
m_output->append(tr("\nVendor: %1").arg(vendor));