X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.h;h=63d43e0f800f65b9ac58b7df6017c6bf7b51588f;hb=5172d32d67595ea0b70184fadcfcb8e023cccbc8;hp=5b1ae29f3ed0681b9a4eb930d938a712fecfacdc;hpb=48420e9e3f950cfe1e3ced8f8ea92d89671ae8c4;p=libs%2Fgl.git diff --git a/source/program.h b/source/program.h index 5b1ae29f..63d43e0f 100644 --- a/source/program.h +++ b/source/program.h @@ -10,35 +10,56 @@ Distributed under the LGPL #include #include -#include -#include "shader.h" -#include "types.h" +#include +#include "bindable.h" +#include "gl.h" namespace Msp { namespace GL { class Shader; -class Program +class Program: public Bindable { +private: + unsigned id; + std::list shaders; + bool del_shaders; + bool linked; + public: + class Loader: public DataFile::ObjectLoader + { + public: + Loader(Program &); + + private: + void vertex_shader(const std::string &); + void fragment_shader(const std::string &); + void attribute(unsigned, const std::string &); + virtual void finish(); + }; + Program(); + Program(const std::string &, const std::string &); +private: + void init(); +public: virtual ~Program(); void attach_shader(Shader &shader); void detach_shader(Shader &shader); - bool link(); + const std::list &get_shaders() const { return shaders; } + void set_del_shaders(bool); + void bind_attribute(unsigned, const std::string &); + void link(); int get_param(GLenum param) const; + bool get_linked() const { return linked; } std::string get_info_log() const; - void bind(); + void bind() const; + int get_uniform_location(const std::string &) const; static void unbind(); -private: - uint id; - std::list shaders; - bool linked; - - static Program *cur_prog; }; } // namespace GL