Skip to content

Commit

Permalink
Output colour encoding when capturing screen in debug mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimi309 committed Dec 8, 2024
1 parent 4c09b5d commit 66897c4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 66897c4

Please sign in to comment.