public void restartRenderer() { displayTimer = new UpdateStatsTimer(); if (rtRenderer != null) { rtRenderer.JoinRenderThread(); rtRenderer.dispose(); rtRenderer = null; } try { rtRenderer = new RayTracer(frame, width, height, targetFPS, maxBounces, forceCPU); } catch (Exception e) { FPS.Content = e.ToString(); Trace.WriteLine(e.ToString()); } }