]> git.tdb.fi Git - libs/gl.git/blobdiff - source/program.cpp
Fix a copypaste error in AnimationPlayer uniform setting code
[libs/gl.git] / source / program.cpp
index 2d298e82e9d29922a3c18b1d5236dadb25ae402b..270dbdc3e5675163017349d0cef901fcffaccdf8 100644 (file)
@@ -15,6 +15,7 @@
 #include "misc.h"
 #include "program.h"
 #include "programcompiler.h"
+#include "resources.h"
 #include "shader.h"
 
 using namespace std;
@@ -41,7 +42,15 @@ Program::Program(const std::string &source)
        init();
 
        ProgramCompiler compiler;
-       compiler.compile(source);
+       if(source.find(';')==string::npos && source.size()>5 && !source.compare(source.size()-5, 5, ".glsl"))
+       {
+               if(RefPtr<IO::Seekable> io = Resources::get_builtins().open(source))
+                       compiler.compile(*io, source);
+               else
+                       throw IO::file_not_found(source);
+       }
+       else
+               compiler.compile(source);
        compiler.add_shaders(*this);
        link();
 }