Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
ShaderProgram.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <unordered_map>
4#include <GL/glew.h>
5#include <glm/mat4x4.hpp>
6
7namespace eng
8{
9 class Texture;
10
12 {
13 public:
14 ShaderProgram() = delete;
15 ShaderProgram(const ShaderProgram&) = delete;
17 explicit ShaderProgram(GLuint shaderProgramID);
19
20 void Bind();
21 GLint GetUniformLocation(const std::string& name);
22 void SetUniform(const std::string& name, float value);
23 void SetUniform(const std::string& name, float v0, float v1);
24 void SetUniform(const std::string& name, const glm::mat4& mat);
25 void SetUniform(const std::string& name, const glm::vec3& value);
26 void SetUniform(const std::string& name, const glm::vec4& value);
27 void SetTexture(const std::string& name, Texture* texture);
28
29 private:
30 std::unordered_map<std::string, GLint> m_uniformLocationCache;
31 GLuint m_shaderProgramID = 0;
32 int m_currentTextureUnit = 0;
33 };
34}
int GLint
Definition GLForward.h:13
unsigned int GLuint
Definition GLForward.h:11
GLint GetUniformLocation(const std::string &name)
ShaderProgram()=delete
void SetUniform(const std::string &name, float value)
ShaderProgram(const ShaderProgram &)=delete
ShaderProgram & operator=(const ShaderProgram &)=delete
void SetTexture(const std::string &name, Texture *texture)