6

有没有人成功地做到了这一点?似乎我在模板渲染缓冲区中使用的任何索引格式glCheckFramebufferStatus(...)都会返回GL_FRAMEBUFFER_UNSUPPORTED。我已经成功地绑定了一个深度\颜色渲染缓冲区,但是每当我尝试对我的模板缓冲区做同样的事情时,我都会得到(正如我所说)GL_FRAMEBUFFER_UNSUPPORTED

这是我的代码片段:

// Create frame buffer
GLuint fb;
glGenFramebuffers(1, &fb);

// Create stencil render buffer (note that I create depth buffer the exact same way, and It works.
GLuint sb;
glGenRenderbuffers(1, &sb);
glBindRenderbuffer(GL_RENDERBUFFER, sb);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, w, h);

// Attach color
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, cb, 0);

// Attach stencil buffer
glBindFramebuffer(GL_FRAMEBUFFER, fb);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rb);
// And here I get an GL_FRAMEBUFFER_UNSUPPORTED when doing glCheckFramebufferStatus()

有任何想法吗?

注意:颜色附件是纹理而不是渲染缓冲区

4

2 回答 2

8
于 2012-06-18T16:32:24.463 回答
1

You can use stencil-only on recent nvidia hardware/drivers

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_TEXTURE_2D, fboStencilTexture, 0);

Still no support for both separate depth and stencil

于 2016-11-30T12:56:34.757 回答