From f0c1773c95a5802cbdedd64ff3d7b283ed63dd95 Mon Sep 17 00:00:00 2001 From: Oliver Bock Date: Thu, 29 Jul 2010 15:05:38 +0200 Subject: [PATCH] Move copyright info to the end of render chain again (it's the foremost object) --- src/pulsaranimationwidget.cpp | 39 +++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/pulsaranimationwidget.cpp b/src/pulsaranimationwidget.cpp index a67fe4b..5504768 100644 --- a/src/pulsaranimationwidget.cpp +++ b/src/pulsaranimationwidget.cpp @@ -268,17 +268,7 @@ void PulsarAnimationWidget::paintGL() { glLoadIdentity(); - // draw copyright info - glColor4f(1.0f, 1.0f, 1.0f, 0.5f); - QFont font; - font.setPointSize(11); - font.setBold(true); - font.setFamily("Arial"); - font.setStyleStrategy((QFont::StyleStrategy) (QFont::OpenGLCompatible | QFont::PreferQuality)); - renderText(10, 25, -100, QString::fromLocal8Bit("Copyright © 2009-2010"), font); - renderText(10, 10, -100, QString::fromLocal8Bit("Max-Planck-Insitut für Gravitationsphysik"), font); - - // draw backdrop + // draw backdrop first so that foreground alpha blending works correctly glColor3f(1.0f, 1.0f, 1.0f); glTranslatef(0.0, 0.0, -501.0); drawTexture(QPointF(0.0, 0.0), m_backgroundTexture); @@ -514,7 +504,34 @@ void PulsarAnimationWidget::paintGL() glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + // save current state (the following is using parallel projection) + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + { + glLoadIdentity(); + glOrtho(0, width(), 0, height(), 0.1, 501.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + { + glLoadIdentity(); + // draw copyright info last (appears in front of everything) + glColor4f(1.0f, 1.0f, 1.0f, 0.5f); + QFont font; + font.setPointSize(11); + font.setBold(true); + font.setFamily("Arial"); + font.setStyleStrategy((QFont::StyleStrategy) (QFont::OpenGLCompatible | QFont::PreferQuality)); + renderText(10, 25, -100, QString::fromLocal8Bit("Copyright © 2009-2010"), font); + renderText(10, 10, -100, QString::fromLocal8Bit("Max-Planck-Insitut für Gravitationsphysik"), font); + + // restore original state + glMatrixMode(GL_PROJECTION); + } + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } + glPopMatrix(); } void PulsarAnimationWidget::runAnimation() -- GitLab