Merge branch 'qt6' into 'master'

Qt6 integration

See merge request OpenMesh/OpenMesh!304
This commit is contained in:
Jan Möbius
2021-09-21 10:48:23 +00:00
22 changed files with 384 additions and 60 deletions

View File

@@ -32,6 +32,231 @@ cppcheck:
paths:
- cppcheck.log
#----------- Job Informations:
# Type: Build: debug
# OS: Linux
# Compiler: gcc
# Language: cpp11
# QT Version: qt6.0.0
build-debug-gcc-cpp11-qt6.0.0:
stage: build
script: "CI/ci-linux-build.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
variables:
COMPILER: "gcc"
LANGUAGE: "cpp11"
BUILD_TYPE: "debug"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
artifacts:
paths:
- build-gcc-cpp11-qt6.0.0-debug-vectorchecks/
#----------- Job Informations:
# Type: Test: debug
# OS: Linux
# Compiler: gcc
# Language: cpp11
test-debug-gcc-cpp11-qt6.0.0:
stage: test
script: "CI/ci-linux-test.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
- MultiThreads
variables:
COMPILER: "gcc"
LANGUAGE: "cpp11"
BUILD_TYPE: "debug"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
dependencies: [build-debug-gcc-cpp11-qt6.0.0]
needs: [build-debug-gcc-cpp11-qt6.0.0]
artifacts:
reports:
junit:
- build-gcc-cpp11-qt6.0.0-debug-vectorchecks/Unittests/report.xml
- build-gcc-cpp11-qt6.0.0-debug-vectorchecks/Unittests/report-customvec.xml
- build-gcc-cpp11-qt6.0.0-debug-vectorchecks/Unittests/report-doublevec.xml
#----------- Job Informations:
# Type: Build: release
# OS: Linux
# Compiler: gcc
# Language: cpp11
# QT Version: qt6.0.0
build-release-gcc-cpp11-qt6.0.0:
stage: build
script: "CI/ci-linux-build.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
variables:
COMPILER: "gcc"
LANGUAGE: "cpp11"
BUILD_TYPE: "release"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
artifacts:
paths:
- build-gcc-cpp11-qt6.0.0-release-vectorchecks/
#----------- Job Informations:
# Type: Test: release
# OS: Linux
# Compiler: gcc
# Language: cpp11
test-release-gcc-cpp11-qt6.0.0:
stage: test
script: "CI/ci-linux-test.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
- MultiThreads
variables:
COMPILER: "gcc"
LANGUAGE: "cpp11"
BUILD_TYPE: "release"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
dependencies: [build-release-gcc-cpp11-qt6.0.0]
needs: [build-release-gcc-cpp11-qt6.0.0]
artifacts:
reports:
junit:
- build-gcc-cpp11-qt6.0.0-release-vectorchecks/Unittests/report.xml
- build-gcc-cpp11-qt6.0.0-release-vectorchecks/Unittests/report-customvec.xml
- build-gcc-cpp11-qt6.0.0-release-vectorchecks/Unittests/report-doublevec.xml
#----------- Job Informations:
# Type: Build: debug
# OS: Linux
# Compiler: clang
# Language: cpp11
# QT Version: qt6.0.0
build-debug-clang-cpp11-qt6.0.0:
stage: build
script: "CI/ci-linux-build.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
variables:
COMPILER: "clang"
LANGUAGE: "cpp11"
BUILD_TYPE: "debug"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
artifacts:
paths:
- build-clang-cpp11-qt6.0.0-debug-vectorchecks/
#----------- Job Informations:
# Type: Test: debug
# OS: Linux
# Compiler: clang
# Language: cpp11
test-debug-clang-cpp11-qt6.0.0:
stage: test
script: "CI/ci-linux-test.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
- MultiThreads
variables:
COMPILER: "clang"
LANGUAGE: "cpp11"
BUILD_TYPE: "debug"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
dependencies: [build-debug-clang-cpp11-qt6.0.0]
needs: [build-debug-clang-cpp11-qt6.0.0]
artifacts:
reports:
junit:
- build-clang-cpp11-qt6.0.0-debug-vectorchecks/Unittests/report.xml
- build-clang-cpp11-qt6.0.0-debug-vectorchecks/Unittests/report-customvec.xml
- build-clang-cpp11-qt6.0.0-debug-vectorchecks/Unittests/report-doublevec.xml
#----------- Job Informations:
# Type: Build: release
# OS: Linux
# Compiler: clang
# Language: cpp11
# QT Version: qt6.0.0
build-release-clang-cpp11-qt6.0.0:
stage: build
script: "CI/ci-linux-build.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
variables:
COMPILER: "clang"
LANGUAGE: "cpp11"
BUILD_TYPE: "release"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
artifacts:
paths:
- build-clang-cpp11-qt6.0.0-release-vectorchecks/
#----------- Job Informations:
# Type: Test: release
# OS: Linux
# Compiler: clang
# Language: cpp11
test-release-clang-cpp11-qt6.0.0:
stage: test
script: "CI/ci-linux-test.sh"
#image: gitlab.vci.rwth-aachen.de:4567/docker/docker/docker-openmesh-container
tags:
- Linux
- stretch
- MultiThreads
variables:
COMPILER: "clang"
LANGUAGE: "cpp11"
BUILD_TYPE: "release"
QTVERSION: "qt6.0.0"
IWYU: "no"
VECTORCHECKS: "yes"
dependencies: [build-release-clang-cpp11-qt6.0.0]
needs: [build-release-clang-cpp11-qt6.0.0]
artifacts:
reports:
junit:
- build-clang-cpp11-qt6.0.0-release-vectorchecks/Unittests/report.xml
- build-clang-cpp11-qt6.0.0-release-vectorchecks/Unittests/report-customvec.xml
- build-clang-cpp11-qt6.0.0-release-vectorchecks/Unittests/report-doublevec.xml
#----------- Job Informations:
# Type: Build: debug
# OS: Linux
@@ -638,7 +863,7 @@ build-VS2019-x64-shared-TRUE-apps:
script: "CI\\Windows.bat"
tags:
- VS2019
- Qt5150
- Qt612
artifacts:
paths:
- build-release/*.exe
@@ -666,7 +891,7 @@ build-VS2019-x64-shared-FALSE-apps:
script: "CI\\Windows.bat"
tags:
- VS2019
- Qt5150
- Qt612
artifacts:
paths:
- build-release/*.exe

View File

@@ -25,12 +25,12 @@ IF "%BUILD_PLATFORM%" == "VS2015" (
IF "%ARCHITECTURE%" == "x64" (
set QT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015_64
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015_64
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015_64 -DQT_VERSION=5
)
IF "%ARCHITECTURE%" == "x32" (
set QT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015 -DQT_VERSION=5
)
)
@@ -43,7 +43,7 @@ IF "%BUILD_PLATFORM%" == "VS2017" (
IF "%ARCHITECTURE%" == "x64" (
set QT_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64 -DQT_VERSION=5
)
)
@@ -56,8 +56,8 @@ IF "%BUILD_PLATFORM%" == "VS2019" (
set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.com"
IF "%ARCHITECTURE%" == "x64" (
set QT_INSTALL_PATH=E:\Qt\5.15.2\msvc2019_64
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\5.15.2\msvc2019_64
set QT_INSTALL_PATH=E:\Qt\6.1.2\msvc2019_64
set QT_BASE_CONFIG=-DQT_INSTALL_PATH=E:\Qt\6.1.2\msvc2019_64 -DQT_VERSION=6
)
)

View File

@@ -8,7 +8,12 @@ MAKE_OPTIONS=""
BUILDPATH=""
# set GTEST path
OPTIONS="-DGTEST_ROOT=~/sw/gtest-1.10.0"
if [ -d "$HOME/sw/gtest-1.10.0" ]; then
OPTIONS="-DGTEST_ROOT=$HOME/sw/gtest-1.10.0"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/sw/gtest-1.10.0/lib"
else
OPTIONS="-DGTEST_ROOT=/usr/src/gtest/"
fi
if [ "$COMPILER" == "gcc" ]; then
echo "Building with GCC";
@@ -42,27 +47,35 @@ fi
if [ "$QTVERSION" == "qt5.13.0" ]; then
echo "Using QT5.13.0";
BUILDPATH="$BUILDPATH-qt5.13.0"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.13.0/gcc_64"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.13.0/gcc_64 -DQT_VERSION=5"
elif [ "$QTVERSION" == "qt5.12.2" ]; then
echo "Using QT5.12.2";
BUILDPATH="$BUILDPATH-qt5.12.2"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.12.2/gcc_64"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.12.2/gcc_64 -DQT_VERSION=5"
elif [ "$QTVERSION" == "qt5.11.2" ]; then
echo "Using QT5.11.2";
BUILDPATH="$BUILDPATH-qt5.11.2"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.11.2/gcc_64"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.11.2/gcc_64 -DQT_VERSION=5"
elif [ "$QTVERSION" == "qt5.9.0" ]; then
echo "Using QT5.9.0";
BUILDPATH="$BUILDPATH-qt5.9.0"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.9/gcc_64"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.9/gcc_64 -DQT_VERSION=5"
elif [ "$QTVERSION" == "qt5.13.2" ]; then
echo "Using QT5.13.2";
BUILDPATH="$BUILDPATH-qt5.13.2"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.13.2/gcc_64"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.13.2/gcc_64 -DQT_VERSION=5"
elif [ "$QTVERSION" == "qt5.15.1" ]; then
echo "Using QT5.15.1";
BUILDPATH="$BUILDPATH-qt5.15.1"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.15.1/gcc_64"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/5.15.1/gcc_64 -DQT_VERSION=5"
elif [ "$QTVERSION" == "qt6.0.0" ]; then
echo "Using QT6.0.0";
BUILDPATH="$BUILDPATH-qt6.0.0"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/6.0.0/gcc_64 -DQT_VERSION=6"
elif [ "$QTVERSION" == "qt6.0.3" ]; then
echo "Using QT6.0.3";
BUILDPATH="$BUILDPATH-qt6.0.3"
OPTIONS="$OPTIONS -DQT_INSTALL_PATH=~/sw/Qt/6.0.3/gcc_64 -DQT_VERSION=6"
fi
#=====================================

View File

@@ -2,7 +2,7 @@
import sys, os, re, yaml, hashlib
# Version 3.2
# Version 3.3
# Script for automated gitlab-ci creation
# Assembles the gitlab ci from master template file:
@@ -76,7 +76,7 @@ def fetchVariableReplacers(variablesGrep):
if (key != None and value != None):
key = key.strip()
result[key] = value
result[key] = value.strip()
return result
@@ -174,3 +174,4 @@ def main():
# Execute main function
if __name__ == '__main__':
main()

View File

@@ -12,6 +12,9 @@ cppcheck:
paths:
- cppcheck.log
{linux-template-job.yml, COMPILER=gcc, LANGUAGE=cpp11, QT_VERSION=qt6.0.0}
{linux-template-job.yml, COMPILER=clang, LANGUAGE=cpp11, QT_VERSION=qt6.0.0}
{linux-template-job.yml, COMPILER=gcc, LANGUAGE=cpp11, QT_VERSION=qt5.15.1}
{linux-template-job.yml, COMPILER=clang, LANGUAGE=cpp11, QT_VERSION=qt5.15.1}
{linux-template-job.yml, COMPILER=gcc, LANGUAGE=cpp14, QT_VERSION=qt5.15.1}

View File

@@ -2,8 +2,8 @@
# Windows tasks
# -----------------
{windows-template-job-apps.yml, ARCHITECTURE=x64, SHARED=TRUE, VSVERSION=VS2019, QTTAG=Qt5150}
{windows-template-job-apps.yml, ARCHITECTURE=x64, SHARED=FALSE, VSVERSION=VS2019, QTTAG=Qt5150}
{windows-template-job-apps.yml, ARCHITECTURE=x64, SHARED=TRUE, VSVERSION=VS2019, QTTAG=Qt612}
{windows-template-job-apps.yml, ARCHITECTURE=x64, SHARED=FALSE, VSVERSION=VS2019, QTTAG=Qt612}
{windows-template-job-apps.yml, ARCHITECTURE=x64, SHARED=TRUE, VSVERSION=VS2017, QTTAG=Qt5101}
{windows-template-job-apps.yml, ARCHITECTURE=x64, SHARED=FALSE, VSVERSION=VS2017, QTTAG=Qt5101}

View File

@@ -170,7 +170,9 @@ if(${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
"${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
# let bundle generation depend on all targets
add_dependencies (fixbundle DecimaterGui ProgViewer QtViewer SubdividerGui)
if (QT_FOUND)
add_dependencies (fixbundle DecimaterGui ProgViewer QtViewer SubdividerGui)
endif()
# Required for Snow leopard, and the latest qt. Then the resources have to be copied
if ( EXISTS "/opt/local/libexec/qt4-mac/lib/QtGui.framework/Versions/4/Resources/qt_menu.nib" )

View File

@@ -41,12 +41,15 @@ if ( BUILD_APPS )
find_package (OpenGL)
# For the apps, we need qt and opengl to build them
if (NOT QT5_FOUND)
set(QT5_REQUIRED_PACKAGES
Qt5Core
Qt5Widgets
Qt5OpenGL
Qt5Gui
if (NOT QT_FOUND)
set(QT_REQUIRED_PACKAGES
Core
Widgets
OpenGL
Gui
)
set(QT6_REQUIRED_PACKAGES
OpenGLWidgets
)
vci_qt ()
set(CMAKE_AUTOMOC ON)
@@ -57,7 +60,7 @@ if ( BUILD_APPS )
endif()
# check for OpenGL as our required dependencies
if (( QT5_FOUND ) AND OPENGL_FOUND AND NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
if (( QT_FOUND ) AND OPENGL_FOUND AND NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
add_subdirectory (Decimating/DecimaterGui)
add_subdirectory (QtViewer)
@@ -95,8 +98,8 @@ if ( BUILD_APPS )
else () # QT ,Opengl or glut not found
if (NOT QT5_FOUND)
message ("QT5 not found! Skipping some apps.")
if (NOT QT_FOUND)
message ("QT not found! Skipping some apps.")
endif ()
if (NOT OPENGL_FOUND)

View File

@@ -29,7 +29,13 @@ endif ()
target_link_libraries (DecimaterGui
OpenMeshCore
OpenMeshTools
Qt5::OpenGL
${QT_TARGET}::OpenGL
${QT_TARGET}::Widgets
${QT_TARGET}::Gui
${OPENGL_LIBRARIES}
)
if (QT_VERSION_MAJOR GREATER 5)
target_link_libraries (DecimaterGui ${QT_TARGET}::OpenGLWidgets)
endif()

View File

@@ -50,6 +50,7 @@
#include <OpenMesh/Tools/Utils/getopt.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include <QOpenGLContext>
#include "DecimaterViewerWidget.hh"
@@ -65,7 +66,11 @@ int main(int argc, char **argv)
// OpenGL check
QApplication app(argc,argv);
#if QT_VERSION_MAJOR < 6
if ( !QGLFormat::hasOpenGL() ) {
#else
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
#endif
QString msg = "System has no OpenGL support!";
QMessageBox::critical( nullptr, "OpenGL", msg + argv[1] );
return -1;

View File

@@ -28,7 +28,13 @@ endif ()
target_link_libraries ( ProgViewer
OpenMeshCore
OpenMeshTools
Qt5::OpenGL
${QT_TARGET}::OpenGL
${QT_TARGET}::Widgets
${QT_TARGET}::Gui
${OPENGL_LIBRARIES}
)
if (QT_VERSION_MAJOR GREATER 5)
target_link_libraries (ProgViewer ${QT_TARGET}::OpenGLWidgets)
endif()

View File

@@ -51,15 +51,20 @@
#include <OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh>
#include <QString>
#include <QApplication>
#include <QGLWidget>
#if QT_VERSION_MAJOR > 5
#include <QOpenGLContext>
#endif
int main(int argc, char **argv)
{
// OpenGL check
QApplication app(argc,argv);
#if QT_VERSION_MAJOR < 6
if ( !QGLFormat::hasOpenGL() ) {
#else
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
#endif
std::cerr << "This system has no OpenGL support.\n";
return -1;
}

View File

@@ -30,7 +30,13 @@ endif ()
target_link_libraries (QtViewer
OpenMeshCore
OpenMeshTools
Qt5::OpenGL
${QT_TARGET}::OpenGL
${QT_TARGET}::Widgets
${QT_TARGET}::Gui
${OPENGL_LIBRARIES}
)
if (QT_VERSION_MAJOR GREATER 5)
target_link_libraries (QtViewer ${QT_TARGET}::OpenGLWidgets)
endif()

View File

@@ -233,7 +233,7 @@ bool MeshViewerWidgetT<M>::set_texture( QImage& _texsrc )
_texsrc = _texsrc.scaled( tex_w, tex_h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
}
QImage texture( QGLWidget::convertToGLFormat ( _texsrc ) );
QImage texture = _texsrc.convertToFormat(QImage::Format_ARGB32).rgbSwapped();
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);

View File

@@ -60,6 +60,7 @@
#include <QImage>
#include <QDateTime>
#include <QMouseEvent>
#include <QActionGroup>
// --------------------
#include <OpenMesh/Apps/QtViewer/QGLViewerWidget.hh>
#include <OpenMesh/Tools/Utils/Timer.hh>
@@ -68,6 +69,10 @@
# define M_PI 3.1415926535897932
#endif
#if QT_VERSION_MAJOR > 5
#define swapBuffers()
#endif
const double TRACKBALL_RADIUS = 0.6;
@@ -81,21 +86,22 @@ std::string QGLViewerWidget::nomode_ = "";
//----------------------------------------------------------------------------
QGLViewerWidget::QGLViewerWidget( QWidget* _parent )
: QGLWidget( _parent )
#if QT_VERSION_MAJOR < 6
QGLViewerWidget::QGLViewerWidget( QWidget* _parent ) : QGLWidget( _parent )
#else
QGLViewerWidget::QGLViewerWidget( QWidget* _parent ) : QOpenGLWidget( _parent )
#endif
{
init();
}
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------
QGLViewerWidget::
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent )
: QGLWidget( _fmt, _parent )
{
init();
#if QT_VERSION_MAJOR > 5
void QGLViewerWidget::updateGL() {
update();
}
#endif
//----------------------------------------------------------------------------
@@ -330,7 +336,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
// move in z direction
if ( (_event->buttons() == (LeftButton+MidButton)) ||
if ( (_event->buttons() == (LeftButton|MiddleButton)) ||
(_event->buttons() == LeftButton && _event->modifiers() == ControlModifier))
{
float value_y = radius_ * dy * 3.0 / h;
@@ -339,7 +345,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
// move in x,y direction
else if ( (_event->buttons() == MidButton) ||
else if ( (_event->buttons() == MiddleButton) ||
(_event->buttons() == LeftButton && _event->modifiers() == AltModifier) )
{
float z = - (modelview_matrix_[ 2]*center_[0] +
@@ -417,7 +423,7 @@ void QGLViewerWidget::wheelEvent(QWheelEvent* _event)
{
// Use the mouse wheel to zoom in/out
float d = -(float)_event->delta() / 120.0 * 0.2 * radius_;
float d = -(float)( _event->angleDelta().y() / 120.0 * 0.2 * radius_ );
translate(Vec3f(0.0, 0.0, d));
updateGL();
_event->accept();

View File

@@ -47,14 +47,15 @@
//== INCLUDES =================================================================
#include <OpenMesh/Core/Geometry/VectorT.hh>
#include <QGLWidget>
#include <string>
#include <vector>
#include <map>
#if QT_VERSION_MAJOR < 6
#include <QGLWidget>
#else
#include <QtOpenGLWidgets/QOpenGLWidget>
#endif
//== FORWARD DECLARATIONS =====================================================
@@ -64,21 +65,25 @@ class QAction;
//== CLASS DEFINITION =========================================================
#if QT_VERSION_MAJOR < 6
class QGLViewerWidget : public QGLWidget
#else
class QGLViewerWidget : public QOpenGLWidget
#endif
{
Q_OBJECT
public:
#if QT_VERSION_MAJOR < 6
typedef QGLWidget Super;
#else
typedef QOpenGLWidget Super;
#endif
// Default constructor.
explicit QGLViewerWidget( QWidget* _parent=0 );
//
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 );
// Destructor.
virtual ~QGLViewerWidget();
@@ -88,6 +93,11 @@ private:
public:
#if QT_VERSION_MAJOR > 5
/* Updates the gui - used to provide backwards compability */
void updateGL();
#endif
/* Sets the center and size of the whole scene.
The _center is used as fixpoint for rotations and for adjusting
the camera/viewer (see view_all()). */

