- if(current!=this)
- {
- enable(LIGHTING);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &ambient.r);
- for(unsigned i=0; i<lights.size(); ++i)
- if(lights[i])
- lights[i]->bind_to(i);
- current = this;
- }
+ if(!set_current(this))
+ return;
+
+ enable(LIGHTING);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &ambient.r);
+ for(unsigned i=0; i<lights.size(); ++i)
+ if(lights[i])
+ lights[i]->bind_to(i);