Updated rendering code to be object oriented

Note: have not tested on linux, only on windows
Made linux compatable
fix to compile