X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogram.h;h=af506fe8c57b1128a5354e1515c20059bcccdb1e;hb=ceae2a27dfc58310c5bab7e3aa3fedf0fa9a1f49;hp=f007fb3a5d3636b72820ffb9b6656e7860172977;hpb=3f285d3f4fd0a6790bf1efa780284dc7ba2287a2;p=libs%2Fgl.git diff --git a/source/program.h b/source/program.h index f007fb3a..af506fe8 100644 --- a/source/program.h +++ b/source/program.h @@ -10,9 +10,8 @@ Distributed under the LGPL #include #include -#include -#include -#include "types.h" +#include +#include "gl.h" namespace Msp { namespace GL { @@ -22,49 +21,44 @@ class Shader; class Program { private: - uint id; + unsigned id; std::list shaders; bool del_shaders; bool linked; - static Program *cur_prog; + static const Program *cur_prog; public: - class Loader: public DataFile::Loader + class Loader: public DataFile::ObjectLoader { - private: - Program &prog; - public: Loader(Program &); - ~Loader(); 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); const std::list &get_shaders() const { return shaders; } void set_del_shaders(bool); - void bind_attribute(int, const std::string &); - bool link(); + 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; - void uniform(int, int); - void uniform(int, float); - void uniform(int, float, float); - void uniform(int, float, float, float); - void uniform(int, float, float, float, float); - void uniform_matrix4(int, const float *); static void unbind();