diff --git a/src/pulsaranimationwidget.cpp b/src/pulsaranimationwidget.cpp index 7a201285b1fd8cd0504fb085d4839a36f41a80fd..a9aa53e47beb37d7bebf4f2f2667991b9f4f587e 100644 --- a/src/pulsaranimationwidget.cpp +++ b/src/pulsaranimationwidget.cpp @@ -250,6 +250,7 @@ void PulsarAnimationWidget::paintGL() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + // initial perspective/camera setup glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -257,6 +258,41 @@ void PulsarAnimationWidget::paintGL() 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); + // 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 + 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 + glColor3f(1.0f, 1.0f, 1.0f); + glTranslatef(0.0, 0.0, -501.0); + drawTexture(QPointF(0.0, 0.0), m_backgroundTexture); + + // restore original state + glMatrixMode(GL_PROJECTION); + } + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } + glPopMatrix(); + + // define materials // TODO: should be located elsewhere static GLfloat no_mat[] = {0.0, 0.0, 0.0, 1.0}; static GLfloat mat_diffuse[] = {0.5, 0.5, 0.5, 1.0}; @@ -479,39 +515,7 @@ void PulsarAnimationWidget::paintGL() glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - // save current state - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - { - glLoadIdentity(); - glOrtho(0, width(), 0, height(), 0.1, 501.0); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - { - 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 (independent parallel projection) - glColor3f(1.0f, 1.0f, 1.0f); - glTranslatef(0.0, 0.0, -501.0); - drawTexture(QPointF(0.0, 0.0), m_backgroundTexture); - - // restore original state - glMatrixMode(GL_PROJECTION); - } - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - } - glPopMatrix(); } void PulsarAnimationWidget::runAnimation()