From a1e18ae4a6d88e8aa2cdf608e41ebce4cbf7172c Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 21 Aug 2016 19:58:45 +0000 Subject: [PATCH] GlOffscreen: create color/depth renderbuffers separately. This fixes a strange problem where GTK 2 (but not GTK 3) with NVidia drivers would not have a depth buffer, but only during exporting PNGs, despite the fact that normal rendering path and PNG rendering path come through the same offscreen rendering code. --- src/render/rendergl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/render/rendergl.cpp b/src/render/rendergl.cpp index 1e65e596..01ee8a5f 100644 --- a/src/render/rendergl.cpp +++ b/src/render/rendergl.cpp @@ -22,11 +22,12 @@ void GlOffscreen::Clear() { bool GlOffscreen::Render(int width, int height, std::function renderFn) { data.resize(width * height * 4); - if(framebuffer == 0) { + if(framebuffer == 0) glGenFramebuffersEXT(1, &framebuffer); + if(colorRenderbuffer == 0) glGenRenderbuffersEXT(1, &colorRenderbuffer); + if(depthRenderbuffer == 0) glGenRenderbuffersEXT(1, &depthRenderbuffer); - } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);