Pictures in the UI read as ImGui's colours are: an sRGB picture was turned linear and showed too dark (the logo in About, the Picture panel's paint) — a UNORM view on Vulkan, a skip-decode sampler on OpenGL 4.6 and 4.0, the texture's own setting before 3.3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nexoniarz 2026-10-20 19:01:07 +02:00
commit ffaa5e8001
6 changed files with 79 additions and 5 deletions

View file

@ -14,8 +14,20 @@
#include <string>
#include <vector>
struct ImDrawList;
struct ImDrawCmd;
namespace keel {
// Draw callbacks round an sRGB picture drawn in the UI, so it's read as the plain numbers ImGui's
// own colours are (read as sRGB it turns linear, and looks too dark). None when uiTexture already
// gives such a view (Vulkan).
struct UiRawRead {
void (*begin)(const ImDrawList*, const ImDrawCmd*) = nullptr;
void (*end)(const ImDrawList*, const ImDrawCmd*) = nullptr;
void* data = nullptr;
};
class Window;
using TextureId = uint32_t;
@ -217,6 +229,7 @@ public:
virtual void uploadModel(uint32_t model, const KmdlModel& kmdl) = 0;
// A texture as Dear ImGui's ImTextureID, for drawing it in the UI (0 = none).
virtual uint64_t uiTexture(TextureId slot) = 0;
virtual UiRawRead uiRawRead(TextureId) { return {}; }
// Starts a frame; false when nothing can be drawn (minimised). Sets the drawable size.
virtual bool beginFrame(uint32_t& width, uint32_t& height) = 0;
// Renders the packet, then ImGui's draw data, and presents.