public void Dispose() { GL.DeleteFramebuffer(Id); DepthBuffer.Dispose(); BackBuffer.Dispose(); REngine.CheckGLError(); }
public void Prepare(int width, int height, int samples) { if (Width == width && Height == height && Samples == samples) { return; } Width = width; Height = height; Samples = samples; Framebuffer.Detach(FramebufferAttachmentPoint.Color0); Framebuffer.Detach(FramebufferAttachmentPoint.DepthStencil); ColorBuffer?.Dispose(); DepthBuffer?.Dispose(); ResolvedTex?.Dispose(); ColorBuffer = infra.GlContext.Create.Renderbuffer(width, height, Format.Srgb8Alpha8, samples); DepthBuffer = infra.GlContext.Create.Renderbuffer(width, height, Format.Depth24Stencil8, samples); ResolvedTex = infra.GlContext.Create.Texture2D(width, height, GraphicsHelper.TextureMipCount(width, height), Format.Srgb8Alpha8); Framebuffer.AttachRenderbuffer(FramebufferAttachmentPoint.Color0, ColorBuffer); Framebuffer.AttachRenderbuffer(FramebufferAttachmentPoint.DepthStencil, DepthBuffer); }
protected override void DestroyResources() { _textureBuffer.Dispose(); _depthBuffer.Dispose(); _renderTargetView.Dispose(); _isInitialized = false; }
public void Dispose() { resolveFramebuffer?.Dispose(); Framebuffer?.Dispose(); ColorBuffer?.Dispose(); DepthBuffer?.Dispose(); ResolvedTex?.Dispose(); }
private void DestroyBuffers() { ImmediateContext.OutputMerger.SetRenderTargets((RenderTargetView)null); BackBufferView.Dispose(); BackBuffer.Dispose(); DepthBufferView.Dispose(); DepthBuffer.Dispose(); }
public override void Dispose() { disposeChilderen(); if (depthBuffer != null) { depthBuffer.Dispose(); depthBuffer = null; } base.Dispose(); }
public void DestroyBuffers() { if (BackBuffer != null) { ImmediateContext.OutputMerger.SetRenderTargets((RenderTargetView)null); BackBufferView.Dispose(); BackBuffer.Dispose(); DepthBufferView.Dispose(); DepthBuffer.Dispose(); BackBuffer = null; } }
public void UnloadDirect3D() { if (!Ready) { return; } TextureCache.Dispose(); DefaultTextureView.Dispose(); DefaultTexture.Dispose(); SampleState.Dispose(); DefaultEffect.Dispose(); BackBufferView.Dispose(); BackBuffer.Dispose(); DepthBufferView.Dispose(); DepthBuffer.Dispose(); Device.Dispose(); }
/// <summary> /// Dispose contained fields. /// </summary> public void Dispose() { if (SwapTextureSet != null) { SwapTextureSet.Dispose(); SwapTextureSet = null; } if (Textures != null) { foreach (Texture2D texture in Textures) { texture.Dispose(); } Textures = null; } if (RenderTargetViews != null) { foreach (RenderTargetView renderTargetView in RenderTargetViews) { renderTargetView.Dispose(); } RenderTargetViews = null; } if (DepthBuffer != null) { DepthBuffer.Dispose(); DepthBuffer = null; } if (DepthStencilView != null) { DepthStencilView.Dispose(); DepthStencilView = null; } }
public void Dispose() { depthBuffer.Dispose(); framebuffer.Dispose(); texture.Dispose(); //Disposes deviceTexture as well }
public void CaptureMegaShot(string filename, int width, int height) { megaHeight = height; megaWidth = width; megaFrameDump = true; RenderTargetTexture megaTextureAA = new RenderTargetTexture(width, height); RenderTargetTexture megaTexture = new RenderTargetTexture(width, height, 1); DepthBuffer megaZbuffer = new DepthBuffer(width, height); while (true) { if (RenderContext11.MultiSampleCount > 1) { // When MSAA is enabled, we render each face to the same multisampled render target, // then resolve to a different texture for each face. This saves memory and works around // the fact that multisample textures are not permitted to have mipmaps. RenderFrame(megaTextureAA.renderView, megaZbuffer.DepthView, RenderTypes.Normal, width, height); RenderContext11.PrepDevice.ImmediateContext.ResolveSubresource(megaTextureAA.RenderTexture.Texture, 0, megaTexture.RenderTexture.Texture, 0, RenderContext11.DefaultColorFormat); } else { RenderFrame(megaTexture.renderView, megaZbuffer.DepthView, RenderTypes.Normal, width, height); } if (TileCache.QueuePercent == 100) { break; } Application.DoEvents(); } SharpDX.Direct3D11.Texture2D.ToFile(RenderContext11.devContext, megaTexture.RenderTexture.Texture, SharpDX.Direct3D11.ImageFileFormat.Png, filename); megaFrameDump = false; megaTexture.Dispose(); megaTextureAA.Dispose(); megaZbuffer.Dispose(); }