在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
非常感谢!
修改 如果我将添加到everyone函数和opengl指令OES,则Framebuffer状态将为 0
编辑2:好的,这是一个错误https://code.google.com/p/apportable/issues/detail?id=3