#ifndef SPECTRE_GRAPHICS_SHADER_H #define SPECTRE_GRAPHICS_SHADER_H #include class Shader { public : enum Type { Vertex, Fragment }; Shader(Type type, const std::string& name = ""); ~Shader(); unsigned int getHandle() const; const std::string& getName() const; // Load shader from file. bool loadFromFile(const std::string& file); // Load shader from memory bool loadFromMemory(const std::string& source); const std::string& getError() const; // Is this shader compiled? bool isCompiled() const; protected : // Compile the shader. // Returns true if the shader compiled without errors. false otherwise. bool compile(); std::string fetchErrorLog(); protected : // Type of shader. Vertex, fragment, geometry etc. Type m_type; unsigned int m_handle; // Shader id. // A name for the shader (usually the filename if loaded from file). std::string m_name; std::string m_error; }; #endif /* SPECTRE_GRAPHICS_SHADER_H */