fix crash when calling primitive drawing functions without creating a window (bug...