]> git.tdb.fi Git - libs/gl.git/blobdiff - source/material.cpp
Rework Bind and enable it to restore the old binding
[libs/gl.git] / source / material.cpp
index eee1ebc6152057d8799db1a118fa3dcda2bfcd2c..989bb12e71b7ac51e5fd2223abbc591fa9a72006 100644 (file)
@@ -46,24 +46,21 @@ void Material::set_shininess(float s)
 
 void Material::bind() const
 {
-       if(current!=this)
+       if(set_current(this))
        {
                glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
                glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
                glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
                glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
                glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
-               current = this;
        }
 }
 
 void Material::unbind()
 {
-       current = 0;
+       set_current(0);
 }
 
-const Material *Material::current = 0;
-
 
 Material::Loader::Loader(Material &m):
        DataFile::ObjectLoader<Material>(m)