Added convenience function to add texture to shader

This commit is contained in:
Robert 2021-01-21 16:40:00 +01:00
parent f1f076acf4
commit 1c008b1c9d
3 changed files with 42 additions and 5 deletions

View file

@ -6,6 +6,7 @@
#include <iostream>
#include <color.hpp>
#include <texture.hpp>
namespace oglu
{
@ -235,6 +236,17 @@ namespace oglu
glUniform4f(location, v0.r, v0.g, v0.b, v0.a);
}
void AbstractShader::SetUniform(const GLchar* name, const Texture& v0, GLbyte index)
{
SetUniform(glGetUniformLocation(program, name), v0, index);
}
void AbstractShader::SetUniform(GLint location, const Texture& v0, GLbyte index)
{
v0->BindAs(index);
glUniform1i(location, index);
}
void AbstractShader::SetUniform1fv(const GLchar* name, GLsizei count, const GLfloat* value)
{
glUniform1fv(glGetUniformLocation(program, name), count, value);