#ifndef GLPROGRAM_H
#define GLPROGRAM_H

#include "jes/Ref.h"
#include "GLShader.h"
#include <map>
#include <string>
#include <vector>

namespace jes
{
    class GLProgram
    {
    public:
        GLProgram();
        ~GLProgram();
        GLProgram & attach_shader(GLShaderRef shader);
        GLProgram & bind_attribute(const char * attribute, GLuint index);
        bool link();
        GLuint get_id() { return m_id; }
        void use() { glUseProgram(m_id); }
        GLint get_uniform(const std::string & uniform_name);
    protected:
        GLuint m_id;
        std::map<std::string, GLint> m_uniforms;
    };
    typedef Ref<GLProgram> GLProgramRef;
}

#endif
