Dengine/src/Shader.c
Doyle Thai d0b4c99787 Create empty texture idea, change function scopes
Some functions which should not be exposed in the API have been switched
to INTERNAL scope. We have a notion of an empty texture in World Traveller
that we can pass in situations where we just want to render a solid
colour with no associated texture.

The alternative to this was creating a separate shader for rendering
primitives but would require at some point to expose the AssetManager to
the renderer or the user on behalf has to manually switch shaders before
rendering (non-intuitive).
2016-07-16 17:15:03 +10:00

26 lines
787 B
C

#include "Dengine/Shader.h"
void shader_uniformSet1i(Shader *const shader, const GLchar *name,
const GLuint data)
{
GLint uniformLoc = glGetUniformLocation(shader->id, name);
glUniform1i(uniformLoc, data);
}
void shader_uniformSetMat4fv(Shader *const shader, const GLchar *name,
mat4 data)
{
GLint uniformLoc = glGetUniformLocation(shader->id, name);
glUniformMatrix4fv(uniformLoc, 1, GL_FALSE, data.e[0]);
}
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]);
}
void shader_use(const Shader *const shader) { glUseProgram(shader->id); }