fix depth buffer creation

This commit is contained in:
2019-05-20 12:12:44 +02:00
parent 0e22e9918a
commit 63b38eff92
6 changed files with 18 additions and 6 deletions

View File

@@ -137,7 +137,7 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format,
{
glGenRenderbuffers(1, &rboID);
glBindRenderbuffer(GL_RENDERBUFFER, rboID);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
@@ -151,9 +151,11 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format,
// Attach the texture to FBO color attachment point
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texID, 0);
// Attach the renderbuffer to depth attachment point
//glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboID);
if (depth_buffer)
{
// Attach the renderbuffer to depth attachment point
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboID);
}
auto err2str = [](GLenum err) {
switch (err)