Helper function to create and register in renderer custom shader programs.
To function properly ProgramClass should have method declared as static ProgramClass *Create(IReleasableListener*, NativeGraphicsClass*, IRenderer*)
and this function should be made a friend of ProgramClass.
The first argument should be set in ProgramClass constructor as release listener. It is recommended that ProgramClass 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 ProgramClass::Create() fails it should return nullptr.
CreateProgram() function return nullptr if "renderer" argument is missing, or renderer's native graphics isn't an instance of NativeGraphicsClass, or ProgramClass::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 ProgramClass, class RendererClass, class NativeGraphicsClass>
IProgram *CreateProgram(RendererClass *renderer);
Namespace: | nitisa |
Include: | Nitisa/Interfaces/IRenderer.h |