/// <summary> /// Sets current render texture. /// call only from render thread /// </summary> /// <param name="renderTexture">render texture or null, then it resets to back buffer</param> public void SetRenderTexture(RenderTexture renderTexture, int destFramebuffer) { if (renderTexture == null) { device.BindFramebuffer(FramebufferTarget.Framebuffer, destFramebuffer); } else { renderTexture.ActivateFrameBuffer(); } //RenderTargetView view = renderTexture == null ? renderTargetView : renderTexture.TargetView; //device.ImmediateContext.OutputMerger.SetTargets(depthStencilView, view); }