From 9cea4788598f363424feafc01b0ac2bfb8cd5dcd Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 23 Oct 2020 17:12:38 +0300 Subject: [PATCH] Add bool uniforms --- libs/gfx/include/psemek/gfx/program.hpp | 1 + libs/gfx/source/program.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/libs/gfx/include/psemek/gfx/program.hpp b/libs/gfx/include/psemek/gfx/program.hpp index 3a63361d..dcd047cb 100644 --- a/libs/gfx/include/psemek/gfx/program.hpp +++ b/libs/gfx/include/psemek/gfx/program.hpp @@ -34,6 +34,7 @@ namespace psemek::gfx GLint location() const { return location_; } + void operator = (bool b); void operator = (int i); void operator = (unsigned int i); void operator = (float f); diff --git a/libs/gfx/source/program.cpp b/libs/gfx/source/program.cpp index e96c7fab..a610f957 100644 --- a/libs/gfx/source/program.cpp +++ b/libs/gfx/source/program.cpp @@ -9,6 +9,11 @@ namespace psemek::gfx { + void program::uniform_proxy::operator = (bool b) + { + gl::Uniform1i(location_, b ? 1 : 0); + } + void program::uniform_proxy::operator = (int i) { gl::Uniform1i(location_, i);