If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource
Track an old and new state for multi-Model Controllers.
Some Controller systems (for example, collision physics) need to track the state of several objects simultaneously and it must be ensured that they always read the same time step state for each Model instance.
If double buffering is not used, then as the physics system traverses the Models, it will become "confused" when it reads a state which has already been updated, thus using a new state instead of an old state.
This is analogous to a variable swap. int temp = a; a = b; b = temp; Without the temp varaible, a = b; b = a; would cause a==b always.
The necessary state information is typically isolated into a separate structure. For example: