Part of the Virtual Gaming Table there was the need to be able to communicate across threads between the Python and OpenGL. To solve this problem a command property was created that allows for passing commands between threads via a locked command buffer. The command objects are maintained in a collection and recycled when the command is completed.
The CommandObject (GitHub) represents a command to be transmitted between the python and openGL threads. It is able to store up to six arguments in Boost::Any variables, and a destination BaseCommandObject. This allows the commands to affect individual.
The RO_Base and RO_Image are examples of the openGL image render object. A set of macros define a command property that has two copies of the variable. Using templates the macros define the property class with a python and openGL value. The DEF_PROP, INIT_PROP, and CMDPROP macros are used to define, initialize, and expose to Python the property. This allows the command property to be exposed to the python interpreter and changes be transmitted at the start of the render frame applying changes to the openGL.
Command properties supporting Vectors, Bit Vectors, Maps, and basic data types are all supported.
During the development the Virtual Gaming Table the command buffers and properties proved to be versatile and efficient for the multi threading render and interface to the web server.