Fixes misplaced beginRenderScene() and endRenderScene() calls.