From 3ec3ffc518a0da24e9a0f58470dc63be1b0c1c43 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 12 Jan 2021 11:05:10 +0100 Subject: [PATCH] WIP --- .../include/CGAL/Qt/Basic_viewer_qt.h | 21 ---------- .../include/CGAL/Qt/Context_initialization.h | 41 +++++++++++++++++++ 2 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 GraphicsView/include/CGAL/Qt/Context_initialization.h diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index d004749aec5..be3b583a0c0 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -54,27 +54,6 @@ namespace CGAL { -int& code_to_call_before_creation_of_QCoreApplication(int& i) { - QSurfaceFormat fmt; -#ifdef Q_OS_MAC - fmt.setVersion(4, 1); -#else - fmt.setVersion(4, 3); -#endif - fmt.setRenderableType(QSurfaceFormat::OpenGL); - fmt.setProfile(QSurfaceFormat::CoreProfile); - fmt.setOption(QSurfaceFormat::DebugContext); - QSurfaceFormat::setDefaultFormat(fmt); - - //for windows -#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) - QCoreApplication::setAttribute(::Qt::AA_UseDesktopOpenGL); -#endif - - //We set the locale to avoid any trouble with VTK - setlocale(LC_ALL, "C"); - return i; -} //------------------------------------------------------------------------------ const char vertex_source_color[] = { diff --git a/GraphicsView/include/CGAL/Qt/Context_initialization.h b/GraphicsView/include/CGAL/Qt/Context_initialization.h new file mode 100644 index 00000000000..2c29b4eb6a8 --- /dev/null +++ b/GraphicsView/include/CGAL/Qt/Context_initialization.h @@ -0,0 +1,41 @@ +// Copyright (c) 2021 GeometryFactory Sarl (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_QT_CONTEXT_INITIALIZATION_H +#define CGAL_QT_CONTEXT_INITIALIZATION_H +namespace CGAL +{ +void init_ogl_context(int major, int minor) { + QSurfaceFormat fmt; +#ifdef Q_OS_MAC + fmt.setVersion(4, 1); +#else + fmt.setVersion(4, 3); +#endif + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setProfile(QSurfaceFormat::CoreProfile); + fmt.setOption(QSurfaceFormat::DebugContext); + QSurfaceFormat::setDefaultFormat(fmt); + + //for windows +#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) + QCoreApplication::setAttribute(::Qt::AA_UseDesktopOpenGL); +#endif + + //We set the locale to avoid any trouble with VTK + setlocale(LC_ALL, "C"); + return i; +} + +} + +#endif // CGAL_QT_CONTEXT_INITIALIZATION_H