diff --git a/Starsphere.cpp b/Starsphere.cpp index 45f7d838f665cc072defb8190de4cea90e0e96cc..3501d9e888bdb2a812fdc97510288b5ec84db932 100644 --- a/Starsphere.cpp +++ b/Starsphere.cpp @@ -441,11 +441,12 @@ void Starsphere::resize(const int width, const int height) */ void Starsphere::initialize(const int width, const int height, const Resource *font) { - gfx_width = width; - gfx_height = height; - aspect = gfx_width / gfx_height; + // store font resource this->m_FontResource = font; + // setup initial dimensions + resize(width, height); + // create font instance using font resource (base address + size) m_PolygonFont = new FTGLPolygonFont((&m_FontResource->data()->at(0)), m_FontResource->data()->size()); @@ -621,7 +622,10 @@ void Starsphere::render(const double timeOfDay) // static GLfloat yOffset = (font->Ascender() + font->Descender()); static GLfloat yOffsetLarge = 0.02; static GLfloat yOffsetMedium = 0.015; - + + // disable depth testing since we're in 2D mode + glDisable(GL_DEPTH_TEST); + // enable FSAA glEnable(GL_MULTISAMPLE_ARB); @@ -636,93 +640,81 @@ void Starsphere::render(const double timeOfDay) if (isFeature(LOGO)) { glPushMatrix(); + glColor3f(1.0, 1.0, 0.0); glTranslatef(xStartPosLeft, yStartPosTop, 0); glScalef(fontScaleLargeX, fontScaleLargeY, 1.0); m_PolygonFont->Render("Einstein@Home"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glColor4f(1.0, 1.0, 1.0, 0.5); glTranslatef(xStartPosLeft, yStartPosTop - yOffsetLarge, 0); glScalef(fontScaleMediumX, fontScaleMediumY, 1.0); m_PolygonFont->Render("World Year of Physics 2005"); + glPopMatrix(); } if (isFeature(SEARCHINFO)) { // left info block glPushMatrix(); + glColor3f(1.0, 1.0, 0.0); glTranslatef(xStartPosLeft, yStartPosBottom, 0); glScalef(fontScaleMediumX, fontScaleMediumY, 1.0); m_PolygonFont->Render("BOINC Statistics"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glColor4f(1.0, 1.0, 1.0, 0.5); glTranslatef(xStartPosLeft, yStartPosBottom - yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("User: Oliver"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glTranslatef(xStartPosLeft, yStartPosBottom - 2*yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Team: Albert-Einstein-Institut"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glTranslatef(xStartPosLeft, yStartPosBottom - 3*yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Project credits: 12.000"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glTranslatef(xStartPosLeft, yStartPosBottom - 4*yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Project RAC: 145.00"); + glPopMatrix(); // right info block glPushMatrix(); + glColor3f(1.0, 1.0, 0.0); glTranslatef(xStartPosRight, yStartPosBottom, 0); glScalef(fontScaleMediumX, fontScaleMediumY, 1.0); m_PolygonFont->Render("Search Information"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glColor4f(1.0, 1.0, 1.0, 0.5); glTranslatef(xStartPosRight, yStartPosBottom - yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Right ascension: 180.00 deg"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glTranslatef(xStartPosRight, yStartPosBottom - 2*yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Declination: 45.00 deg"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glTranslatef(xStartPosRight, yStartPosBottom - 3*yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Frequency: 850.05 Hz"); - glPopMatrix(); - - glPushMatrix(); + glLoadIdentity(); glTranslatef(xStartPosRight, yStartPosBottom - 4*yOffsetMedium, 0); glScalef(fontScaleSmallX, fontScaleSmallY, 1.0); m_PolygonFont->Render("Spindown rate: 3.25 * 10^-10 Hz/s"); + glPopMatrix(); } @@ -734,6 +726,9 @@ void Starsphere::render(const double timeOfDay) // disable FSAA glDisable(GL_MULTISAMPLE_ARB); + + // enable depth testing since we're leaving 2D mode + glEnable(GL_DEPTH_TEST); } glFlush();