From 6c268e0f98722c3253366b639a3a0abe37c8835d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 12 Dec 2021 16:12:01 +0000 Subject: Introduce the UI shader --- gfx/gl/uiShader.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gfx/gl/uiShader.cpp (limited to 'gfx/gl/uiShader.cpp') diff --git a/gfx/gl/uiShader.cpp b/gfx/gl/uiShader.cpp new file mode 100644 index 0000000..2fbb0d4 --- /dev/null +++ b/gfx/gl/uiShader.cpp @@ -0,0 +1,14 @@ +#include "uiShader.h" +#include +#include +#include +#include + +UIShader::UIShader(size_t width, size_t height) : program {uiShader_vs.compile(), uiShader_fs.compile()} +{ + if (auto loc = glGetUniformLocation(program.m_program, "uiProjection"); loc >= 0) { + glUseProgram(program.m_program); + const auto uiProjection = glm::ortho(0, static_cast(width), 0, static_cast(height)); + glUniformMatrix4fv(loc, 1, GL_FALSE, glm::value_ptr(uiProjection)); + } +} -- cgit v1.2.3