From 123fcd36aa81ae4b7c16b827fd041dfdeb2d3c5b Mon Sep 17 00:00:00 2001 From: Oliver Bock <oliver.bock@aei.mpg.de> Date: Wed, 19 Nov 2008 14:57:34 +0100 Subject: [PATCH] Moved logo (text and subtitle) rendering to run-specific subclasses * Note: required font initializations have been moved respectively (required for individual font sizes/colors) * StarsphereS5R3 and StarsphereRadio now use different subtitles --- src/starsphere/Starsphere.cpp | 31 +++-------------------------- src/starsphere/Starsphere.h | 8 ++++++++ src/starsphere/StarsphereRadio.cpp | 32 ++++++++++++++++++++++++++++++ src/starsphere/StarsphereRadio.h | 8 ++++++++ src/starsphere/StarsphereS5R3.cpp | 32 ++++++++++++++++++++++++++++++ src/starsphere/StarsphereS5R3.h | 8 ++++++++ 6 files changed, 91 insertions(+), 28 deletions(-) diff --git a/src/starsphere/Starsphere.cpp b/src/starsphere/Starsphere.cpp index c5b11ce..0a66c9e 100644 --- a/src/starsphere/Starsphere.cpp +++ b/src/starsphere/Starsphere.cpp @@ -659,31 +659,7 @@ void Starsphere::initialize(const int width, const int height, const Resource *f } else { - // create large font instances using font resource (base address + size) - m_FontLogo1 = new OGLFT::TranslucentTexture( - &m_FontResource->data()->at(0), - m_FontResource->data()->size(), - 26, 78 ); - - if ( m_FontLogo1 == 0 || !m_FontLogo1->isValid() ) { - cerr << "Could not construct logo1 font face from in memory resource!" << endl; - return; - } - - m_FontLogo1->setForegroundColor(1.0, 1.0, 0.0, 1.0); - - // create medium font instances using font resource (base address + size) - m_FontLogo2 = new OGLFT::TranslucentTexture( - &m_FontResource->data()->at(0), - m_FontResource->data()->size(), - 12, 72 ); - - if ( m_FontLogo2 == 0 || !m_FontLogo2->isValid() ) { - cerr << "Could not construct logo2 font face from in memory resource!" << endl; - return; - } - - m_FontLogo2->setForegroundColor(0.75, 0.75, 0.75, 1.0); + // note: initialization of logo font instances is done in subclasses! // create medium font instances using font resource (base address + size) m_FontHeader = new OGLFT::TranslucentTexture( @@ -888,9 +864,8 @@ void Starsphere::render(const double timeOfDay) glLoadIdentity(); if (isFeature(LOGO)) { - m_FontLogo1->draw(m_XStartPosLeft, m_YStartPosTop, "Einstein@Home"); - m_FontLogo2->draw(m_XStartPosLeft + 25, m_YStartPosTop - m_YOffsetLarge, "World Year of Physics 2005"); - m_FontLogo2->draw(m_XStartPosLeft, m_YStartPosTop - m_YOffsetLarge - 14, "International Year of Astronomy 2009"); + // call subclass implementation + renderLogo(); } if (isFeature(SEARCHINFO)) renderSearchInformation(); diff --git a/src/starsphere/Starsphere.h b/src/starsphere/Starsphere.h index 8edfb06..edfb0cc 100644 --- a/src/starsphere/Starsphere.h +++ b/src/starsphere/Starsphere.h @@ -138,6 +138,14 @@ protected: */ Starsphere(string sharedMemoryIdentifier); + /** + * \brief Render science run specific logo + * + * This abtract method is to be defined by derived classes implementing + * the science run specific logo rendering. + */ + inline virtual void renderLogo() = 0; + /** * \brief Render science run specific search information * diff --git a/src/starsphere/StarsphereRadio.cpp b/src/starsphere/StarsphereRadio.cpp index ecd5f6d..1312eb2 100644 --- a/src/starsphere/StarsphereRadio.cpp +++ b/src/starsphere/StarsphereRadio.cpp @@ -72,6 +72,32 @@ void StarsphereRadio::initialize(const int width, const int height, const Resour m_PowerSpectrumLabelYPos = m_PowerSpectrumYPos - m_PowerSpectrumLabelYOffset; } + // create large font instances using font resource (base address + size) + m_FontLogo1 = new OGLFT::TranslucentTexture( + &m_FontResource->data()->at(0), + m_FontResource->data()->size(), + 26, 78 ); + + if ( m_FontLogo1 == 0 || !m_FontLogo1->isValid() ) { + cerr << "Could not construct logo1 font face from in memory resource!" << endl; + return; + } + + m_FontLogo1->setForegroundColor(1.0, 1.0, 0.0, 1.0); + + // create medium font instances using font resource (base address + size) + m_FontLogo2 = new OGLFT::TranslucentTexture( + &m_FontResource->data()->at(0), + m_FontResource->data()->size(), + 12, 72 ); + + if ( m_FontLogo2 == 0 || !m_FontLogo2->isValid() ) { + cerr << "Could not construct logo2 font face from in memory resource!" << endl; + return; + } + + m_FontLogo2->setForegroundColor(0.75, 0.75, 0.75, 1.0); + // prepare power spectrum generatePowerSpectrumCoordSystem(m_PowerSpectrumXPos, m_PowerSpectrumYPos); @@ -410,3 +436,9 @@ void StarsphereRadio::generateObservatories(float dimFactor) glEndList(); } + +void StarsphereRadio::renderLogo() +{ + m_FontLogo1->draw(m_XStartPosLeft, m_YStartPosTop, "Einstein@Home"); + m_FontLogo2->draw(m_XStartPosLeft, m_YStartPosTop - m_YOffsetLarge, "International Year of Astronomy 2009"); +} diff --git a/src/starsphere/StarsphereRadio.h b/src/starsphere/StarsphereRadio.h index be81bb8..7a8b5d3 100644 --- a/src/starsphere/StarsphereRadio.h +++ b/src/starsphere/StarsphereRadio.h @@ -100,6 +100,14 @@ public: void refreshBOINCInformation(); private: + /** + * \brief Render science run specific logo + * + * This specific implementation shows the usual "Einstein@Home" logo combined + * with "International Year of Astronomy 2009" as subtitle + */ + inline void renderLogo(); + /** * \brief Render science run specific search information * diff --git a/src/starsphere/StarsphereS5R3.cpp b/src/starsphere/StarsphereS5R3.cpp index bc8b5d4..93cdcba 100644 --- a/src/starsphere/StarsphereS5R3.cpp +++ b/src/starsphere/StarsphereS5R3.cpp @@ -51,6 +51,32 @@ void StarsphereS5R3::initialize(const int width, const int height, const Resourc m_Y4StartPosBottom = m_Y3StartPosBottom - m_YOffsetMedium; } + // create large font instances using font resource (base address + size) + m_FontLogo1 = new OGLFT::TranslucentTexture( + &m_FontResource->data()->at(0), + m_FontResource->data()->size(), + 24, 72 ); + + if ( m_FontLogo1 == 0 || !m_FontLogo1->isValid() ) { + cerr << "Could not construct logo1 font face from in memory resource!" << endl; + return; + } + + m_FontLogo1->setForegroundColor(1.0, 1.0, 0.0, 1.0); + + // create medium font instances using font resource (base address + size) + m_FontLogo2 = new OGLFT::TranslucentTexture( + &m_FontResource->data()->at(0), + m_FontResource->data()->size(), + 13, 78 ); + + if ( m_FontLogo2 == 0 || !m_FontLogo2->isValid() ) { + cerr << "Could not construct logo2 font face from in memory resource!" << endl; + return; + } + + m_FontLogo2->setForegroundColor(0.75, 0.75, 0.75, 1.0); + // prepare base class observatories (not dimmed) generateObservatories(1.0); } @@ -149,3 +175,9 @@ void StarsphereS5R3::generateObservatories(float dimFactor) // we don't do anything special here, just call base class Starsphere::generateObservatories(dimFactor); } + +void StarsphereS5R3::renderLogo() +{ + m_FontLogo1->draw(m_XStartPosLeft, m_YStartPosTop, "Einstein@Home"); + m_FontLogo2->draw(m_XStartPosLeft, m_YStartPosTop - m_YOffsetLarge, "World Year of Physics 2005"); +} diff --git a/src/starsphere/StarsphereS5R3.h b/src/starsphere/StarsphereS5R3.h index 1dbcb8f..915dba5 100644 --- a/src/starsphere/StarsphereS5R3.h +++ b/src/starsphere/StarsphereS5R3.h @@ -93,6 +93,14 @@ public: void refreshBOINCInformation(); private: + /** + * \brief Render science run specific logo + * + * This specific implementation shows the usual "Einstein@Home" logo combined + * with "World Year of Physics 2005" as subtitle + */ + inline void renderLogo(); + /** * \brief Render science run specific search information * -- GitLab