From 4460b9c84373710d54a37052713e96b1a7962525 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 28 Feb 2017 16:43:35 +0100 Subject: Replace outdated BSD license text For examples and documentation, use new BSD license text that includes the commercial licenses. Change-Id: I1cd74bd8e9c8f2746d8702df00780ee100cbebac Reviewed-by: Jani Heikkinen --- examples/corelib/mimetypes/mimetypebrowser/main.cpp | 14 ++++++++++++-- examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp | 14 ++++++++++++-- examples/corelib/mimetypes/mimetypebrowser/mainwindow.h | 14 ++++++++++++-- .../corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp | 14 ++++++++++++-- examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h | 14 ++++++++++++-- examples/opengl/computegles31/glwindow.cpp | 14 ++++++++++++-- examples/opengl/computegles31/glwindow.h | 14 ++++++++++++-- examples/opengl/computegles31/main.cpp | 14 ++++++++++++-- 8 files changed, 96 insertions(+), 16 deletions(-) (limited to 'examples') diff --git a/examples/corelib/mimetypes/mimetypebrowser/main.cpp b/examples/corelib/mimetypes/mimetypebrowser/main.cpp index daa92a2344..f4462df411 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/main.cpp +++ b/examples/corelib/mimetypes/mimetypebrowser/main.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp index edd48021f3..1d36b7e5ef 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp +++ b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h index 11b1f004a0..978cdec4f4 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h +++ b/examples/corelib/mimetypes/mimetypebrowser/mainwindow.h @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp index 46e603621a..ee83de092d 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp +++ b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h index 0656e64e8f..6c537f4001 100644 --- a/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h +++ b/examples/corelib/mimetypes/mimetypebrowser/mimetypemodel.h @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/opengl/computegles31/glwindow.cpp b/examples/opengl/computegles31/glwindow.cpp index d2cea169a1..178ad9f1e7 100644 --- a/examples/opengl/computegles31/glwindow.cpp +++ b/examples/opengl/computegles31/glwindow.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/opengl/computegles31/glwindow.h b/examples/opengl/computegles31/glwindow.h index 15ece01780..a1a429d7c7 100644 --- a/examples/opengl/computegles31/glwindow.h +++ b/examples/opengl/computegles31/glwindow.h @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/examples/opengl/computegles31/main.cpp b/examples/opengl/computegles31/main.cpp index ff2a1e622d..e4dde8b3bd 100644 --- a/examples/opengl/computegles31/main.cpp +++ b/examples/opengl/computegles31/main.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are -- cgit v1.2.3 From 40ace7a2a0f5cf1e3f097500240b17a2b9cabf2d Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Sat, 25 Feb 2017 20:31:15 +0100 Subject: Fix computegles31 example This patch fixes the example that contained problems showing up with mesa/nouveau drivers. Change-Id: Ic90f6028e394138781f00bcc00c145c56134f441 Reviewed-by: Gunnar Sletta --- examples/opengl/computegles31/glwindow.cpp | 65 ++++++++++++++++++------------ examples/opengl/computegles31/glwindow.h | 1 + examples/opengl/computegles31/main.cpp | 64 +++++++++++++++++++---------- 3 files changed, 82 insertions(+), 48 deletions(-) (limited to 'examples') diff --git a/examples/opengl/computegles31/glwindow.cpp b/examples/opengl/computegles31/glwindow.cpp index 178ad9f1e7..7a14cba66d 100644 --- a/examples/opengl/computegles31/glwindow.cpp +++ b/examples/opengl/computegles31/glwindow.cpp @@ -54,7 +54,7 @@ #include #include #include -//#include +#include #include #include #include @@ -80,7 +80,8 @@ GLWindow::GLWindow() m_shaderComputeV(0), m_shaderComputeH(0), m_blurRadius(0.0f), - m_animate(true) + m_animate(true), + m_vao(0) { const float animationStart = 0.0; const float animationEnd = 10.0; @@ -116,6 +117,7 @@ GLWindow::~GLWindow() delete m_animationGroup; delete m_animationForward; delete m_animationBackward; + delete m_vao; } void GLWindow::setBlurRadius(float blurRadius) @@ -178,19 +180,21 @@ static const char *fsDisplaySource = "}\n"; static const char *csComputeSourceV = - //"#extension GL_EXT_gpu_shader5 : require \n" "#define COMPUTEPATCHSIZE 32 \n" "#define IMGFMT rgba8 \n" "layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;\n" - "layout(binding=0, IMGFMT) uniform highp image2D inputImage; // Use a sampler to improve performance \n" - "layout(binding=1, IMGFMT) uniform highp image2D resultImage;\n" + "layout(binding=0, IMGFMT) uniform readonly highp image2D inputImage; // Use a sampler to improve performance \n" + "layout(binding=1, IMGFMT) uniform writeonly highp image2D resultImage;\n" "uniform int radius;\n" "const float cutoff = 2.2;\n" - "float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" // Const initialization with dynamically uniform expressions doesn't work in GLES - "float expFactor = 1.0 / (2.0 * sigma * sigma);\n" // Same here - "float gaussian(float distance) {\n" - " return exp( -(distance * distance) * expFactor);\n" + "float expFactor() { // a function, otherwise MESA produces error: initializer of global variable `expFactor' must be a constant expression\n" + " float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" + " return 1.0 / (2.0 * sigma * sigma);\n" + "}\n" + + "float gaussian(float distance, float expfactor) {\n" + " return exp( -(distance * distance) * expfactor);\n" "}\n" "void main() {\n" @@ -204,31 +208,34 @@ static const char *csComputeSourceV = " int right = clamp(x + radius, 0, imgSize.x - 1);\n" " int top = clamp(y - radius, 0, imgSize.y - 1);\n" " int bottom = clamp(y + radius, 0, imgSize.y - 1);\n" + " float expfactor = expFactor();\n" " for (int iY = top; iY <= bottom; iY++) {\n" " float dy = float(abs(iY - y));\n" " vec4 imgValue = imageLoad(inputImage, ivec2(x,iY));\n" - " float weight = gaussian(dy);\n" + " float weight = gaussian(dy, expfactor);\n" " sumWeights += weight;\n" " sumPixels += (imgValue * weight);\n" " }\n" " sumPixels /= sumWeights;\n" - " imageStore(resultImage, ivec2(x,y), sumPixels);" + " imageStore(resultImage, ivec2(x,y), sumPixels);\n" "}\n"; static const char *csComputeSourceH = - //"#extension GL_EXT_gpu_shader5 : require \n" "#define COMPUTEPATCHSIZE 32 \n" "#define IMGFMT rgba8 \n" "layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;\n" - "layout(binding=0, IMGFMT) uniform highp image2D inputImage; // Use a sampler to improve performance \n" - "layout(binding=1, IMGFMT) uniform highp image2D resultImage;\n" + "layout(binding=0, IMGFMT) uniform readonly highp image2D inputImage; // Use a sampler to improve performance \n" + "layout(binding=1, IMGFMT) uniform writeonly highp image2D resultImage;\n" "uniform int radius;\n" "const float cutoff = 2.2;\n" - "float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" - "float expFactor = 1.0 / (2.0 * sigma * sigma);\n" - "float gaussian(float distance) {\n" - " return exp( -(distance * distance) * expFactor);\n" + "float expFactor() { // a function, otherwise MESA produces error: initializer of global variable `expFactor' must be a constant expression\n" + " float sigma = clamp(float(radius) / cutoff,0.02,100.0);\n" + " return 1.0 / (2.0 * sigma * sigma);\n" + "}\n" + + "float gaussian(float distance, float expfactor) {\n" + " return exp( -(distance * distance) * expfactor);\n" "}\n" "void main() {\n" @@ -242,15 +249,16 @@ static const char *csComputeSourceH = " int right = clamp(x + radius, 0, imgSize.x - 1);\n" " int top = clamp(y - radius, 0, imgSize.y - 1);\n" " int bottom = clamp(y + radius, 0, imgSize.y - 1);\n" - " for (int iX = left; iX <= right; iX++) {\n" + " float expfactor = expFactor();\n" + " for (int iX = left; iX <= right; iX++) {\n" " float dx = float(abs(iX - x));\n" " vec4 imgValue = imageLoad(inputImage, ivec2(iX,y));\n" - " float weight = gaussian(dx);\n" + " float weight = gaussian(dx, expfactor);\n" " sumWeights += weight;\n" " sumPixels += (imgValue * weight);\n" - " }\n" + " }\n" " sumPixels /= sumWeights;\n" - " imageStore(resultImage, ivec2(x,y), sumPixels);" + " imageStore(resultImage, ivec2(x,y), sumPixels);\n" "}\n"; @@ -262,7 +270,7 @@ QByteArray versionedShaderCode(const char *src) if (QOpenGLContext::currentContext()->isOpenGLES()) versionedSrc.append(QByteArrayLiteral("#version 310 es\n")); else - versionedSrc.append(QByteArrayLiteral("#version 430\n")); + versionedSrc.append(QByteArrayLiteral("#version 430 core\n")); versionedSrc.append(src); return versionedSrc; @@ -315,7 +323,6 @@ void GLWindow::initializeGL() << ctx->format().minorVersion() << ((ctx->format().renderableType() == QSurfaceFormat::OpenGLES) ? (" GLES") : (" GL")) << " context"; - //QOpenGLFunctions *f = ctx->functions(); if (m_texImageInput) { delete m_texImageInput; @@ -373,6 +380,10 @@ void GLWindow::initializeGL() m_shaderComputeH = new QOpenGLShaderProgram; m_shaderComputeH->addShaderFromSourceCode(QOpenGLShader::Compute, versionedShaderCode(csComputeSourceH)); m_shaderComputeH->link(); + + // Create a VAO. Not strictly required for ES 3, but it is for plain OpenGL core context. + m_vao = new QOpenGLVertexArrayObject; + m_vao->create(); } void GLWindow::resizeGL(int w, int h) @@ -421,13 +432,15 @@ void GLWindow::paintGL() // Display processed image f->glClearColor(0, 0, 0, 1); f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - m_texImageProcessed->bind(GL_TEXTURE0); + m_texImageProcessed->bind(0); m_shaderDisplay->bind(); m_shaderDisplay->setUniformValue("matProjection",m_proj); m_shaderDisplay->setUniformValue("imageRatio",m_quadSize); m_shaderDisplay->setUniformValue("samImage",0); + m_vao->bind(); f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + m_vao->release(); m_shaderDisplay->release(); - m_texImageProcessed->release(GL_TEXTURE0); + m_texImageProcessed->release(0); } diff --git a/examples/opengl/computegles31/glwindow.h b/examples/opengl/computegles31/glwindow.h index a1a429d7c7..877f7b732e 100644 --- a/examples/opengl/computegles31/glwindow.h +++ b/examples/opengl/computegles31/glwindow.h @@ -104,6 +104,7 @@ private: int m_blurRadius; bool m_animate; + QOpenGLVertexArrayObject *m_vao; }; #endif diff --git a/examples/opengl/computegles31/main.cpp b/examples/opengl/computegles31/main.cpp index e4dde8b3bd..88f0f36115 100644 --- a/examples/opengl/computegles31/main.cpp +++ b/examples/opengl/computegles31/main.cpp @@ -56,15 +56,17 @@ #include #include "glwindow.h" -bool OGLSupports(int major, int minor, bool gles = false) +bool OGLSupports(int major, int minor, bool gles = false, QSurfaceFormat::OpenGLContextProfile profile = QSurfaceFormat::NoProfile) { QOpenGLContext ctx; QSurfaceFormat fmt; fmt.setVersion(major, minor); - if (gles) + if (gles) { fmt.setRenderableType(QSurfaceFormat::OpenGLES); - else + } else { fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setProfile(profile); + } ctx.setFormat(fmt); ctx.create(); @@ -78,6 +80,8 @@ bool OGLSupports(int major, int minor, bool gles = false) if (ctxMajor < major) return false; if (ctxMajor == major && ctxMinor < minor) return false; + if (!gles && ctx.format().profile() != profile) + return false; return true; } @@ -85,18 +89,34 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - qDebug() << "Support for GL 2.0 "<<( OGLSupports(2,0) ? "yes" : "no"); - qDebug() << "Support for GL 2.1 "<<( OGLSupports(2,1) ? "yes" : "no"); - qDebug() << "Support for GL 3.0 "<<( OGLSupports(3,0) ? "yes" : "no"); - qDebug() << "Support for GL 3.1 "<<( OGLSupports(3,1) ? "yes" : "no"); - qDebug() << "Support for GL 3.2 "<<( OGLSupports(3,2) ? "yes" : "no"); - qDebug() << "Support for GL 3.3 "<<( OGLSupports(3,3) ? "yes" : "no"); - qDebug() << "Support for GL 4.0 "<<( OGLSupports(4,0) ? "yes" : "no"); - qDebug() << "Support for GL 4.1 "<<( OGLSupports(4,1) ? "yes" : "no"); - qDebug() << "Support for GL 4.2 "<<( OGLSupports(4,2) ? "yes" : "no"); - qDebug() << "Support for GL 4.3 "<<( OGLSupports(4,3) ? "yes" : "no"); - qDebug() << "Support for GL 4.4 "<<( OGLSupports(4,4) ? "yes" : "no"); - qDebug() << "Support for GL 4.5 "<<( OGLSupports(4,5) ? "yes" : "no"); + qDebug() << "Support for GL 2.0 noprof "<<( OGLSupports(2,0,false) ? "yes" : "no"); + qDebug() << "Support for GL 2.0 core "<<( OGLSupports(2,0,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 2.0 compat "<<( OGLSupports(2,0,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 2.1 noprof "<<( OGLSupports(2,1,false) ? "yes" : "no"); + qDebug() << "Support for GL 2.1 core "<<( OGLSupports(2,1,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 2.1 compat "<<( OGLSupports(2,1,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.0 noprof "<<( OGLSupports(3,0,false) ? "yes" : "no"); + qDebug() << "Support for GL 3.0 core "<<( OGLSupports(3,0,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.0 compat "<<( OGLSupports(3,0,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.1 noprof "<<( OGLSupports(3,1,false) ? "yes" : "no"); + qDebug() << "Support for GL 3.1 core "<<( OGLSupports(3,1,false, QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.1 compat "<<( OGLSupports(3,1,false, QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.2 core "<<( OGLSupports(3,2,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.2 compat "<<( OGLSupports(3,2,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.3 core "<<( OGLSupports(3,3,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 3.3 compat "<<( OGLSupports(3,3,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.0 core "<<( OGLSupports(4,0,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.0 compat "<<( OGLSupports(4,0,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.1 core "<<( OGLSupports(4,1,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.1 compat "<<( OGLSupports(4,1,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.2 core "<<( OGLSupports(4,2,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.2 compat "<<( OGLSupports(4,2,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.3 core "<<( OGLSupports(4,3,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.3 compat "<<( OGLSupports(4,3,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.4 core "<<( OGLSupports(4,4,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.4 compat "<<( OGLSupports(4,4,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.5 core "<<( OGLSupports(4,5,false,QSurfaceFormat::CoreProfile) ? "yes" : "no"); + qDebug() << "Support for GL 4.5 compat "<<( OGLSupports(4,5,false,QSurfaceFormat::CompatibilityProfile) ? "yes" : "no"); qDebug() << "Support for GLES 2.0 "<<( OGLSupports(2,0,true) ? "yes" : "no"); qDebug() << "Support for GLES 3.0 "<<( OGLSupports(3,0,true) ? "yes" : "no"); qDebug() << "Support for GLES 3.1 "<<( OGLSupports(3,1,true) ? "yes" : "no"); @@ -105,16 +125,16 @@ int main(int argc, char *argv[]) QSurfaceFormat fmt; fmt.setDepthBufferSize(24); - // Request OpenGL 4.3 compatibility or OpenGL ES 3.1. - if (OGLSupports(4,3)) { - qDebug("Requesting 4.3 compatibility context"); - fmt.setVersion(4, 3); - fmt.setRenderableType(QSurfaceFormat::OpenGL); - fmt.setProfile(QSurfaceFormat::CompatibilityProfile); - } else if (OGLSupports(3,1,true)) { + // Request OpenGL ES 3.1 context, as this is a GLES example. If not available, go for OpenGL 4.3 core. + if (OGLSupports(3,1,true)) { qDebug("Requesting 3.1 GLES context"); fmt.setVersion(3, 1); fmt.setRenderableType(QSurfaceFormat::OpenGLES); + } else if (OGLSupports(4,3,false,QSurfaceFormat::CoreProfile)) { + qDebug("Requesting 4.3 core context"); + fmt.setVersion(4, 3); + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setProfile(QSurfaceFormat::CoreProfile); } else { qWarning("Error: This system does not support OpenGL Compute Shaders! Exiting."); return -1; -- cgit v1.2.3