From 00fc3cb9b2c06026fab0e4760609fe02e027b6df Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 8 Mar 2026 16:02:56 +0000 Subject: Move all low level texture operations to DSA helpers in glTexture --- ui/font.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'ui/font.cpp') diff --git a/ui/font.cpp b/ui/font.cpp index b028c52..9c3d770 100644 --- a/ui/font.cpp +++ b/ui/font.cpp @@ -92,8 +92,7 @@ Font::generateChars(const utf8_string_view chars) const const auto textureIdx = getTextureWithSpace(glyph->bitmap.width); auto & texture = fontTextures[textureIdx]; - glTexSubImage2D(GL_TEXTURE_2D, 0, static_cast(texture.used), 0, - static_cast(glyph->bitmap.width), static_cast(glyph->bitmap.rows), GL_RED, + texture.texture.subImage({texture.used, 0}, {glyph->bitmap.width, glyph->bitmap.rows}, GL_RED, GL_UNSIGNED_BYTE, glyph->bitmap.buffer); const auto & cd = charsData @@ -115,14 +114,11 @@ Font::getTextureWithSpace(unsigned int adv) const return (ft.used + adv) < size.x; }); itr != fontTextures.end()) { - itr->texture.bind(); return static_cast(itr - fontTextures.begin()); } auto & texture = fontTextures.emplace_back(); - 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); + texture.texture.storage(1, GL_R8, size); texture.texture.parameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); texture.texture.parameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); texture.texture.parameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR); -- cgit v1.3