From 64ede41ebaade64ad6705f7f55ca4a778a156481 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 2 Mar 2026 13:17:28 +0000 Subject: Wrap up some low level texture operations in glTexture class Fixes previously hard coded billboard texture size. --- ui/font.cpp | 4 ++-- ui/font.h | 2 +- ui/icon.cpp | 2 +- ui/icon.h | 2 +- ui/svgIcon.cpp | 2 +- ui/svgIcon.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ui') 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(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(size.x), static_cast(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 #include #include -#include #include #include #include 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 -#include #include #include 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 #include #include -- cgit v1.3