From fa38d7700b111382ddb627934707f97bb6dcb059 Mon Sep 17 00:00:00 2001 From: lm Date: Mon, 12 Apr 2010 17:12:11 +0200 Subject: [PATCH] Fixed a HUD bug due to antialiasing --- src/ui/HUD.cc | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index 675373088..ac804d86c 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -449,13 +449,12 @@ void HUD::paintText(QString text, QColor color, float fontSize, float refX, floa void HUD::initializeGL() { - //glEnable(GL_MULTISAMPLE); - - bool antialiasing = true; + bool antialiasing = false; // Antialiasing setup if(antialiasing) { + glEnable(GL_MULTISAMPLE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); @@ -468,9 +467,9 @@ void HUD::initializeGL() } else { - glDisable(GL_BLEND); - glDisable(GL_POINT_SMOOTH); - glDisable(GL_LINE_SMOOTH); + //glDisable(GL_BLEND); + //glDisable(GL_POINT_SMOOTH); + //glDisable(GL_LINE_SMOOTH); } } @@ -604,6 +603,8 @@ void HUD::paintGL() painter.setPen(defaultColor); painter.drawPolyline(yawIndicator); + // CENTER + // HEADING INDICATOR // // __ __ @@ -625,6 +626,23 @@ void HUD::paintGL() painter.drawPolyline(hIndicator); + // SETPOINT + const float centerWidth = 4.0f; + painter.setPen(defaultColor); + painter.setBrush(Qt::NoBrush); + // TODO + //painter.drawEllipse(QPointF(refToScreenX(qMin(10.0f, values.value("roll desired", 0.0f) * 10.0f)), refToScreenY(qMin(10.0f, values.value("pitch desired", 0.0f) * 10.0f))), refToScreenX(centerWidth/2.0f), refToScreenX(centerWidth/2.0f)); + + const float centerCrossWidth = 10.0f; + // left + painter.drawLine(QPointF(refToScreenX(-centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(-centerCrossWidth / 2.0f), refToScreenY(0.0f))); + // right + painter.drawLine(QPointF(refToScreenX(centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(centerCrossWidth / 2.0f), refToScreenY(0.0f))); + // top + painter.drawLine(QPointF(refToScreenX(0.0f), refToScreenY(-centerWidth / 2.0f)), QPointF(refToScreenX(0.0f), refToScreenY(-centerCrossWidth / 2.0f))); + + + // COMPASS const float compassY = -vheight/2.0f + 10.0f; QRectF compassRect(QPointF(refToScreenX(-5.0f), refToScreenY(compassY)), QSizeF(refToScreenX(10.0f), refToScreenY(5.0f))); @@ -687,24 +705,6 @@ void HUD::paintGL() //qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f); - // CENTER - - // SETPOINT - const float centerWidth = 4.0f; - painter.setPen(defaultColor); - painter.setBrush(Qt::NoBrush); - // TODO - //painter.drawEllipse(QPointF(refToScreenX(qMin(10.0f, values.value("roll desired", 0.0f) * 10.0f)), refToScreenY(qMin(10.0f, values.value("pitch desired", 0.0f) * 10.0f))), refToScreenX(centerWidth/2.0f), refToScreenX(centerWidth/2.0f)); - - const float centerCrossWidth = 10.0f; - // left - painter.drawLine(QPointF(refToScreenX(-centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(-centerCrossWidth / 2.0f), refToScreenY(0.0f))); - // right - painter.drawLine(QPointF(refToScreenX(centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(centerCrossWidth / 2.0f), refToScreenY(0.0f))); - // top - painter.drawLine(QPointF(refToScreenX(0.0f), refToScreenY(-centerWidth / 2.0f)), QPointF(refToScreenX(0.0f), refToScreenY(-centerCrossWidth / 2.0f))); - - // PITCH paintPitchLines((pitch/M_PI)*180.0f, &painter); -- 2.22.0