Renderers¶
Acron draws through a graphics pipe: a plug-in that speaks one graphics API (see The Graphics Pipe). Each platform has a default, and a game can ask for another one in its configuration.
Renderer |
Plug-in |
Where |
|---|---|---|
OpenGL |
|
Windows, macOS and Linux; the default there |
OpenGL ES 2 and 3 |
|
Android; the default there |
WebGL 2 |
built in |
the web; the only renderer of a web build (see The Web) |
Vulkan |
|
Python games on the desktop (on macOS through MoltenVK); chosen in the configuration |
GX |
built in |
the Wii; the only renderer of a Wii build (see Building for the Wii) |
Software |
|
Windows and Linux; a fallback that needs no graphics driver |
The web and the Wii builds are static programs with their renderer linked in, so there is nothing to choose there. On the desktop and Android, the plug-in is a library beside the engine, loaded when the first window opens.
Choosing a Renderer¶
The load-display variable names the plug-in tried first, and each
aux-display line a fallback, tried in order when the first cannot open a
window (no driver for it, for instance). Set them in the game’s
configuration, or in code before the window opens:
#include "acronFramework.h"
#include "load_prc_file.h"
int main(int argc, char *argv[]) {
load_prc_file_data("",
"load-display acrongl\n"
"aux-display p3tinydisplay\n");
AcronFramework framework;
framework.open_framework(argc, argv);
WindowFramework *window = framework.open_window();
if (window != nullptr) {
GraphicsStateGuardian *gsg = window->get_graphics_output()->get_gsg();
nout << gsg->get_driver_renderer() << "\n";
}
framework.main_loop();
return 0;
}
The plug-in has to be shipped with the game: a Python game names it in
build_apps’ plugins option ('p3vulkandisplay' beside
'acrongl'; see List of Build Options).
Vulkan¶
The Vulkan renderer is the engine’s newest, and follows the Vulkan renderer under development in the engine Acron is built on. It is not the default anywhere: OpenGL remains the most complete renderer and the one this manual’s examples are written against. Use Vulkan when you have a reason to, and test the game with it on each platform you ship.
It comes with the
acronwheel. The C++ desktop SDK is built without it, so a C++ game draws with OpenGL.Shaders, GLSL or Cg, are compiled to SPIR-V by the engine’s shader pipeline when they are loaded.
On macOS it runs on MoltenVK, Vulkan on top of Metal.
With both
acronglandp3vulkandisplayloaded on macOS, the log shows warnings that a Cocoa class is implemented twice: both plug-ins carry the same window code. The warnings are harmless.Its tuning variables (
vulkan-memory-page-size,vulkan-staging-buffer-size,vulkan-global-uniform-buffer-size) are rarely needed; see List of All Config Variables.
What each renderer supports is compared in Table of features supported per graphic renderer.