From 66897c4a0d40bbbcd19f8d4ec3df8c912388d2c5 Mon Sep 17 00:00:00 2001 From: dimi309 Date: Sun, 8 Dec 2024 10:41:45 +0100 Subject: [PATCH] Output colour encoding when capturing screen in debug mode. --- src/Renderer.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 78b72558..124532bf 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -1114,6 +1114,21 @@ namespace small3d { GLubyte* pixels = new GLubyte[imgSize]; glReadBuffer(GL_BACK); + + GLint encoding = 0; + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &encoding); + + switch (encoding) { + case GL_LINEAR: + LOGDEBUG("Capturing screen, GL_BACK buffer encoding detected is GL_LINEAR."); + break; + case GL_SRGB: + LOGDEBUG("Capturing screen, GL_BACK buffer encoding detected is GL_SRGB."); + break; + default: + LOGDEBUG("Capturing sceen, detected unforeseen encoding."); + } + glPixelStorei(GL_PACK_ALIGNMENT, 4); checkForOpenGLErrors("setting pack alignment", true); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);