diff options
author | Jean-Michaël Celerier <jean-michael.celerier@kdab.com> | 2020-03-10 20:18:17 +0100 |
---|---|---|
committer | Jean-Michaël Celerier <jean-michael.celerier@kdab.com> | 2020-03-11 06:41:22 +0100 |
commit | d55072a53753228caab9c843e0f40fe2a84070cc (patch) | |
tree | 16f1b1517eb7bb4ba9c236f3f6f07c5be70786c7 /src/render/frontend | |
parent | 707cfb5884b0a2dacde9b3a7ce47707a5c09744b (diff) |
Allow Qt3DWindow to choose which graphics API to use on construction
Change-Id: Id3ff72a2eaa7f85844a546ef55dc3e1b71a14659
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/frontend')
-rw-r--r-- | src/render/frontend/qrenderapi.h | 61 | ||||
-rw-r--r-- | src/render/frontend/qrenderaspect.cpp | 2 | ||||
-rw-r--r-- | src/render/frontend/qrendercapabilities.h | 2 | ||||
-rw-r--r-- | src/render/frontend/render-frontend.pri | 1 |
4 files changed, 64 insertions, 2 deletions
diff --git a/src/render/frontend/qrenderapi.h b/src/render/frontend/qrenderapi.h new file mode 100644 index 000000000..fc046642a --- /dev/null +++ b/src/render/frontend/qrenderapi.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DRENDER_QRENDERAPI_H +#define QT3DRENDER_QRENDERAPI_H + +#include <Qt3DRender/qt3drender_global.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +enum class API { + OpenGL, + Vulkan, + DirectX, + Metal, + Null +}; + +} // namespace Qt3Drender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QRENDERAPI_H diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index 9d5058ec8..a0b8ab8f3 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -532,7 +532,7 @@ QRenderAspect::~QRenderAspect() // Called by Scene3DRenderer only void QRenderAspectPrivate::renderInitialize(QOpenGLContext *context) { - if (m_renderer->api() == Render::AbstractRenderer::OpenGL) + if (m_renderer->api() == API::OpenGL) m_renderer->setOpenGLContext(context); m_renderer->initialize(); } diff --git a/src/render/frontend/qrendercapabilities.h b/src/render/frontend/qrendercapabilities.h index 14e233f59..2470922af 100644 --- a/src/render/frontend/qrendercapabilities.h +++ b/src/render/frontend/qrendercapabilities.h @@ -87,7 +87,7 @@ class Q_3DRENDERSHARED_EXPORT QRenderCapabilities : public QObject public: enum API { OpenGL = QSurfaceFormat::OpenGL, - OpenGLES = QSurfaceFormat::OpenGLES, + OpenGLES = QSurfaceFormat::OpenGLES }; Q_ENUM(API) diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index 694b5cfc1..dfcece93f 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -29,6 +29,7 @@ HEADERS += \ $$PWD/qrenderpluginfactory_p.h \ $$PWD/qrenderpluginfactoryif_p.h \ $$PWD/qlevelofdetailboundingsphere.h \ + $$PWD/qrenderapi.h \ $$PWD/qrendercapabilities.h \ $$PWD/qrendercapabilities_p.h |