Concurrent Renderer

Using functional decomposition, rendering in my engine is performed in a dedicated rendering thread. Starting with a robust Renderer class my goal was to offload rendering to a separate thread with minimum modification to the engine. I came up with the idea of creating a simple abstract IRenderable interface. The interface provides three abstract functions to create, render and destroy rendering data that any pre-existing class would simply need to implement.

The Renderer thread, which owns the OpenGL context, then simply processes all opaque IRenderable objects eliminating the complexity of OpenGL context switches with minimal modifications to existing classes.

The provided source code below has been simplified and stripped down to better illustrate the aforementioned.

Source Code