View File

@@ -44,12 +44,16 @@
#endif
#include <iostream>
#include <fstream>
#include <QApplication>
#include <QMessageBox>
#include <QMainWindow>
#include <QMenuBar>
#include <QFileDialog>
#if QT_VERSION_MAJOR > 5
#include <QOpenGLContext>
#endif
#include "MeshViewerWidget.hh"
@@ -62,7 +66,11 @@ int main(int argc, char **argv)
// OpenGL check
QApplication app(argc,argv);
if ( !QGLFormat::hasOpenGL() ) {
#if QT_VERSION_MAJOR < 6
if ( !QGLFormat::hasOpenGL() ) {
#else
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
#endif
QString msg = "System has no OpenGL support!";
QMessageBox::critical( nullptr, QString("OpenGL"), msg + QString(argv[1]) );
return -1;

View File

@@ -28,7 +28,12 @@ endif ()
target_link_libraries (SubdividerGui
OpenMeshCore
OpenMeshTools
Qt5::OpenGL
${QT_TARGET}::OpenGL
${QT_TARGET}::Widgets
${QT_TARGET}::Gui
${OPENGL_LIBRARIES}
)
if (QT_VERSION_MAJOR GREATER 5)
target_link_libraries (SubdividerGui ${QT_TARGET}::OpenGLWidgets)
endif()

View File

@@ -51,13 +51,20 @@
#include <QApplication>
#include <QMessageBox>
#include "SubdivideWidget.hh"
#if QT_VERSION_MAJOR > 5
#include <QOpenGLContext>
#endif
int main(int argc, char **argv)
{
// OpenGL check
QApplication app(argc,argv);
#if QT_VERSION_MAJOR < 6
if ( !QGLFormat::hasOpenGL() ) {
#else
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
#endif
QString msg = "System has no OpenGL support!";
QMessageBox::critical( nullptr, "OpenGL", msg + argv[1], QMessageBox::Ok );
return -1;

View File

@@ -25,6 +25,12 @@ endif ()
target_link_libraries (Synthesizer
OpenMeshCore
OpenMeshTools
Qt5::OpenGL
${QT_TARGET}::OpenGL
${QT_TARGET}::Widgets
${QT_TARGET}::Gui
${OPENGL_LIBRARIES}
)
if (QT_VERSION_MAJOR GREATER 5)
target_link_libraries (Synthesizer ${QT_TARGET}::OpenGLWidgets)
endif()

View File

@@ -49,6 +49,9 @@
#include <QString>
#include <QApplication>
#if QT_VERSION_MAJOR > 5
#include <QOpenGLContext>
#endif
#include "VDPMSynthesizerViewerWidget.hh"
@@ -58,7 +61,11 @@ int main(int argc, char **argv)
QApplication app(argc,argv);
#if QT_VERSION_MAJOR < 6
if ( !QGLFormat::hasOpenGL() ) {
#else
if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
#endif
std::cerr << "This system has no OpenGL support.\n";
return 1;
}