public static GLTextureCubeArray FromDDS(DDS dds) { int size = (int)dds.Width; GLTextureCubeArray texture = new GLTextureCubeArray(); texture.Width = size; texture.Height = size; texture.Bind(); var format = dds.Platform.OutputFormat; var surfaces = dds.GetSurfaces(); List <byte[]> cubemapSurfaces = new List <byte[]>(); for (int a = 0; a < surfaces.Count; a++) { cubemapSurfaces.Add(surfaces[a].mipmaps[0]); } int depth = surfaces.Count; Console.WriteLine($"depth {depth}"); byte[] buffer = ByteUtils.CombineArray(cubemapSurfaces.ToArray()); for (int j = 0; j < dds.MipCount; j++) { int mipWidth = CalculateMipDimension(texture.Width, j); int mipHeight = CalculateMipDimension(texture.Height, j); if (dds.IsBCNCompressed()) { var internalFormat = GLFormatHelper.ConvertCompressedFormat(format, true); GLTextureDataLoader.LoadCompressedImage(texture.Target, mipWidth, mipHeight, depth, internalFormat, buffer, j); } else { var formatInfo = GLFormatHelper.ConvertPixelFormat(format); if (dds.Platform.OutputFormat == TexFormat.RGBA8_UNORM) { formatInfo.Format = PixelFormat.Rgba; } GLTextureDataLoader.LoadImage(texture.Target, mipWidth, mipHeight, depth, formatInfo, buffer, j); } } GL.TexParameter(texture.Target, TextureParameterName.TextureBaseLevel, 0); GL.TexParameter(texture.Target, TextureParameterName.TextureMaxLevel, 13); GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMapArray); texture.Unbind(); return(texture); }