static shader from_file(shader_type type, char const * file_name) { std::ifstream f(file_name); if (!f) throw std::runtime_error(std::string("Unable to open file: ") + file_name); return from_source( type, { std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>() } ); }
static shader from_source(shader_type type, std::string const & source) { return from_source(type, source.data()); }
typename shader<Stage>::ptr shader<Stage>::from_file(std::string filename, const parameters_t& params, bool compile_now) { return from_source(load_file_(filename), params, compile_now); }
typename shader<Stage>::ptr shader<Stage>::from_source(std::string source, const parameters_t& params, bool compile_now) { return from_source(render_source_(source, params), compile_now); }
typename shader<Stage>::ptr shader<Stage>::from_file(std::string filename, bool compile_now) { return from_source(load_file_(filename), compile_now); }