diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-11-20 17:09:56 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-11-27 18:01:25 +0000 |
commit | 6fac2818ac283c1db0af51a5d8c556fa8afc61ae (patch) | |
tree | 063269f990ff1b35b5552a5e359ae88a00f6d91b /tests | |
parent | c6716fa7f044985389038802a296bae83951b119 (diff) |
Handle changes in OpenGL classes
Support building against both 5.15 and 6
Change-Id: I46e15f2f898f5f2304075e290798d3d2aea47dad
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
3 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp b/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp index ead476c3a..a7690924a 100644 --- a/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp +++ b/tests/auto/render/opengl/graphicshelpergl2/tst_graphicshelpergl2.cpp @@ -32,7 +32,9 @@ #include <graphicshelpergl2_p.h> #include <Qt3DRender/private/attachmentpack_p.h> #include <QOpenGLContext> +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include <QOpenGLVersionFunctionsFactory> +#endif #include <QOpenGLBuffer> #include <QOpenGLFunctions_2_0> #include <QOpenGLExtraFunctions> @@ -154,7 +156,11 @@ private Q_SLOTS: return; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if ((m_func = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_2_0>()) != nullptr) { +#else + if ((m_func = m_glContext.versionFunctions<QOpenGLFunctions_2_0>())) { +#endif m_extraFunctions = m_glContext.extraFunctions(); m_glHelper.initializeHelper(&m_glContext, m_func); m_initializationSuccessful = true; diff --git a/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp b/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp index c21def5cd..54662e4e0 100644 --- a/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp +++ b/tests/auto/render/opengl/graphicshelpergl3_2/tst_graphicshelpergl3_2.cpp @@ -32,7 +32,9 @@ #include <graphicshelpergl3_2_p.h> #include <Qt3DRender/private/attachmentpack_p.h> #include <QOpenGLBuffer> +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include <QOpenGLVersionFunctionsFactory> +#endif #include <QOpenGLFunctions_3_2_Core> #include <QOpenGLShaderProgram> #include <QOpenGLVertexArrayObject> @@ -208,7 +210,11 @@ private Q_SLOTS: return; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if ((m_func = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_2_Core>()) != nullptr) { +#else + if ((m_func = m_glContext.versionFunctions<QOpenGLFunctions_3_2_Core>())) { +#endif m_glHelper.initializeHelper(&m_glContext, m_func); m_initializationSuccessful = true; } @@ -549,7 +555,7 @@ private Q_SLOTS: QVERIFY(error == 0); // THEN - QList<QVector4D> colors(512 * 512); + QVector<QVector4D> colors(512 * 512); textures[3]->bind(); m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); diff --git a/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp b/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp index 745e3e4af..6cd62a170 100644 --- a/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp +++ b/tests/auto/render/opengl/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp @@ -32,7 +32,9 @@ #include <Qt3DRender/private/attachmentpack_p.h> #include <graphicshelpergl3_3_p.h> #include <QOpenGLBuffer> +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include <QOpenGLVersionFunctionsFactory> +#endif #include <QOpenGLFunctions_3_3_Core> #include <QOpenGLShaderProgram> #include <QOpenGLVertexArrayObject> @@ -208,7 +210,11 @@ private Q_SLOTS: return; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if ((m_func = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_3_Core>()) != nullptr) { +#else + if ((m_func = m_glContext.versionFunctions<QOpenGLFunctions_3_3_Core>())) { +#endif m_glHelper.initializeHelper(&m_glContext, m_func); m_initializationSuccessful = true; } @@ -647,7 +653,7 @@ private Q_SLOTS: QVERIFY(error == 0); // THEN - QList<QVector4D> colors(512 * 512); + QVector<QVector4D> colors(512 * 512); textures[3]->bind(); m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); |