Helper function to create and register in renderer custom framebuffers.
To function properly FramebufferClass should have method declared as static FramebufferClass *Create(IReleasableListener*, NativeGraphicsClass*, IRenderer*)
and this function should be made a friend of FramebufferClass.
The first argument should be set in FramebufferClass constructor as release listener. It is recommended that FramebufferClass be derived from IReleasable/CReleasable for this purpose.
The second argument will be the native graphics class used by renderer and thus should be named by NativeGraphicsClass.
If FramebufferClass::Create() fails it should return nullptr.
CreateFramebuffer() function return nullptr if "renderer" argument is missing, or renderer's native graphics isn't an instance of NativeGraphicsClass, or FramebufferClass::Create() returns nullptr.
In case of using with custom renderers the function should be made a friend of that renderer in order to have access to its protected methods.
template<class FramebufferClass, class RendererClass, class NativeGraphicsClass>
IFramebuffer *CreateFramebuffer(RendererClass *renderer);
Namespace: | nitisa |
Include: | Nitisa/Interfaces/IRenderer.h |