OpenGL glFramebufferRenderbuffer() get error: GL_INVALID_OPERATION, status: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT -
i'm trying texture rendering using cocos2d , opengl.
after called
glframebufferrenderbuffer(gl_framebuffer, gl_depth_attachment, gl_renderbuffer, _depthrenderbufffer)
i checked status, using:
glenum status = glcheckframebufferstatus(gl_framebuffer);
and turned out status gl_framebuffer_incomplete_attachment
i checked error using
glenum error = glgeterror();
and result gl_invalid_operation
according the documentation cause of gl_invalid_operation
because:
- the default framebuffer object name 0 bound. or
- if renderbuffer neither 0 nor name of existing renderbuffer object
i checked framebuffer , renderbuffer, neither of them 0, not sure wheather there other rederbuffer object has same name.
does 1 know how fix issue?
the detailed code using:
..... glint oldrbo; glgetintegerv(gl_renderbuffer_binding, &oldrbo); // generate fbo glgenframebuffers(1, &_fbo); glbindframebuffer(gl_framebuffer, _fbo); // associate texture fbo glframebuffertexture2d(gl_framebuffer, gl_color_attachment0, gl_texture_2d, _texture.name, 0); if (depthstencilformat != 0) { glgenrenderbuffers(1, &_depthrenderbufffer); glbindrenderbuffer(gl_renderbuffer, _depthrenderbufffer); glrenderbufferstorage(gl_renderbuffer, depthstencilformat, (glsizei)poww, (glsizei)powh); glframebufferrenderbuffer(gl_framebuffer, gl_depth_attachment, gl_renderbuffer, _depthrenderbufffer); glenum status = glcheckframebufferstatus(gl_framebuffer); // status here result in gl_framebuffer_incomplete_attachment glenum error = glgeterror (); // error here gl_invalid_operation // checked value of _fbo, 1, , value of _depthrenderbufffer 2 ..... }
Comments
Post a Comment