Commit 96ea06bd authored by Oliver Bock's avatar Oliver Bock

Objects have to be rendered in the right order for alpha blending to work

parent 401554dc
......@@ -73,11 +73,12 @@ PulsarAnimationWidget::~PulsarAnimationWidget()
void PulsarAnimationWidget::initializeGL()
{
glShadeModel(GL_SMOOTH);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
GLfloat LightAmbient[] = { 0.3f, 0.3f, 0.3f, 1.0f };
......@@ -98,8 +99,8 @@ void PulsarAnimationWidget::initializeGL()
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
m_quadricPulsarOrbitPlane = gluNewQuadric();
m_quadricPulsar = gluNewQuadric();
......@@ -135,19 +136,6 @@ void PulsarAnimationWidget::paintGL()
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
if(m_cameraInteraction) {
static GLfloat pulsarOrbitAmbientDiffuse[] = { 1.0, 1.0, 1.0, 0.25 };
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, pulsarOrbitAmbientDiffuse);
glPushMatrix();
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
gluDisk(m_quadricPulsarOrbitPlane,
m_pulsarOrbitRadius * 0.9f,
m_pulsarOrbitRadius * 1.1f,
64, 1);
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 };
......@@ -198,6 +186,19 @@ void PulsarAnimationWidget::paintGL()
gluCylinder(m_quadricPulsarCone2, 0.5f, 0.0f, 3.0f, 32, 32);
glPopMatrix();
glPopMatrix();
if(m_cameraInteraction) {
static GLfloat pulsarOrbitAmbientDiffuse[] = { 1.0, 1.0, 1.0, 0.33 };
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, pulsarOrbitAmbientDiffuse);
glPushMatrix();
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
gluDisk(m_quadricPulsarOrbitPlane,
m_pulsarOrbitRadius * 0.9f,
m_pulsarOrbitRadius * 1.1f,
64, 1);
glPopMatrix();
}
}
void PulsarAnimationWidget::runAnimation()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment