1
0
Fork 0
spectre/include/Spectre/Graphics/Shader.h
Henrik Hautakoski e10daeaaa6
Move everything from global namespace to "sp" namespace
When writing the X11 (linux) implementation there was a problem with X11 defining a "Display" type and we also have a Display class in the engine.

So to fix that problem and minimize the risk for running into other name conflicts. We move everything from global namespace.
2019-09-30 19:10:17 +02:00

58 lines
No EOL
1,004 B
C++

#ifndef SPECTRE_GRAPHICS_SHADER_H
#define SPECTRE_GRAPHICS_SHADER_H
#include <string>
namespace sp {
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;
};
} // namespace sp
#endif /* SPECTRE_GRAPHICS_SHADER_H */