From ace2c6ad40d9bfaa41790beb02eb3bad4ea6fa5b Mon Sep 17 00:00:00 2001
From: Oliver Bock <oliver.bock@aei.mpg.de>
Date: Sun, 11 Sep 2011 18:59:03 +0200
Subject: [PATCH] Moved material/color setup to top

---
 src/pulsaranimationwidget.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/pulsaranimationwidget.cpp b/src/pulsaranimationwidget.cpp
index a279743..7dc8358 100644
--- a/src/pulsaranimationwidget.cpp
+++ b/src/pulsaranimationwidget.cpp
@@ -253,6 +253,19 @@ void PulsarAnimationWidget::paintGL()
 
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
+    // 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};
+    static GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0};
+    static GLfloat low_shininess[] = {2.5};
+    static GLfloat translucent[] = {1.0, 1.0, 1.0, 0.33};
+
+    glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat);
+    glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
+    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
+    glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess);
+    glMaterialfv(GL_FRONT, GL_EMISSION, no_mat);
+
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
 
@@ -284,19 +297,6 @@ void PulsarAnimationWidget::paintGL()
     }
     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};
-    static GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0};
-    static GLfloat low_shininess[] = {2.5};
-    static GLfloat translucent[] = {1.0, 1.0, 1.0, 0.33};
-
-    glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat);
-    glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
-    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
-    glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess);
-    glMaterialfv(GL_FRONT, GL_EMISSION, no_mat);
-
     // draw companion
     glPushMatrix();
     {
-- 
GitLab