]> git.tdb.fi Git - libs/gl.git/blobdiff - source/lighting.cpp
Copy ProgramData::uniform_slots in copy constructor and operator=
[libs/gl.git] / source / lighting.cpp
index 2ba1edc5560e00889ecd31fa01592f121a68a993..d1fd9a70ffc0febe50bd9335b753c87418e32549 100644 (file)
@@ -1,4 +1,6 @@
 #include <stdexcept>
+#include <msp/gl/extensions/msp_legacy_features.h>
+#include "error.h"
 #include "light.h"
 #include "lighting.h"
 #include "lightunit.h"
@@ -38,9 +40,6 @@ void Lighting::set_horizon_angle(const Geometry::Angle<float> &a)
 
 void Lighting::attach(unsigned i, const Light &l)
 {
-       if(i>=LightUnit::get_n_units())
-               throw out_of_range("Lighting::attach");
-
        if(i>=lights.size())
                lights.resize(i+1);
 
@@ -73,6 +72,10 @@ void Lighting::update_shader_data(ProgramData &shdata, const Matrix &view_matrix
 
 void Lighting::bind() const
 {
+       static Require _req(MSP_legacy_features);
+       if(lights.size()>LightUnit::get_n_units())
+               throw invalid_operation("Lighting::bind");
+
        if(!set_current(this))
                return;