iPhone post-processing with a single FBO with Opengl ES 2.0?

Posted by Jing on Stack Overflow See other posts from Stack Overflow or by Jing
Published on 2011-01-17T10:18:53Z Indexed on 2011/01/17 11:53 UTC
Read the original article Hit count: 213

I am trying to implement post-processing (blur, bloom, etc.) on the iPhone using OpenGL ES 2.0. I am running into some issues. When rendering during my second rendering step, I end up drawing a completely black quad to the screen instead of the scene (it appears that the texture data is missing) so I am wondering if the cause is using a single FBO. Is it incorrect to use a single FBO in the following fashion?

For the first pass (regular scene rendering),

  • I attach a texture as COLOR_ATTACHMENT_0 and render to a texture. glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texturebuffer, 0)

For the second pass (post-processing),

  • I attach the color renderbuffer to COLOR_ATTACHMENT_0 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer)
  • Then use the texture from the first pass for rendering as a quad on the screen.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about opengl