aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp2
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h3
-rw-r--r--examples/quick/scenegraph/shared/logorenderer.cpp2
-rw-r--r--examples/quick/scenegraph/shared/logorenderer.h5
-rw-r--r--examples/quick/scenegraph/textureinthread/threadrenderer.cpp4
-rw-r--r--tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp4
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp7
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp19
8 files changed, 30 insertions, 16 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index 91d69c90a4..5be12e6b62 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -91,6 +91,8 @@ void Squircle::handleWindowChanged(QQuickWindow *win)
void Squircle::paint()
{
if (!m_program) {
+ initializeOpenGLFunctions();
+
m_program = new QOpenGLShaderProgram();
m_program->addShaderFromSourceCode(QOpenGLShader::Vertex,
"attribute highp vec4 vertices;"
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h
index 449e02bbf1..203a174f3c 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.h
+++ b/examples/quick/scenegraph/openglunderqml/squircle.h
@@ -44,9 +44,10 @@
#include <QtQuick/QQuickItem>
#include <QtGui/QOpenGLShaderProgram>
+#include <QtGui/QOpenGLFunctions>
//! [1]
-class Squircle : public QQuickItem
+class Squircle : public QQuickItem, protected QOpenGLFunctions
{
Q_OBJECT
diff --git a/examples/quick/scenegraph/shared/logorenderer.cpp b/examples/quick/scenegraph/shared/logorenderer.cpp
index 4c5927b543..afe73155b5 100644
--- a/examples/quick/scenegraph/shared/logorenderer.cpp
+++ b/examples/quick/scenegraph/shared/logorenderer.cpp
@@ -66,6 +66,8 @@ void LogoRenderer::paintQtLogo()
void LogoRenderer::initialize()
{
+ initializeOpenGLFunctions();
+
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
QOpenGLShader *vshader1 = new QOpenGLShader(QOpenGLShader::Vertex, &program1);
diff --git a/examples/quick/scenegraph/shared/logorenderer.h b/examples/quick/scenegraph/shared/logorenderer.h
index 48fbf87203..abc95439f7 100644
--- a/examples/quick/scenegraph/shared/logorenderer.h
+++ b/examples/quick/scenegraph/shared/logorenderer.h
@@ -44,12 +44,13 @@
#include <QtGui/qvector3d.h>
#include <QtGui/qmatrix4x4.h>
#include <QtGui/qopenglshaderprogram.h>
+#include <QtGui/qopenglfunctions.h>
#include <QTime>
#include <QVector>
-class LogoRenderer {
-
+class LogoRenderer : protected QOpenGLFunctions
+{
public:
LogoRenderer();
~LogoRenderer();
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
index 7ae47108f1..270a7f4323 100644
--- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
+++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp
@@ -93,14 +93,14 @@ public slots:
}
m_renderFbo->bind();
- glViewport(0, 0, m_size.width(), m_size.height());
+ context->functions()->glViewport(0, 0, m_size.width(), m_size.height());
m_logoRenderer->render();
// We need to flush the contents to the FBO before posting
// the texture to the other thread, otherwise, we might
// get unexpected results.
- glFlush();
+ context->functions()->glFlush();
m_renderFbo->bindDefault();
qSwap(m_renderFbo, m_displayFbo);
diff --git a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
index b7b58c6d3d..35a01b33ba 100644
--- a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
+++ b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp
@@ -45,6 +45,7 @@
#include <QtQuick/qquickview.h>
#include <QtGui/qopenglcontext.h>
#include <QtGui/qopenglframebufferobject.h>
+#include <QtGui/qopenglfunctions.h>
#include <QtQuick/QQuickFramebufferObject>
@@ -62,7 +63,7 @@ struct FrameInfo {
QSize fboSize;
} frameInfo;
-class ColorRenderer : public QQuickFramebufferObject::Renderer
+class ColorRenderer : public QQuickFramebufferObject::Renderer, protected QOpenGLFunctions
{
public:
void render();
@@ -142,6 +143,7 @@ void ColorRenderer::synchronize(QQuickFramebufferObject *item)
QOpenGLFramebufferObject *ColorRenderer::createFramebufferObject(const QSize &size)
{
+ initializeOpenGLFunctions();
frameInfo.createFBOCount++;
QOpenGLFramebufferObjectFormat format;
if (msaa)
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index b5980929a6..bd7b89b104 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -44,6 +44,7 @@
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <QtGui/qopenglcontext.h>
+#include <QtGui/qopenglfunctions.h>
#include "../../shared/util.h"
@@ -107,13 +108,13 @@ tst_QQuickItemLayer::tst_QQuickItemLayer()
window.create();
context.create();
context.makeCurrent(&window);
- const char *vendor = (const char *)glGetString(GL_VENDOR);
- const char *renderer = (const char *)glGetString(GL_RENDERER);
+ const char *vendor = (const char *)context.functions()->glGetString(GL_VENDOR);
+ const char *renderer = (const char *)context.functions()->glGetString(GL_RENDERER);
m_isMesaSoftwareRasterizer = strcmp(vendor, "Mesa Project") == 0
&& strcmp(renderer, "Software Rasterizer") == 0;
if (m_isMesaSoftwareRasterizer) {
// Expects format: <OpenGL version> Mesa <Mesa version>[-devel] [...]
- const char *version = (const char *)glGetString(GL_VERSION);
+ const char *version = (const char *)context.functions()->glGetString(GL_VERSION);
QList<QByteArray> list = QByteArray(version).split(' ');
if (list.size() >= 3) {
list = list.at(2).split('-').at(0).split('.');
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index 98e31329a0..2397392419 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -44,6 +44,7 @@
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <QtGui/qopenglcontext.h>
+#include <QtGui/qopenglfunctions.h>
#include <QtGui/qscreen.h>
#include <private/qsgrendernode_p.h>
@@ -86,8 +87,8 @@ public:
virtual void render(const RenderState &)
{
// If clip has been set, scissoring will make sure the right area is cleared.
- glClearColor(color.redF(), color.greenF(), color.blueF(), 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
+ QOpenGLContext::currentContext()->functions()->glClearColor(color.redF(), color.greenF(), color.blueF(), 1.0f);
+ QOpenGLContext::currentContext()->functions()->glClear(GL_COLOR_BUFFER_BIT);
}
QColor color;
@@ -129,9 +130,11 @@ private:
QColor m_color;
};
-class MessUpNode : public QSGRenderNode
+class MessUpNode : public QSGRenderNode, protected QOpenGLFunctions
{
public:
+ MessUpNode() : initialized(false) { }
+
virtual StateFlags changedStates()
{
return StateFlags(DepthState) | StencilState | ScissorState | ColorState | BlendState
@@ -140,17 +143,17 @@ public:
virtual void render(const RenderState &)
{
+ if (!initialized) {
+ initializeOpenGLFunctions();
+ initialized = true;
+ }
// Don't draw anything, just mess up the state
glViewport(10, 10, 10, 10);
glDisable(GL_SCISSOR_TEST);
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_EQUAL);
-#if defined(QT_OPENGL_ES)
glClearDepthf(1);
-#else
- glClearDepth(1);
-#endif
glClearStencil(42);
glClearColor(1.0f, 0.5f, 1.0f, 0.0f);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -163,6 +166,8 @@ public:
glFrontFace(frontFace == GL_CW ? GL_CCW : GL_CW);
glEnable(GL_CULL_FACE);
}
+
+ bool initialized;
};
class MessUpItem : public QQuickItem