public static GLTextureCube FromDDS(DDS dds, bool flipY = false, bool isBGRA = false)
        {
            int size = (int)dds.Width;

            GLTextureCube texture = new GLTextureCube();

            texture.Width = size; texture.Height = size;
            texture.Bind();

            InternalFormat format = InternalFormat.CompressedRgbaS3tcDxt5Ext;

            if (dds.Platform.OutputFormat == TexFormat.BC6H_UF16)
            {
                format = InternalFormat.CompressedRgbBptcUnsignedFloat;
            }
            if (dds.Platform.OutputFormat == TexFormat.BC6H_SF16)
            {
                format = InternalFormat.CompressedRgbBptcSignedFloat;
            }
            if (dds.Platform.OutputFormat == TexFormat.RGBA8_UNORM)
            {
                format = InternalFormat.Rgba8;
            }

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < dds.MipCount; j++)
                {
                    int mipWidth  = CalculateMipDimension(texture.Width, j);
                    int mipHeight = CalculateMipDimension(texture.Height, j);
                    int imageSize = GLFormatHelper.CalculateImageSize(mipWidth, mipHeight, format);
                    var surface   = dds.GetDeswizzledSurface(i, j);

                    if (dds.Parameters.UseSoftwareDecoder || flipY)
                    {
                        surface = dds.GetDecodedSurface(i, j);
                        format  = InternalFormat.Rgba8;
                    }

                    if (flipY)
                    {
                        surface = FlipVertical(mipWidth, mipHeight, surface);
                    }

                    if (format == InternalFormat.Rgba8)
                    {
                        GL.TexImage2D(TextureTarget.TextureCubeMapPositiveX + i, j,
                                      PixelInternalFormat.Rgba,
                                      mipWidth, mipHeight, 0, PixelFormat.Rgba, PixelType.UnsignedByte,
                                      surface);
                    }
                    else
                    {
                        GL.CompressedTexImage2D(TextureTarget.TextureCubeMapPositiveX + i, j,
                                                format,
                                                mipWidth, mipHeight,
                                                0, imageSize, surface);
                    }
                }
            }

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