summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-02 13:17:28 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-02 13:17:28 +0000
commit64ede41ebaade64ad6705f7f55ca4a778a156481 (patch)
tree6d2fbc64cd28d272fe3f5bbf79ddd41ecc5e2626 /ui
parentRefactor glArrays to better expose underlying types (diff)
downloadilt-64ede41ebaade64ad6705f7f55ca4a778a156481.tar.bz2
ilt-64ede41ebaade64ad6705f7f55ca4a778a156481.tar.xz
ilt-64ede41ebaade64ad6705f7f55ca4a778a156481.zip
Wrap up some low level texture operations in glTexture classHEADmain
Fixes previously hard coded billboard texture size.
Diffstat (limited to 'ui')
-rw-r--r--ui/font.cpp4
-rw-r--r--ui/font.h2
-rw-r--r--ui/icon.cpp2
-rw-r--r--ui/icon.h2
-rw-r--r--ui/svgIcon.cpp2
-rw-r--r--ui/svgIcon.h2
6 files changed, 7 insertions, 7 deletions
diff --git a/ui/font.cpp b/ui/font.cpp
index ebd29d0..d8e1257 100644
--- a/ui/font.cpp
+++ b/ui/font.cpp
@@ -116,12 +116,12 @@ Font::getTextureWithSpace(unsigned int adv) const
return (ft.used + adv) < size.x;
});
itr != fontTextures.end()) {
- glBindTexture(GL_TEXTURE_2D, itr->texture);
+ itr->texture.bind();
return static_cast<std::size_t>(itr - fontTextures.begin());
}
auto & texture = fontTextures.emplace_back();
- glBindTexture(GL_TEXTURE_2D, texture.texture);
+ texture.texture.bind();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, static_cast<GLsizei>(size.x), static_cast<GLsizei>(size.y), 0, GL_RED,
GL_UNSIGNED_BYTE, nullptr);
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
diff --git a/ui/font.h b/ui/font.h
index 3254f80..8cf3229 100644
--- a/ui/font.h
+++ b/ui/font.h
@@ -1,9 +1,9 @@
#pragma once
+#include "gfx/gl/glTexture.h"
#include <array>
#include <cstddef>
#include <filesystem>
-#include <glArrays.h>
#include <glad/gl.h>
#include <glm/glm.hpp>
#include <map>
diff --git a/ui/icon.cpp b/ui/icon.cpp
index 0bdc91a..0422804 100644
--- a/ui/icon.cpp
+++ b/ui/icon.cpp
@@ -11,7 +11,7 @@ Icon::Icon(const std::filesystem::path & fileName) : Icon {Image {Resource::mapP
Icon::Icon(const Image & tex) : size {tex.width, tex.height}
{
- glBindTexture(GL_TEXTURE_2D, m_texture);
+ m_texture.bind();
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
diff --git a/ui/icon.h b/ui/icon.h
index 14aa79b..2023be8 100644
--- a/ui/icon.h
+++ b/ui/icon.h
@@ -1,7 +1,7 @@
#pragma once
+#include "gfx/gl/glTexture.h"
#include <filesystem>
-#include <glArrays.h>
#include <glm/glm.hpp>
#include <imgui.h>
diff --git a/ui/svgIcon.cpp b/ui/svgIcon.cpp
index 499d9cc..42e046a 100644
--- a/ui/svgIcon.cpp
+++ b/ui/svgIcon.cpp
@@ -15,7 +15,7 @@ SvgIcon::SvgIcon(ImageDimensions dim, const std::filesystem::path & path)
}
bitmap.convertToRGBA();
- glBindTexture(GL_TEXTURE_2D, texture);
+ texture.bind();
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
diff --git a/ui/svgIcon.h b/ui/svgIcon.h
index 02c1e53..be01446 100644
--- a/ui/svgIcon.h
+++ b/ui/svgIcon.h
@@ -1,6 +1,6 @@
#pragma once
-#include "glArrays.h"
+#include "gfx/gl/glTexture.h"
#include <config/types.h>
#include <filesystem>
#include <imgui.h>