X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.cpp;h=e16776f8f53f078a2ae53c39b482326a9e8b16cc;hb=0687d51f638169ffe55ad27e71ae99508ef3c38c;hp=c8ce67a8897fc6fd5499b251e4a7713b71ff496e;hpb=6924ea10c4111b11eab51f0e1aa5b4a6438da7d3;p=libs%2Fgl.git diff --git a/source/program.cpp b/source/program.cpp index c8ce67a8..e16776f8 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -1,10 +1,12 @@ #include #include +#include #include #include #include #include #include +#include #include #include "buffer.h" #include "error.h" @@ -28,8 +30,7 @@ Program::Program(const ProgramBuilder::StandardFeatures &features) ProgramBuilder builder(features); builder.add_shaders(*this); - if(!features.transform) - link(); + link(); } Program::Program(const string &vert, const string &frag) @@ -88,6 +89,17 @@ void Program::bind_attribute(unsigned index, const string &name) glBindAttribLocation(id, index, name.c_str()); } +void Program::bind_attribute(VertexComponent comp, const string &name) +{ + bind_attribute(get_component_type(comp), name); +} + +void Program::bind_fragment_data(unsigned index, const string &name) +{ + static Require _req(EXT_gpu_shader4); + glBindFragDataLocation(id, index, name.c_str()); +} + void Program::link() { for(ShaderList::iterator i=shaders.begin(); i!=shaders.end(); ++i) @@ -114,7 +126,7 @@ void Program::link() if(len && strncmp(name, "gl_", 3)) { /* Some implementations report the first element of a uniform array, - others report just the name of an array. */ + others report just the name of the array itself. */ if(len>3 && !strcmp(name+len-3, "[0]")) name[len-3] = 0; @@ -145,6 +157,7 @@ void Program::link() if(ARB_uniform_buffer_object) { + std::set used_bind_points; count = get_program_i(id, GL_ACTIVE_UNIFORM_BLOCKS); for(unsigned i=0; i