diff --git a/src/GlView.cpp b/src/GlView.cpp index 8379565..dd1f537 100644 --- a/src/GlView.cpp +++ b/src/GlView.cpp @@ -435,20 +435,19 @@ void CGLView::mediaTimerEvent(int ticks) void CGLView::renderText(double x, double y, double z, const QString &str, const QFont & font = QFont()) { // Identify x and y locations to render text within widget int height = this->height(); - GLdouble textPosX = 0, textPosY = 0, textPosZ = 0; + GLdouble textPosX = 0, textPosY = 0; //, textPosZ = 0; //project(x, y, 0f, &textPosX, &textPosX, &textPosZ); textPosX = x; textPosY = y; textPosY = height - textPosY; // y is inverted // Retrieve last OpenGL color to use as a font color - GLdouble glColor[4]; - glGetDoublev(GL_CURRENT_COLOR, glColor); - QColor fontColor = Qt::white;// QColor(glColor[0], glColor[1], glColor[2], glColor[3]); + GLfloat glColor[4]; + glGetFloatv(GL_CURRENT_COLOR, glColor); // Render text QPainter painter(this); - painter.setPen(fontColor); + painter.setPen(QColor::fromRgbF(glColor[0], glColor[1], glColor[2], glColor[3])); painter.setFont(font); painter.drawText(textPosX, textPosY, str); painter.end(); diff --git a/src/QtWindow.cpp b/src/QtWindow.cpp index e89e68f..f380dbb 100644 --- a/src/QtWindow.cpp +++ b/src/QtWindow.cpp @@ -28,6 +28,8 @@ #include "QtWindow.h" #include "version.h" +#include + #ifdef __linux__ #ifndef USE_REALTIME_PRIORITY #define USE_REALTIME_PRIORITY 0 @@ -62,16 +64,13 @@ QtWindow::QtWindow() decodeCommandLine(); - /* - QGLFormat fmt = QGLFormat::defaultFormat(); - + auto fmt = QSurfaceFormat::defaultFormat(); if (Cfg::experimentalSwapInterval != -1) { fmt.setSwapInterval(Cfg::experimentalSwapInterval); int value = fmt.swapInterval(); ppLogInfo("Open GL Swap Interval %d", value); } - */ for (int i = 0; i < MAX_RECENT_FILES; ++i) m_recentFileActs[i] = nullptr; @@ -82,14 +81,12 @@ QtWindow::QtWindow() set_realtime_priority(SCHED_FIFO, rt_prio); #endif - /* QString antiAliasingSetting = m_settings->value("anti-aliasing").toString(); if (antiAliasingSetting.isEmpty() || antiAliasingSetting=="on"){ fmt.setSamples(4); } - QGLFormat::setDefaultFormat(fmt); - */ + QSurfaceFormat::setDefaultFormat(fmt); m_glWidget = new CGLView(this, m_settings); m_glWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);