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

Draw background first (correct z-order)

parent f854b712
No related branches found
No related tags found
No related merge requests found
......@@ -229,6 +229,30 @@ 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 backdrop (independent parallel projection)
glColor3f(0.5, 0.5, 0.5f);
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();
// 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};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment