From 47683f2dea3c40bbd380b78426a47dee5d9154b0 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 19 Apr 2023 14:27:45 +0100 Subject: [PATCH] The Truiangulation_2/examples which use draw() compile and visualize but have an assertion in a QMap --- .../include/CGAL/Qt/Basic_viewer_qt.h | 4 ++-- .../include/CGAL/Qt/CreateOpenGLContext.h | 21 +++++++++++-------- GraphicsView/include/CGAL/Qt/qglviewer_impl.h | 6 +++++- .../examples/Triangulation_2/CMakeLists.txt | 6 +++--- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index 3c7b05082b9..054740afb35 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #ifdef __GNUC__ @@ -1779,7 +1779,7 @@ protected: static const unsigned int NB_VBO_BUFFERS=(END_POS-BEGIN_POS)+ (END_COLOR-BEGIN_COLOR)+2; // +2 for 2 vectors of normals - QGLBuffer buffers[NB_VBO_BUFFERS]; + QOpenGLBuffer buffers[NB_VBO_BUFFERS]; // The following enum gives the indices of the different vao. enum diff --git a/GraphicsView/include/CGAL/Qt/CreateOpenGLContext.h b/GraphicsView/include/CGAL/Qt/CreateOpenGLContext.h index 20bed5105a1..e85911f73e8 100644 --- a/GraphicsView/include/CGAL/Qt/CreateOpenGLContext.h +++ b/GraphicsView/include/CGAL/Qt/CreateOpenGLContext.h @@ -13,19 +13,22 @@ #define CGAL_QT_CREATE_OPENGL_CONTEXT_H #include -#include + namespace CGAL{ namespace Qt{ -inline QGLContext* createOpenGLContext() +inline QOpenGLContext* createOpenGLContext() { QOpenGLContext *context = new QOpenGLContext(); - QSurfaceFormat format; - format.setVersion(2,1); - format.setProfile(QSurfaceFormat::CompatibilityProfile); - context->setFormat(format); - QGLContext *result = QGLContext::fromOpenGLContext(context); - result->create(); - return result; + context->create(); + return context; + + //QSurfaceFormat format; + //format.setVersion(2,1); + //format.setProfile(QSurfaceFormat::CompatibilityProfile); + //context->setFormat(format); + //QGLContext *result = QGLContext::fromOpenGLContext(context); + // result->create(); + //return result; } } // namespace Qt } // namespace CGAL diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index d54e88f8aba..c8dec4a0725 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -2455,7 +2456,10 @@ void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod mouseBinding_.insert(mbp, map); ClickBindingPrivate cbp(modifiers, button, false, ::Qt::NoButton, key); - clickBinding_.remove(cbp); + + // AF: currently results in a runtime error + // clickBinding_.remove(cbp); + } diff --git a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt index e4f5e7392ee..47374a85998 100644 --- a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1...3.23) project(Triangulation_2_Examples) -find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5) +find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) # create a target per cppfile file( @@ -15,10 +15,10 @@ foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") endforeach() -if(CGAL_Qt5_FOUND) +if(CGAL_Qt6_FOUND) target_link_libraries(polygon_triangulation PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_triangulation_2 PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(star_conflict_zone PUBLIC CGAL::CGAL_Basic_viewer) else() - message(STATUS "NOTICE: Several examples require Qt5 and will not be compiled.") + message(STATUS "NOTICE: Several examples require Qt6 and will not be compiled.") endif()