Commit 5795eb6b authored by pixhawk's avatar pixhawk

Adjusted minor paths and destructors

parent 8e3ebca8
......@@ -142,11 +142,11 @@ HUD::HUD(int width, int height, QWidget* parent)
fill.setColor(2, qRgb(0, 0, 0));
fill.fill(0);
QString imagePath = "/Users/user/Desktop/frame0000.png";
qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath;
fill = QImage(imagePath);
//QString imagePath = "/Users/user/Desktop/frame0000.png";
//qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath;
//fill = QImage(imagePath);
glImage = QGLWidget::convertToGLFormat(fill);
//glImage = QGLWidget::convertToGLFormat(fill);
// Refresh timer
refreshTimer->setInterval(updateInterval);
......@@ -154,8 +154,7 @@ HUD::HUD(int width, int height, QWidget* parent)
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD()));
// Resize to correct size and fill with image
resize(fill.size());
glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
//glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
// Set size once
//setFixedSize(fill.size());
......@@ -189,7 +188,7 @@ HUD::HUD(int width, int height, QWidget* parent)
HUD::~HUD()
{
refreshTimer->stop();
}
QSize HUD::sizeHint() const
......@@ -551,6 +550,8 @@ void HUD::paintEvent(QPaintEvent *event)
void HUD::paintHUD()
{
if (isVisible())
{
// static quint64 interval = 0;
// qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__;
// interval = MG::TIME::getGroundTimeNow();
......@@ -609,7 +610,33 @@ void HUD::paintHUD()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Blue / Brown background
if (noCamera) paintCenterBackground(roll, pitch, yawTrans);
if (noCamera)
{
paintCenterBackground(roll, pitch, yawTrans);
}
// else {
// Fill with black background
QString imagePath = "/Users/user/Desktop/frame0000.png";
if (QFileInfo(imagePath).exists())
{
//qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath;
QImage fill = QImage(imagePath);
glImage = QGLWidget::convertToGLFormat(fill);
float xFactor;
float yFactor;
xFactor = width() / (float)fill.width();
yFactor = height() / (float)fill.height();
glPixelZoom(xFactor, yFactor);
// Resize to correct size and fill with image
glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
// FIXME Adjust viewport to scale image into view
}
// }
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
......@@ -707,7 +734,7 @@ void HUD::paintHUD()
painter.drawRoundedRect(compassRect, 2, 2);
QString yawAngle;
// const float yawDeg = ((values.value("yaw", 0.0f)/M_PI)*180.0f)+180.f;
// const float yawDeg = ((values.value("yaw", 0.0f)/M_PI)*180.0f)+180.f;
// YAW is in compass-human readable format, so 0 - 360deg. This is normal in aviation, not -180 - +180.
const float yawDeg = ((yawLP/M_PI)*180.0f)+180.0f;
......@@ -751,6 +778,7 @@ void HUD::paintHUD()
//glDisable(GL_MULTISAMPLE);
//glFlush();
}
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment