From e1af4abf11ef1600ee686a8fa603506293c554c1 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 7 Oct 2018 21:42:02 +0200 Subject: [PATCH] glgsg: fix sRGB for FBOs created from non-sRGB host window In this case _current_properties in begin_frame() will not have srgb_color set, as the current props are set by the host window --- panda/src/glstuff/glGraphicsBuffer_src.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 66a9e6d407..eab850bdba 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -283,6 +283,13 @@ begin_frame(FrameMode mode, Thread *current_thread) { rebuild_bitplanes(); } + // The host window may not have had sRGB enabled, so we need to do this. +#ifndef OPENGLES + if (get_fb_properties().get_srgb_color()) { + glEnable(GL_FRAMEBUFFER_SRGB); + } +#endif + _gsg->set_current_properties(&get_fb_properties()); report_my_gl_errors(); return true;