Skip to content
Snippets Groups Projects
Commit 95edaca5 authored by Oliver Bock's avatar Oliver Bock
Browse files

Optimized rendering

* No depth testing when in 2D mode (HUD)
* Removed unnecessary matrix push/pops
* Do initial resize
parent 3209a823
No related branches found
No related tags found
No related merge requests found
......@@ -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());
......@@ -622,6 +623,9 @@ void Starsphere::render(const double timeOfDay)
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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment