]> git.tdb.fi Git - libs/gl.git/blobdiff - source/light.cpp
Bugfixes to Light
[libs/gl.git] / source / light.cpp
index 1570c5cd0c790840b1232dce96c6631dbbdefbf7..5b0fa1d768c0601112ebf9dc91313a961ab49949 100644 (file)
@@ -6,6 +6,7 @@ Distributed under the LGPL
 */
 
 #include "light.h"
+#include "misc.h"
 
 namespace Msp {
 namespace GL {
@@ -43,14 +44,15 @@ void Light::set_position(float x_, float y_, float z_, float w_)
        w=w_;
 }
 
-void Light::apply()
+void Light::apply() const
 {
        apply_to(current);
 }
 
-void Light::apply_to(unsigned l)
+void Light::apply_to(unsigned l) const
 {
        l+=GL_LIGHT0;
+       enable(l);
        glLightfv(l, GL_AMBIENT, &ambient.r);
        glLightfv(l, GL_DIFFUSE, &diffuse.r);
        glLightfv(l, GL_SPECULAR, &specular.r);