我正在制作一个绘画应用程序。我想更改延音以添加重做和撤消功能。但是渲染后我无法制作完整的帧缓冲区。
CAEAGLLayer* pGLLayer = ( CAEAGLLayer* )self.layer;
pGLLayer.opaque = YES;
pGLLayer.drawableProperties = [ NSDictionary dictionaryWithObjectsAndKeys:[ NSNumber numberWithBool:YES ],
kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8,
kEAGLDrawablePropertyColorFormat,
nil ];
mpGLContext = [ [EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1 ];
[ EAGLContext setCurrentContext:mpGLContext ];
glGenFramebuffers( 1, &FrameBuffer );
glBindFramebuffer( GL_FRAMEBUFFER, FrameBuffer );
glGenRenderbuffers( 1, &firstColorBuffer );
glBindRenderbuffer( GL_RENDERBUFFER, firstColorBuffer );
[ mpGLContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:( CAEAGLLayer* )self.layer ];
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, firstColorBuffer );
glOrthof( 0.0f, 320.0f, 480.0f, 0.0f, 0.5f, -0.5f );
glViewport( 0, 0, 320, 480 );
// here status is GL_FRAMEBUFFER_COMPLETE
GLenum status = glCheckFramebufferStatus( GL_FRAMEBUFFER );
/** render function **/
glGenRenderbuffers( 1, &secondColorBuffer );
glBindRenderbuffer( GL_RENDERBUFFER, secondColorBuffer );
[ mpGLContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:( CAEAGLLayer* )self.layer ];
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, firstColorBuffer );
// here status is GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
GLenum status = glCheckFramebufferStatus( GL_FRAMEBUFFER );
glCheckFramebufferStatus 返回 GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES。但是我绑定了渲染缓冲区。所以有一个framebuffer的附件。我应该在这段代码中修复什么来制作完整的帧缓冲区。