public static GLTexture2D CreateWhiteTexture(int width, int height)
        {
            GLTexture2D texture = new GLTexture2D();

            texture.PixelInternalFormat = PixelInternalFormat.Rgba8;
            texture.PixelFormat         = PixelFormat.Rgba;
            texture.PixelType           = PixelType.UnsignedByte;
            texture.Width  = width; texture.Height = height;
            texture.Target = TextureTarget.Texture2D;
            texture.Bind();

            byte[] buffer = new byte[width * height * 4];
            for (int i = 0; i < width * height * 4; i++)
            {
                buffer[i] = 255;
            }

            GL.TexImage2D(TextureTarget.Texture2D, 0, texture.PixelInternalFormat,
                          texture.Width, texture.Height,
                          0, texture.PixelFormat, texture.PixelType, buffer);

            texture.UpdateParameters();
            texture.Unbind();
            return(texture);
        }
        private GLTexture2D CreateColorAttachment(int width, int height, int numSamples)
        {
            GLTexture2D texture = GLTexture2DMultiSampled.CreateUncompressedTexture(width, height,
                                                                                    PixelInternalFormat, PixelFormat.Rgba, PixelType.Float);

            // Don't use mipmaps for color attachments.
            texture.MinFilter = TextureMinFilter.Linear;
            texture.MagFilter = TextureMagFilter.Linear;
            texture.UpdateParameters();
            return(texture);
        }
        public static GLTexture2D CreateFloat32Texture(int width, int height, float[] buffer)
        {
            GLTexture2D texture = new GLTexture2D();

            texture.PixelInternalFormat = PixelInternalFormat.R32f;
            texture.PixelFormat         = PixelFormat.Red;
            texture.PixelType           = PixelType.Float;
            texture.Width  = width; texture.Height = height;
            texture.Target = TextureTarget.Texture2D;
            texture.Bind();

            GL.TexImage2D(TextureTarget.Texture2D, 0, texture.PixelInternalFormat,
                          texture.Width, texture.Height,
                          0, texture.PixelFormat, texture.PixelType, buffer);

            texture.UpdateParameters();
            texture.Unbind();
            return(texture);
        }
        public static GLTexture2D CreateUncompressedTexture(int width, int height,
                                                            PixelInternalFormat format = PixelInternalFormat.Rgba8,
                                                            PixelFormat pixelFormat    = PixelFormat.Rgba,
                                                            PixelType pixelType        = PixelType.UnsignedByte)
        {
            GLTexture2D texture = new GLTexture2D();

            texture.PixelInternalFormat = format;
            texture.PixelFormat         = pixelFormat;
            texture.PixelType           = pixelType;
            texture.Width  = width; texture.Height = height;
            texture.Target = TextureTarget.Texture2D;
            texture.Bind();

            GL.TexImage2D(TextureTarget.Texture2D, 0, format,
                          texture.Width, texture.Height,
                          0, pixelFormat, pixelType, IntPtr.Zero);

            texture.UpdateParameters();
            texture.Unbind();
            return(texture);
        }