X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmaterial.cpp;fp=source%2Fmaterial.cpp;h=989bb12e71b7ac51e5fd2223abbc591fa9a72006;hp=eee1ebc6152057d8799db1a118fa3dcda2bfcd2c;hb=42ace9ac1350d3ae009bdd2fb335ac1e57d1b36b;hpb=95e926ee2bb662fe8795546db4bdebd1a0aff85b diff --git a/source/material.cpp b/source/material.cpp index eee1ebc6..989bb12e 100644 --- a/source/material.cpp +++ b/source/material.cpp @@ -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(m)