X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogram.cpp;h=270dbdc3e5675163017349d0cef901fcffaccdf8;hp=2d298e82e9d29922a3c18b1d5236dadb25ae402b;hb=639238c53510fb9483e92fb1b808d33fce992bff;hpb=fa196218c247aba70dd7fb17178fa7474121acec diff --git a/source/program.cpp b/source/program.cpp index 2d298e82..270dbdc3 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, source); + else + throw IO::file_not_found(source); + } + else + compiler.compile(source); compiler.add_shaders(*this); link(); }