diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-08 16:02:56 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-08 16:02:56 +0000 |
| commit | 00fc3cb9b2c06026fab0e4760609fe02e027b6df (patch) | |
| tree | b84b527824ac1d5c999fc4a974fcf2c356b422ab /ui/font.cpp | |
| parent | Replace gl_traits glTexParameter with glTexture::parameter DSA wrapper (diff) | |
| download | ilt-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/font.cpp')
| -rw-r--r-- | ui/font.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
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<GLint>(texture.used), 0, - static_cast<GLsizei>(glyph->bitmap.width), static_cast<GLsizei>(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<std::size_t>(itr - fontTextures.begin()); } auto & texture = fontTextures.emplace_back(); - 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); + 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); |
