I’m currently looking at implementing some of the additional blend modes in Praxis LIVE within the OpenGL pipeline - ones like DIFFERENCE which need to be implemented in a shader using multiple textures. I’m hoping to get some advice on the best way to achieve this.
All surfaces within the pipeline use texture-backed FBO’s, which are cached and reused - so doing this on a full image should be quite easy - render two surfaces on to a third. However, I’m not sure what to do in the case the user wants to render into a sub-region of a surface. Now I probably need to get a part of the destination surface into one of the source surfaces, and I’m not sure of the best approach -
- Bind first source texture FBO, draw destination region into it, bind destination FBO and blend textures.
- Bind destination FBO and first source texture, use glCopyTexSubImage to get destination region into source texture, then blend textures.
- Bind new destination FBO (like full-screen), draw areas of original destination around sub-region, then blend sub-region.
- AN other suggestion??
I’m inclined away from option 3 as it seems to involve a lot of unnecessary rendering. So, what’s likely to be the best performing way of getting the destination FBO into another texture - option 1 involving two FBO binds, or option 2 using glCopyTexSubImage? Or am I missing an obvious alternative?
Hope that makes sense, and thanks in advance, Neil