X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogram.cpp;fp=source%2Fprogram.cpp;h=11ab151be4fcfef43586737969c43e638383c96b;hp=2d298e82e9d29922a3c18b1d5236dadb25ae402b;hb=e55f79ccb21e8c1be3d86f127e3ec1583e58ce92;hpb=b2764a3a349b48d7445202faa903383386c09a4c diff --git a/source/program.cpp b/source/program.cpp index 2d298e82..11ab151b 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -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 = Resources::get_builtins().open(source)) + compiler.compile(*io); + else + throw IO::file_not_found(source); + } + else + compiler.compile(source); compiler.add_shaders(*this); link(); }