在 iOS 上工作正常,但在适当的时候不行,也许我做错了什么:
GLsizei height = _glview.drawableHeight;
GLsizei width = _glview.drawableWidth;
if (pickingFramebuffer == 0) {
glGenFramebuffers(1, &pickingFramebuffer);
}
glBindFramebuffer(GL_FRAMEBUFFER, pickingFramebuffer);
if (pickingColorRenderbuffer == 0) {
glGenRenderbuffers(1, &pickingColorRenderbuffer);
}
glBindRenderbuffer(GL_RENDERBUFFER, pickingColorRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, pickingColorRenderbuffer);
if (pickingDepthRenderbuffer == 0) {
glGenRenderbuffers(1, &pickingDepthRenderbuffer);
}
glBindRenderbuffer(GL_RENDERBUFFER, pickingDepthRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, pickingDepthRenderbuffer);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
NSLog(@"Framebuffer status: %x", (int)status);
}
日志:
Framebuffer status: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
非常感谢!
编辑: 如果我将添加到每个人的功能和 opengl 指令 OES,Framebuffer 状态将为0
编辑 2:好的,这是一个错误https://code.google.com/p/apportable/issues/detail?id=3