made SDl/GL code more modular