//used with HwndRenderTarget private void RenderSceneInBackground() { if (Parent == null || render == null) { return; } if (renderMode == RenderModes.HwndRenderTarget || renderMode == RenderModes.BitmapRenderTargetRealTime) { if (hwndRenderTarget == null || hwndRenderTarget.IsOccluded) { return; } CalculateFPS(); if (renderMode == RenderModes.HwndRenderTarget) { //render scene directly on the control RenderScene(hwndRenderTarget); } else if (renderMode == RenderModes.BitmapRenderTargetRealTime) { //draw bitmap cache of the shapes to control hwndRenderTarget.BeginDraw(); hwndRenderTarget.DrawBitmap(bitmapRenderTarget.Bitmap, 1.0f, BitmapInterpolationMode.NearestNeighbor, new RectF(0, 0, Width, Height)); hwndRenderTarget.EndDraw(); } } }