Helper class to create proper platform dependent renderer. The most universal usage as is to call Create()
method without arguments.
You can find more information in comments below.
class CRenderer
{
public:
static IRenderer *Create(
const RendererTechnology technology = RendererTechnology::OpenGL, // Technology to use'); ?>
#ifdef _WIN32
const Version2 &max_version = Version2{ 4, 5 }, // Maximum native graphics version to use
#endif
#if defined(__linux__) && !defined(__ANDROID__)
const Version2 &max_version = Version2{ 4, 5 }, // Maximum native graphics version to use
#endif
#ifdef __ANDROID__
const Version2 &max_version = Version2{ 3, 2 }, // Maximum native graphics version to use
#endif
const bool double_buffered = false, // Use single or double buffering
const int multisample_factor = 0, // Antialiasing factor
IErrorListener *listener = nullptr, // Error listener
const bool debug_context = false); // Whether try to create debug native graphics context
};
At the moment only RendererTechnology::OpenGL
technology is supported.
To create debug renderer, listener
should be specified. Native graphics debug context will be create only if listener
is specified, debug_context
is true and native graphics support it.
When multisample_factor
is greater than zero, the best one with the closes value to specified one will be created. For example, if you specify multisample_factor
as 16 but native graphics of the system where application runs support maximum 8, then renderer with factor 8 will be created.
Below you can find a list of supported and used by default version restrictions.
Platform | Default maximum version | Minimum supported version |
---|---|---|
Windows | 4.5 | OpenGL 3.1 |
Linux | 4.5 | OpenGL 3.1 |
Android | 3.2 | GLES 3.1 |
Namespace: | nitisa |
Include: | Package/Core/Renderer.h |