From be9f3b4e8b67dc4808c3ce877c4a3fb1cf72a735 Mon Sep 17 00:00:00 2001 From: Aiden Date: Fri, 22 May 2026 17:27:29 +1000 Subject: [PATCH] font changing on the fly --- config/runtime-host.json | 4 ++-- src/render/runtime/RuntimeTextTextureCache.cpp | 10 +++++++++- src/render/runtime/RuntimeTextTextureCache.h | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/config/runtime-host.json b/config/runtime-host.json index eac6e33..84947b8 100644 --- a/config/runtime-host.json +++ b/config/runtime-host.json @@ -12,8 +12,8 @@ "frameRate": "59.94" }, "output": { - "backend": "ndi", - "device": "shader toys", + "backend": "decklink", + "device": "default", "resolution": "1080p", "frameRate": "59.94", "keying": { diff --git a/src/render/runtime/RuntimeTextTextureCache.cpp b/src/render/runtime/RuntimeTextTextureCache.cpp index 97eb552..d8a680c 100644 --- a/src/render/runtime/RuntimeTextTextureCache.cpp +++ b/src/render/runtime/RuntimeTextTextureCache.cpp @@ -103,8 +103,14 @@ bool RuntimeTextTextureCache::EnsureTextTexture(TextTexture& texture) const RuntimePreparedTextTexture* prepared = FindPreparedTexture(texture.parameterId); if (!prepared || !prepared->rgbaPixels || prepared->rgbaPixels->empty() || prepared->width == 0 || prepared->height == 0) return false; - if (texture.texture != 0 && texture.cachedText == prepared->textValue && texture.width == prepared->width && texture.height == prepared->height) + if (texture.texture != 0 && + texture.cachedText == prepared->textValue && + texture.cachedPixels == prepared->rgbaPixels && + texture.width == prepared->width && + texture.height == prepared->height) + { return true; + } if (texture.texture == 0) glGenTextures(1, &texture.texture); @@ -130,6 +136,7 @@ bool RuntimeTextTextureCache::EnsureTextTexture(TextTexture& texture) glActiveTexture(GL_TEXTURE0); texture.cachedText = prepared->textValue; + texture.cachedPixels = prepared->rgbaPixels; texture.width = prepared->width; texture.height = prepared->height; texture.liveWidth = prepared->liveWidth; @@ -154,4 +161,5 @@ void RuntimeTextTextureCache::DestroyTexture(TextTexture& texture) texture.width = 0; texture.height = 0; texture.cachedText.clear(); + texture.cachedPixels.reset(); } diff --git a/src/render/runtime/RuntimeTextTextureCache.h b/src/render/runtime/RuntimeTextTextureCache.h index fbd8818..2efb4d9 100644 --- a/src/render/runtime/RuntimeTextTextureCache.h +++ b/src/render/runtime/RuntimeTextTextureCache.h @@ -4,6 +4,7 @@ #include "RuntimeShaderArtifact.h" #include +#include #include #include @@ -28,6 +29,7 @@ private: { std::string parameterId; std::string cachedText; + std::shared_ptr> cachedPixels; GLuint texture = 0; unsigned width = 0; unsigned height = 0;