refactored core rendering code into GLRenderer