Refactored renderer API, fixed some Ghoul2 crashes