Replace main.cpp with an application class
Fix GL state after an Application restart