Ejemplo n.º 1
0
 private void DestroyFramebuffers()
 {
     if (framebuffer != null)
     {
         framebuffer.Dispose();
         framebuffer = null;
     }
 }
Ejemplo n.º 2
0
 public void Dispose()
 {
     resolveFramebuffer?.Dispose();
     Framebuffer?.Dispose();
     ColorBuffer?.Dispose();
     DepthBuffer?.Dispose();
     ResolvedTex?.Dispose();
 }
Ejemplo n.º 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && !this._disposedValue)
     {
         _fbo.Dispose();
         _coord_ssbo.Dispose();
         _compute_prog.Dispose();
         this._disposedValue = true;
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 4
0
 public void CleanupWindowSizeResources()
 {
     if (linear != null)
     {
         linear.Dispose();
         linear = null;
     }
     if (multisampleResolve != null)
     {
         multisampleResolve.Dispose();
         multisampleResolve = null;
     }
 }
Ejemplo n.º 5
0
        public void SetLightCount(int n)
        {
            if (n == currentLightCount)
            {
                return;
            }

            currentLightCount = n;

            // \todo if n < currentLightCount ?

            if (RenderStack.Graphics.Configuration.useGl1 == true)
            {
                return;
            }

            if (shadow != null)
            {
                shadow.Dispose();
            }
            shadow = FramebufferFactory.Create(Configuration.shadowResolution, Configuration.shadowResolution);

            if (example.Renderer.Configuration.hardwareShadowPCF)
            {
                shadowAttachment = FramebufferAttachment.DepthAttachment;
                var texture = shadow.AttachTextureArray(
                    FramebufferAttachment.DepthAttachment,
                    PixelFormat.DepthComponent,
                    PixelInternalFormat.DepthComponent,
                    n
                    );
            }
            else
            {
                shadowAttachment = FramebufferAttachment.ColorAttachment0;
                if (
                    (RenderStack.Graphics.Configuration.canUseTextureArrays) &&
                    (RenderStack.Graphics.Configuration.glslVersion >= 330)
                    )
                {
                    shadow.AttachTextureArray(
                        FramebufferAttachment.ColorAttachment0,
                        PixelFormat.Red,
                        //PixelInternalFormat.R16f,
                        PixelInternalFormat.R32f,
                        n
                        );
                }
                else
                {
                    shadow.AttachTexture(
                        FramebufferAttachment.ColorAttachment0,
                        PixelFormat.Red,
                        //PixelInternalFormat.R16f,
                        PixelInternalFormat.R32f
                        );
                }
                shadow.AttachRenderBuffer(
                    FramebufferAttachment.DepthAttachment,
                    //PixelFormat.DepthComponent,
                    RenderbufferStorage.DepthComponent32,
                    0
                    );
            }
            shadow.Begin();
            shadow.Check();
            shadow.End();

            var noShadow = materialManager.Textures["NoShadow"] = new TextureGL(
                1, 1, PixelFormat.Red, PixelInternalFormat.R16f, n
                );

            System.Single[] whiteData = new System.Single[n];
            for (int i = 0; i < n; ++i)
            {
                whiteData[i] = 1.0f;
            }
            noShadow.Upload(whiteData, 0);
        }