Small refactoring in Bed3D and GLShader

This commit is contained in:
Enrico Turri 2019-02-27 15:19:03 +01:00
parent 6e9c030f17
commit 68805fc63a
5 changed files with 51 additions and 65 deletions

View file

@ -225,6 +225,17 @@ bool GLShader::set_uniform(const char* name, const float* matrix) const
return false;
}
bool GLShader::set_uniform(const char* name, int value) const
{
int id = get_uniform_location(name);
if (id >= 0)
{
::glUniform1i(id, value);
return true;
}
return false;
}
/*
# Set shader vector
sub SetVector
@ -321,7 +332,7 @@ void Shader::set_uniform(const std::string& name, const float* matrix) const
void Shader::set_uniform(const std::string& name, bool value) const
{
if (m_shader != nullptr)
m_shader->set_uniform(name.c_str(), value);
m_shader->set_uniform(name.c_str(), value ? 1 : 0);
}
unsigned int Shader::get_shader_program_id() const