Dengine/src/Shader.c

26 lines
787 B
C
Raw Normal View History

2016-06-28 06:00:03 +00:00
#include "Dengine/Shader.h"
2016-06-03 05:07:40 +00:00
2016-06-17 14:40:40 +00:00
void shader_uniformSet1i(Shader *const shader, const GLchar *name,
const GLuint data)
2016-06-09 05:49:03 +00:00
{
2016-06-17 14:40:40 +00:00
GLint uniformLoc = glGetUniformLocation(shader->id, name);
2016-06-09 05:49:03 +00:00
glUniform1i(uniformLoc, data);
}
2016-06-17 14:40:40 +00:00
void shader_uniformSetMat4fv(Shader *const shader, const GLchar *name,
mat4 data)
2016-06-09 05:49:03 +00:00
{
2016-06-17 14:40:40 +00:00
GLint uniformLoc = glGetUniformLocation(shader->id, name);
glUniformMatrix4fv(uniformLoc, 1, GL_FALSE, data.e[0]);
2016-06-09 05:49:03 +00:00
}
void shader_uniformSetVec4f(Shader *const shader, const GLchar *name,
v4 data)
{
GLint uniformLoc = glGetUniformLocation(shader->id, name);
glUniform4f(uniformLoc, data.e[0], data.e[1], data.e[2], data.e[3]);
}
2016-06-17 14:40:40 +00:00
void shader_use(const Shader *const shader) { glUseProgram(shader->id); }