Refactored graphics code to be reusable between systems with the new
batching system.