Is it faster to bind 2 textures to one or two FBO?
I want to to run several shaders one after the o开发者_如何学Pythonther (mostly image processing), the output of one being the input of the following. I wonder if there's a performance gain to use only one FBO bound to all the needed textures, or if it's the same to create one FBO for each texture?
In case it matters, the aimed platform is the iPhone, therefore with OpenGL ES 2.0.
Thanks
I am not familiar with OpenGL ES, but on PC platform it is normally better to use only one FBO, and i don't see why this should be different on ES (however, I might be wrong). It is important though that all textures bound have the same size (e.g. viewport size) for FBO completeness, otherwise it won't work. Normally, you attach all textures to one FBO initially and then in each frame just change the rendertarget channel in each pass. This saves you a lot of state changes caused by fbo binding. Note that the maximum number of textures that can be bound is limited by GL_MAX_COLOR_ATTACHMENTS_EXT. You might also find this helpful: http://www.songho.ca/opengl/gl_fbo.html
Cheers, Reinhold
精彩评论