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.
pull/36/head
whitequark 2016-08-21 19:58:45 +00:00
parent 991909d794
commit a1e18ae4a6
1 changed files with 3 additions and 2 deletions

View File

@ -22,11 +22,12 @@ void GlOffscreen::Clear() {
bool GlOffscreen::Render(int width, int height, std::function<void()> renderFn) { bool GlOffscreen::Render(int width, int height, std::function<void()> renderFn) {
data.resize(width * height * 4); data.resize(width * height * 4);
if(framebuffer == 0) { if(framebuffer == 0)
glGenFramebuffersEXT(1, &framebuffer); glGenFramebuffersEXT(1, &framebuffer);
if(colorRenderbuffer == 0)
glGenRenderbuffersEXT(1, &colorRenderbuffer); glGenRenderbuffersEXT(1, &colorRenderbuffer);
if(depthRenderbuffer == 0)
glGenRenderbuffersEXT(1, &depthRenderbuffer); glGenRenderbuffersEXT(1, &depthRenderbuffer);
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);