The Truiangulation_2/examples which use draw() compile and visualize but have an assertion in a QMap

This commit is contained in:
Andreas Fabri 2023-04-19 14:27:45 +01:00
parent c6ce5fb120
commit 47683f2dea
4 changed files with 22 additions and 15 deletions

View File

@ -34,7 +34,7 @@
#include <CGAL/Qt/manipulatedFrame.h> #include <CGAL/Qt/manipulatedFrame.h>
#include <QKeyEvent> #include <QKeyEvent>
#include <QOpenGLVertexArrayObject> #include <QOpenGLVertexArrayObject>
#include <QGLBuffer> #include <QOpenGLBuffer>
#include <QOpenGLShaderProgram> #include <QOpenGLShaderProgram>
#ifdef __GNUC__ #ifdef __GNUC__
@ -1779,7 +1779,7 @@ protected:
static const unsigned int NB_VBO_BUFFERS=(END_POS-BEGIN_POS)+ static const unsigned int NB_VBO_BUFFERS=(END_POS-BEGIN_POS)+
(END_COLOR-BEGIN_COLOR)+2; // +2 for 2 vectors of normals (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. // The following enum gives the indices of the different vao.
enum enum

View File

@ -13,19 +13,22 @@
#define CGAL_QT_CREATE_OPENGL_CONTEXT_H #define CGAL_QT_CREATE_OPENGL_CONTEXT_H
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QGLContext>
namespace CGAL{ namespace CGAL{
namespace Qt{ namespace Qt{
inline QGLContext* createOpenGLContext() inline QOpenGLContext* createOpenGLContext()
{ {
QOpenGLContext *context = new QOpenGLContext(); QOpenGLContext *context = new QOpenGLContext();
QSurfaceFormat format; context->create();
format.setVersion(2,1); return context;
format.setProfile(QSurfaceFormat::CompatibilityProfile);
context->setFormat(format); //QSurfaceFormat format;
QGLContext *result = QGLContext::fromOpenGLContext(context); //format.setVersion(2,1);
result->create(); //format.setProfile(QSurfaceFormat::CompatibilityProfile);
return result; //context->setFormat(format);
//QGLContext *result = QGLContext::fromOpenGLContext(context);
// result->create();
//return result;
} }
} // namespace Qt } // namespace Qt
} // namespace CGAL } // namespace CGAL

View File

@ -35,6 +35,7 @@
#include <QImage> #include <QImage>
#include <QMessageBox> #include <QMessageBox>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPainter>
#include <QPushButton> #include <QPushButton>
#include <QTabWidget> #include <QTabWidget>
#include <QTextEdit> #include <QTextEdit>
@ -2455,7 +2456,10 @@ void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod
mouseBinding_.insert(mbp, map); mouseBinding_.insert(mbp, map);
ClickBindingPrivate cbp(modifiers, button, false, ::Qt::NoButton, key); ClickBindingPrivate cbp(modifiers, button, false, ::Qt::NoButton, key);
clickBinding_.remove(cbp);
// AF: currently results in a runtime error
// clickBinding_.remove(cbp);
} }

View File

@ -4,7 +4,7 @@
cmake_minimum_required(VERSION 3.1...3.23) cmake_minimum_required(VERSION 3.1...3.23)
project(Triangulation_2_Examples) project(Triangulation_2_Examples)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5) find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)
# create a target per cppfile # create a target per cppfile
file( file(
@ -15,10 +15,10 @@ foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}") create_single_source_cgal_program("${cppfile}")
endforeach() endforeach()
if(CGAL_Qt5_FOUND) if(CGAL_Qt6_FOUND)
target_link_libraries(polygon_triangulation PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(polygon_triangulation PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_triangulation_2 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) target_link_libraries(star_conflict_zone PUBLIC CGAL::CGAL_Basic_viewer)
else() 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() endif()