X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.h;h=e78c8ccd0bfef96d0da006827bd6e22dee527973;hb=20703b6d4dfd0836cdb787bd416d4ae9bf010602;hp=8cdfb6de44e561910b0f4e446d0d0095bab76b89;hpb=9034e81679eeeaa3d1d5d643d3f924d9edb45a68;p=libs%2Fgl.git diff --git a/source/program.h b/source/program.h index 8cdfb6de..e78c8ccd 100644 --- a/source/program.h +++ b/source/program.h @@ -7,12 +7,17 @@ #include "bindable.h" #include "gl.h" #include "programbuilder.h" +#include "vertexformat.h" namespace Msp { namespace GL { class Shader; +/** +A complete shader program. Programs can be assembled of individual Shaders or +generated with a set of standard features. +*/ class Program: public Bindable { public: @@ -64,11 +69,18 @@ private: UniformBlockMap uniform_blocks; UniformMap uniforms; unsigned uniform_layout_hash; + bool legacy_vars; public: + /// Constructs an empty Program with no Shaders attached. Program(); + + /// Constructs a Program with standard features. Program(const ProgramBuilder::StandardFeatures &); + + /// Constructs a Program from vertex and fragment shader source code. Program(const std::string &, const std::string &); + private: void init(); public: @@ -80,6 +92,8 @@ public: const ShaderList &get_shaders() const { return shaders; } void bind_attribute(unsigned, const std::string &); + void bind_attribute(VertexComponent, const std::string &); + void bind_fragment_data(unsigned, const std::string &); void link(); private: @@ -96,6 +110,8 @@ public: const UniformInfo &get_uniform_info(const std::string &) const; int get_uniform_location(const std::string &) const; + bool uses_legacy_variables() const { return legacy_vars; } + void bind() const; static void unbind(); };