All Classes Files Functions Variables Typedefs Pages
Shader.hpp
1 #pragma once
2 #include "GLObject.hpp"
3 #include "Shader.fpp"
4 #include "ShaderSource.hpp"
5 #include "../config/BaseProxy.hpp"
6 
7 #include "GL/glew.h"
8 #include <string>
9 
10 namespace lumina {
11 
18 template <ShaderType Type>
19 class Shader : public GLObject {
20 public:
21  // typedefs and constexpr
22  static constexpr ShaderType shaderType = Type;
23 
24  // default constructor
25  Shader();
26 
27  // descructor
28  ~Shader();
29 
31  GLuint getHandle() const;
32 
34  std::string getFilename() const;
35 
37  void compile(ShaderSource source);
38 
40  void compile(std::string code);
41 
42 private:
43  GLuint m_handle;
44  std::string m_filename;
45 
46  void createShaderObject();
47 };
48 
49 }
50 
51 #include "Shader.tpp"
GLuint getHandle() const
Returns native OpenGL handle.
Definition: Shader.tpp:7
std::string getFilename() const
Returns the filename of the shader.
Definition: Shader.tpp:9
Pair of filename and shader code.
void compile(ShaderSource source)
Compiles the shader from a ShaderSource.
Definition: Shader.cpp:26