From bc2f18fe87380185d972ce89239c5b0fe7d074dc Mon Sep 17 00:00:00 2001 From: josh Date: Thu, 18 Dec 2008 15:34:11 +0000 Subject: [PATCH] simplified attribute handling a little git-svn-id: svn://anubis/dwscr/trunk@115 5bef9df8-b654-44bb-925b-0ff18baa8f8c --- ss/LightBounce.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ss/LightBounce.cc b/ss/LightBounce.cc index b04c71c..2f46cfb 100644 --- a/ss/LightBounce.cc +++ b/ss/LightBounce.cc @@ -135,8 +135,10 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain) glNewList(m_orb_dl, GL_COMPILE); /* save lights, materials, and blending information */ glPushAttrib(GL_LIGHTING_BIT | GL_COLOR_BUFFER_BIT); + GLfloat ambient[] = {0, 0, 0, 0}; + glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); GLfloat mat[] = {0.7, 0.7, 0.14, 0.6}; - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat); + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat); GLfloat specular[] = {0.15, 0.15, 0.03, 1.0}; glMaterialfv(GL_FRONT, GL_SPECULAR, specular); GLUquadric * quad = gluNewQuadric(); @@ -152,9 +154,7 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain) glPopAttrib(); glEndList(); - glPushAttrib(GL_POLYGON_BIT); /* store CULL_FACE settings */ - glPushAttrib(GL_ENABLE_BIT); /* store current GL_BLEND setting */ - glPushAttrib(GL_LIGHTING_BIT); /* store current LIGHTING settings */ + glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT); /* store current settings */ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -168,9 +168,7 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain) LightBounce::~LightBounce() { - glPopAttrib(); /* restore old LIGHTING settings */ - glPopAttrib(); /* restore old GL_BLEND setting */ - glPopAttrib(); /* restore old CULL_FACE settings */ + glPopAttrib(); /* restore old settings */ int sz = m_boxes.size(); for (int i = 0; i < sz; i++) delete m_boxes[i];