X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.h;h=818e72be1174d4a0464bc91b5a691d8f54efd602;hb=927a1aa0a3a27e463ec0efc08bd08e7c4e969909;hp=682ac99fb895b02498a9f9054735f69c558d44a0;hpb=1431f24f29bd6862d547b831c40b2686ff56d1ef;p=libs%2Fgl.git diff --git a/source/program.h b/source/program.h index 682ac99f..818e72be 100644 --- a/source/program.h +++ b/source/program.h @@ -10,8 +10,8 @@ Distributed under the LGPL #include #include -#include -#include "shader.h" +#include +#include "gl.h" #include "types.h" namespace Msp { @@ -21,24 +21,50 @@ class Shader; class Program { +private: + uint id; + std::list shaders; + bool del_shaders; + bool linked; + + static const Program *cur_prog; + public: + class Loader: public DataFile::ObjectLoader + { + public: + Loader(Program &); + + private: + void vertex_shader(const std::string &); + void fragment_shader(const std::string &); + void attribute(uint, const std::string &); + virtual void finish(); + }; + Program(); - ~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(uint, 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; +private: + void maybe_bind(); }; } // namespace GL