private void EndBillboards(RenderContext context) { if (!_billboardMode) { return; } _billboardMode = false; // Reset texture to prevent "memory leak". SetTexture(null); #if !WP7 if (EnableOffscreenRendering) { // ----- Combine off-screen buffer with scene. if (_upsampleFilter == null) { _upsampleFilter = GraphicsService.GetUpsampleFilter(); } var graphicsDevice = GraphicsService.GraphicsDevice; graphicsDevice.BlendState = BlendState.Opaque; // The previous scene render target is bound as texture. // --> Switch scene render targets! var sceneTexture = context.RenderTarget; var renderTargetPool = GraphicsService.RenderTargetPool; var renderTarget = renderTargetPool.Obtain2D(new RenderTargetFormat(sceneTexture)); context.SourceTexture = _offscreenBuffer; context.SceneTexture = sceneTexture; context.RenderTarget = renderTarget; _upsampleFilter.Mode = UpsamplingMode; _upsampleFilter.DepthThreshold = DepthThreshold; _upsampleFilter.RebuildZBuffer = true; _upsampleFilter.Process(context); context.SourceTexture = null; context.SceneTexture = null; renderTargetPool.Recycle(_offscreenBuffer); renderTargetPool.Recycle(sceneTexture); _depthBufferHalf = null; _offscreenBuffer = null; } #endif }