Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Samples/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Shader shader;
shader.attach("main.vert")
.attach("main.frag")
... // and so on ...
shader.link();
```

There is some basic error handling to help you out if you get stuck.
Expand Down
7 changes: 4 additions & 3 deletions Samples/shader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ namespace Mirage
// Public Member Functions
Shader & activate();
Shader & attach(std::string const & filename);
GLuint create(std::string const & filename);
GLuint get() { return mProgram; }
Shader & link();

// Wrap Calls to glUniform
void bind(unsigned int location, float value);
void bind(unsigned int location, glm::mat4 const & matrix);
template<typename T> Shader & bind(std::string const & name, T&& value)
{
int location = glGetUniformLocation(mProgram, name.c_str());
Expand All @@ -38,6 +35,10 @@ namespace Mirage
}

private:
GLuint create(std::string const & filename);

void bind(unsigned int location, float value);
void bind(unsigned int location, glm::mat4 const & matrix);

// Disable Copying and Assignment
Shader(Shader const &) = delete;
Expand Down