public void Shutdown()
        {
            // Release the camera object.
            Camera = null;

            // Release the glow shader object.
            GlowShader?.ShutDown();
            GlowShader = null;
            // Release the glow map shader object.
            GlowMapShader?.ShutDown();
            GlowMapShader = null;
            // Release the full screen ortho window object.
            FullScreenWindow?.Shutdown();
            FullScreenWindow = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the up sample render to texture object.
            UpSampleTexure?.Shutdown();
            UpSampleTexure = null;
            // Release the vertical blur render to texture object.
            VerticalBlurTexture?.Shutdown();
            VerticalBlurTexture = null;
            // Release the vertical blur shader object.
            VerticalBlurShader?.ShutDown();
            VerticalBlurShader = null;
            // Release the horizontal blur render to texture object.
            HorizontalBlurTexture?.Shutdown();
            HorizontalBlurTexture = null;
            // Release the horizontal blur shader object.
            HorizontalBlurShader?.ShutDown();
            HorizontalBlurShader = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the down sample render to texture object.
            DownSampleTexture?.Shutdown();
            DownSampleTexture = null;
            // Release the render to texture object.
            RenderTexture?.Shutdown();
            RenderTexture = null;
            // Release the model object.
            BitMap?.Shutdown();
            BitMap = null;
            // Release the texture shader object.
            TextureShader?.ShutDown();
            TextureShader = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }
        private bool RenderGlowMapToTexture()
        {
            // Set the render target to be the render to texture.
            RenderTexture.SetRenderTarget(D3D.DeviceContext);

            // Clear the render to texture.
            RenderTexture.ClearRenderTarget(D3D.DeviceContext, 0.0f, 0.0f, 0.0f, 1.0f);

            // Generate the view matrix based on the camera's position.
            Camera.Render();

            // Get the world, view, and projection matrices from the camera and d3d objects.
            Matrix worldMatrix = D3D.WorldMatrix;
            Matrix viewMatrix  = Camera.ViewMatrix;
            Matrix orthoMatrix = D3D.OrthoMatrix;

            // Turn off the Z buffer to begin all 2D rendering.
            D3D.TurnZBufferOff();

            // Put the bitmap vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!BitMap.Render(D3D.DeviceContext, 100, 100))
            {
                return(false);
            }

            // Render the bitmap using the glow map shader.
            if (!GlowMapShader.Render(D3D.DeviceContext, BitMap.IndexCount, worldMatrix, viewMatrix, orthoMatrix, BitMap.Texture.TextureResource, BitMap.GlowMapTexture.TextureResource))
            {
                return(false);
            }

            // Turn the Z buffer back on now that all 2D rendering has completed.
            D3D.TurnZBufferOn();

            // Reset the render target back to the original back buffer and not the render to texture anymore.
            D3D.SetBackBufferRenderTarget();

            // Reset the viewport back to the original.
            D3D.ResetViewPort();

            return(true);
        }