For example, the RenderInstance is not in charge of dispatching draw calls, that is done by a CommandQueue. RenderInstance is subclassed into RenderInstanceOpenGL, but the application only uses the base interface from RenderInstance.ĭown the line, there’s a decent chance that we will want to add a vulkan renderer, so there is some inspiration taken from that API here.
The system I went for is pretty simple, you have a RenderInstance class that is in charge of creating the GL context, as well as resources like buffers and textures. The first step was to abstract the rendering code into something cleaner, which also lets us swap out opengl down the line as well. Prior to this refactoring, freeablo’s rendering was a nasty sprawl of ad-hoc opengl and SDL related code in a huge file called sdl2backend.cpp. If you're a programmer, click here for more details about freeablo's rendering code Next steps for graphics are scaling the GUI, and there are still a lot more possible optimisations on the table, but for now I will probably move on to more gameplay-related changes (specifically ranged combat).