simplified attribute handling a little

git-svn-id: svn://anubis/dwscr/trunk@115 5bef9df8-b654-44bb-925b-0ff18baa8f8c
This commit is contained in:
josh 2008-12-18 15:34:11 +00:00
parent 912b0a7117
commit bc2f18fe87

View File

@ -135,8 +135,10 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain)
glNewList(m_orb_dl, GL_COMPILE); glNewList(m_orb_dl, GL_COMPILE);
/* save lights, materials, and blending information */ /* save lights, materials, and blending information */
glPushAttrib(GL_LIGHTING_BIT | GL_COLOR_BUFFER_BIT); 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}; 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}; GLfloat specular[] = {0.15, 0.15, 0.03, 1.0};
glMaterialfv(GL_FRONT, GL_SPECULAR, specular); glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
GLUquadric * quad = gluNewQuadric(); GLUquadric * quad = gluNewQuadric();
@ -152,9 +154,7 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain)
glPopAttrib(); glPopAttrib();
glEndList(); glEndList();
glPushAttrib(GL_POLYGON_BIT); /* store CULL_FACE settings */ glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT); /* store current settings */
glPushAttrib(GL_ENABLE_BIT); /* store current GL_BLEND setting */
glPushAttrib(GL_LIGHTING_BIT); /* store current LIGHTING settings */
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -168,9 +168,7 @@ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain)
LightBounce::~LightBounce() LightBounce::~LightBounce()
{ {
glPopAttrib(); /* restore old LIGHTING settings */ glPopAttrib(); /* restore old settings */
glPopAttrib(); /* restore old GL_BLEND setting */
glPopAttrib(); /* restore old CULL_FACE settings */
int sz = m_boxes.size(); int sz = m_boxes.size();
for (int i = 0; i < sz; i++) for (int i = 0; i < sz; i++)
delete m_boxes[i]; delete m_boxes[i];