0

Platform is iPhone OpenGL ES 2.0

the framework already create an main fbo with renderbuffer as it's colorattachment.

And I have my own fbo with texture2D as colorattachment. I want to copy main fbo's content to my fbo. I tried common glCopyTexImage2D way, but it's too slow on my device(iPad1). So I wonder if a faster solution is out there.

If main fbo uses texture2D as colorattachment, I know just draw fullscreen quad using that texture to my fbo, but how to draw it's renderbuffer to my fbo? google quite a while but no specific answer.

ppaulojr
  • 3,579
  • 4
  • 29
  • 56
xophiix
  • 1
  • 1
  • 2

1 Answers1

1

RenderBuffers are almost useless on most embedded systems. All you can do with them is read from them with glReadPixels(), which is too slow.

You should use a Texture attachment, as you said, then render with that texture. This artcile will help:

http://processors.wiki.ti.com/index.php/Render_to_Texture_with_OpenGL_ES

ClayMontgomery
  • 2,786
  • 1
  • 15
  • 14
  • Since the iPad uses a Tile-Based Deferred Rendering GPU (PowerVR SGX ...), this is probably the best approach. Let it tile everything up for you and do the texture fetch in deferred tiles instead of a single memory copy operation. Reading from the framebuffer requires all deferred commands to be flushed first, whereas if you can defer this into a tile-friendly approach you will probably get better throughput. This is explained here: https://developer.apple.com/library/ios/documentation/OpenGLES/Conceptual/OpenGLESHardwarePlatformGuide_iOS/OpenGLESPlatforms/OpenGLESPlatforms.html – Andon M. Coleman Sep 17 '13 at 00:57
  • @ClayMontgomery the main renderbuffer is created by another framework(cocos2d-x's EGLView) which I shouldn't modify its process. I just wonder if there's a way like desktop opengl's glBlitFrameBuffer funciton – xophiix Sep 17 '13 at 16:08
  • @AndonM.Coleman as I said above I can't change the existing renderBuffer approach, but I'll check the article to get some idea, tks anyway – xophiix Sep 17 '13 at 16:10
  • There is absolutely no reason you cannot draw into the main framebuffer using a textured quad. – Andon M. Coleman Sep 17 '13 at 16:41