]> git.tdb.fi Git - libs/gl.git/blobdiff - source/program.h
Better way to deal with program-owned shaders
[libs/gl.git] / source / program.h
index 1e41e84423f8680ba787a83d8ecea5c45d1bc7c7..ac8e24b54b6a8143510ac743d6676e963e3b78ae 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_GL_PROGRAM_H_
 #define MSP_GL_PROGRAM_H_
 
@@ -50,17 +43,27 @@ public:
                bool specular;
                bool normalmap;
                bool shadow;
+               bool transform;
 
                StandardFeatures();
 
                std::string create_flags() const;
        };
 
+       struct UniformInfo
+       {
+               std::string name;
+               int location;
+               int size;
+               GLenum type;
+       };
+
 private:
        unsigned id;
        std::list<Shader *> shaders;
-       bool del_shaders;
+       std::list<Shader *> owned_data;
        bool linked;
+       std::map<std::string, UniformInfo> uniforms;
 
 public:
        Program();
@@ -72,17 +75,16 @@ public:
        virtual ~Program();
 
        void attach_shader(Shader &shader);
+       void attach_shader_owned(Shader *shader);
        void detach_shader(Shader &shader);
        void add_standard_shaders(const StandardFeatures &);
 private:
        static std::string process_standard_source(const char **, const std::string &);
 public:
        const std::list<Shader *> &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; }
+       bool is_linked() const { return linked; }
        std::string get_info_log() const;
        void bind() const;
        int get_uniform_location(const std::string &) const;