Tech ENABLE_GL_IMGUI_SHADERS - Render imgui using shaders

This commit is contained in:
enricoturri1966 2022-03-14 09:04:44 +01:00
parent 3dddfa919a
commit d0d89a4d5b
7 changed files with 182 additions and 7 deletions

View file

@ -122,8 +122,7 @@ bool GLShaderProgram::init_from_texts(const std::string& name, const ShaderSourc
for (size_t i = 0; i < static_cast<size_t>(EShaderType::Count); ++i) {
const std::string& source = sources[i];
if (!source.empty())
{
if (!source.empty()) {
EShaderType type = static_cast<EShaderType>(i);
auto [result, id] = create_shader(type);
if (result)
@ -303,6 +302,19 @@ void GLShaderProgram::set_uniform(int id, const Matrix3d& value) const
}
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
#if ENABLE_GL_IMGUI_SHADERS
void GLShaderProgram::set_uniform(int id, const Matrix4f& value) const
{
if (id >= 0)
glsafe(::glUniformMatrix4fv(id, 1, GL_FALSE, static_cast<const GLfloat*>(value.data())));
}
void GLShaderProgram::set_uniform(int id, const Matrix4d& value) const
{
set_uniform(id, (Matrix4f)value.cast<float>());
}
#endif // ENABLE_GL_IMGUI_SHADERS
void GLShaderProgram::set_uniform(int id, const Vec3f& value) const
{
if (id >= 0)