/* ================================================================ Program ---------------- This file describes our Program class. This class is responsible for loading, creating, and compiling OpenGL programs. ================================================================ */ #ifndef PROGRAM_HPP #define PROGRAM_HPP #include "common.hpp" #include class Program { // public: class Variable { friend class Program; public: enum VariableType { UNDEF, INT, UINT, FLOAT, DOUBLE, TEXTURE }; Variable(VariableType type); ~Variable(); protected: int type; // 0 = uniform, 1 = attribute GLint location; int data_type; char *data; size_t length; }; class Texture { friend class Program; public: Texture() { location = -1; index = 0; texture = 0;}; protected: GLint location; GLuint index; GLuint texture; }; public: Program(); ~Program(); int addShader(const char *file, GLenum type); int attachTexture(GLuint index, GLuint texture); int setTexture(GLuint index, GLuint texture); int doCompile(); int doClean(); GLuint getUniform(const char *name); GLuint getProgram(); int activate(); int deactivate(); protected: GLuint program; // Compiled shader program private: std::vector shader_type; // Type of shader program, tied to v std::vector shader_prog; // Compiled shader program, tied to ^ std::vector shader_uniform; // Shader uniform locations std::vector shader_textures;// Textures that this shader uses std::vector shader_variables; }; #endif