-
-
Notifications
You must be signed in to change notification settings - Fork 29
Renderer
The Renderer class is basically a wrapper over a rendering API (OpenGL, Vulkan, ...).
This class is meant to be as independent as possible, to be eventually used in another project (yours as well, if you want so). This means that every usage of RaZ objects in it are discouraged. This is not an issue right now, but it might change in the future for practical reasons.
The Renderer should be the sole entry point to every direct call to the API. If any feature is missing, consider submitting a pull request or opening an issue.
Note however that when possible, functions from RaZ objects should always be preferred (like ShaderProgram::sendUniform()
, Shader::compile()
, etc). Those functions may do additional checks and force objects to be used like they should.
Each call to the Renderer's functions may produce errors. One can retrieve the error codes produced by calling Raz::Renderer::recoverErrors()
, which returns a bitset containing one bit for each error code. If you need to check if any error has occurred, simply call Raz::Renderer::hasErrors()
.
The errors can also be printed (one line per error code) by calling Raz::Renderer::printErrors()
. Basic respective error messages are written to the standard output.
Important note: errors are not automatically flushed before each rendering function. This means that any check may return one that appeared in a previous call. To be absolutely sure that a specific call has no errors, you should write the following:
Raz::Renderer::recoverErrors(); // Flushing errors, discarding the result
Raz::Renderer::XXX(...); // Actual function call
bool res = Raz::Renderer::hasErrors(); // Returns true if the above function produced an error
Note also that hasErrors()
, recoverErrors()
& printErrors()
flush all errors. Always call a single one of those.
Error printing is automatically enabled in Debug mode for each Renderer function. To remove it entirely, the definition SKIP_RENDERER_ERRORS
must be added.
- Home
- How to build RaZ
- Getting started
- General usage knowledge
- Some examples...
- Playground
- Tutorials
- File formats
- Modules
- Debug