summaryrefslogtreecommitdiff
path: root/ui/svgIcon.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-03-08 16:02:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-08 16:02:56 +0000
commit00fc3cb9b2c06026fab0e4760609fe02e027b6df (patch)
treeb84b527824ac1d5c999fc4a974fcf2c356b422ab /ui/svgIcon.cpp
parentReplace gl_traits glTexParameter with glTexture::parameter DSA wrapper (diff)
downloadilt-00fc3cb9b2c06026fab0e4760609fe02e027b6df.tar.bz2
ilt-00fc3cb9b2c06026fab0e4760609fe02e027b6df.tar.xz
ilt-00fc3cb9b2c06026fab0e4760609fe02e027b6df.zip
Move all low level texture operations to DSA helpers in glTexture
Diffstat (limited to 'ui/svgIcon.cpp')
-rw-r--r--ui/svgIcon.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/ui/svgIcon.cpp b/ui/svgIcon.cpp
index 82ef69d..2c73b5d 100644
--- a/ui/svgIcon.cpp
+++ b/ui/svgIcon.cpp
@@ -14,19 +14,18 @@ SvgIcon::SvgIcon(ImageDimensions dim, const std::filesystem::path & path)
}
bitmap.convertToRGBA();
- texture.bind();
-
+ texture.storage(1, GL_RGBA8, dim);
texture.parameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
texture.parameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
texture.parameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
texture.parameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dim.x, dim.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.data());
+ texture.image(dim, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.data());
}
ImTextureID
SvgIcon::operator*() const
{
- static_assert(sizeof(glTexture) <= sizeof(ImTextureID));
+ static_assert(sizeof(glTexture<GL_TEXTURE_2D>) <= sizeof(ImTextureID));
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast,performance-no-int-to-ptr) This is how ImGui works
return reinterpret_cast<ImTextureID>(*texture);
}