From 6fcda7fbccc2faa4c119bc3ace309ceafe8ee64a Mon Sep 17 00:00:00 2001 From: Liangliang Nan Date: Sat, 14 Dec 2024 15:00:17 +0100 Subject: [PATCH] works with Qt6 --- code/3rd_QGLViewer/QGLViewer/qglviewer.cpp | 1 - code/PolyFit/paint_canvas.cpp | 15 +++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp b/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp index c21b71a9..3c990861 100644 --- a/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp +++ b/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp @@ -265,7 +265,6 @@ void QGLViewer::initializeGL() { glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); - glEnable(GL_CULL_FACE); // Default colors setForegroundColor(QColor(180, 180, 180)); diff --git a/code/PolyFit/paint_canvas.cpp b/code/PolyFit/paint_canvas.cpp index a8e32b2d..13176313 100644 --- a/code/PolyFit/paint_canvas.cpp +++ b/code/PolyFit/paint_canvas.cpp @@ -206,7 +206,6 @@ void PaintCanvas::init() setFPSIsDisplayed(false); } - void PaintCanvas::draw() { if (fatal_opengl_error) { return; @@ -251,6 +250,11 @@ void PaintCanvas::draw() { drawText(30, 180, " - Pan: right button", font); drawText(30, 210, " - Zoom: wheel", font); } + + // Liangliang: It seems the renderText() func disables multi-sample and depth test + // Is this a bug in Qt ? + glEnable(GL_MULTISAMPLE); + glEnable(GL_DEPTH_TEST); } @@ -371,15 +375,6 @@ void PaintCanvas::drawCornerAxis() // Draw text id glColor3f(0, 0, 0); - // Liangliang: It seems the renderText() func disables multi-sample. - // Is this a bug in Qt ? - GLboolean anti_alias = glIsEnabled(GL_MULTISAMPLE); - const_cast(this)->renderText(axis_size, 0, 0, "X"); - const_cast(this)->renderText(0, axis_size, 0, "Y"); - const_cast(this)->renderText(0, 0, axis_size, "Z"); - if (anti_alias) - glEnable(GL_MULTISAMPLE); - glMatrixMode(GL_PROJECTION); glPopMatrix();