X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.cpp;h=2d298e82e9d29922a3c18b1d5236dadb25ae402b;hb=74bd3813b9744550c9ac5980588e561835b616d9;hp=30c73f33631373c7043a66f20509b7cc09369ea6;hpb=b152e4f63170e8ccd6c9fb9397964c628fb6efeb;p=libs%2Fgl.git diff --git a/source/program.cpp b/source/program.cpp index 30c73f33..2d298e82 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -8,11 +8,13 @@ #include #include #include +#include #include #include "buffer.h" #include "error.h" #include "misc.h" #include "program.h" +#include "programcompiler.h" #include "shader.h" using namespace std; @@ -34,6 +36,16 @@ Program::Program(const ProgramBuilder::StandardFeatures &features) link(); } +Program::Program(const std::string &source) +{ + init(); + + ProgramCompiler compiler; + compiler.compile(source); + compiler.add_shaders(*this); + link(); +} + Program::Program(const string &vert, const string &frag) { init(); @@ -115,6 +127,12 @@ void Program::link() if(!linked) throw compile_error(get_info_log()); +#ifdef DEBUG + std::string info_log = get_info_log(); + if(!info_log.empty()) + IO::print("Program link info log:\n%s", info_log); +#endif + unsigned count = get_program_i(id, GL_ACTIVE_UNIFORMS); vector uniforms_by_index(count); for(unsigned i=0; i