#ifndef MBGL_SHADER_UNIFORM #define MBGL_SHADER_UNIFORM #include #include namespace mbgl { template class Uniform { public: Uniform(const GLchar* name, const Shader& shader) : location(glGetUniformLocation(shader.program, name)) {} void operator=(const T& t) { if (current != t) { current = t; bind(t); } } private: void bind(const T&); T current; GLint location; }; template class UniformMatrix { public: typedef std::array T; UniformMatrix(const GLchar* name, const Shader& shader) : location(glGetUniformLocation(shader.program, name)) {} void operator=(const T& t) { if (current != t) { current = t; bind(t); } } private: void bind(const T&); T current; GLint location; }; } #endif