From: Mikko Rasa Date: Wed, 17 Oct 2007 14:58:32 +0000 (+0000) Subject: Bugfixes to Light X-Git-Tag: 0.9~29 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c1405286754104ddc044dddbb0a3505a9a5e3d4a;p=libs%2Fgl.git Bugfixes to Light --- diff --git a/source/light.cpp b/source/light.cpp index 1570c5cd..5b0fa1d7 100644 --- a/source/light.cpp +++ b/source/light.cpp @@ -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); diff --git a/source/light.h b/source/light.h index cbf95add..6a686841 100644 --- a/source/light.h +++ b/source/light.h @@ -33,8 +33,8 @@ public: void set_diffuse(const Color &c); void set_specular(const Color &c); void set_position(float, float, float, float); - void apply(); - void apply_to(unsigned); + void apply() const; + void apply_to(unsigned) const; static void activate(unsigned); };