public override string ToString() { return(String.Format("Texture2D #{0} ({1}x{2}, {3})", (this as IGraphicsResource).Id.ToString(), Width.ToString(), Height.ToString(), InternalFormat.ToString())); }
private static int GetPitchOrLinearSize(InternalFormat format, int width) { if (format.ToString().Contains("Compressed")) { return(Math.Max(1, ((width + 3) / 4)) * (int)TextureFormatInfo.GetBPP(format)); } return((width * (int)TextureFormatInfo.GetBPP(format) + 7) / 8); }
public override string ToString() { if (HasGliFormat) { return(GliFormat.ToString()); } if (IsCompressed) { return(InternalFormat.ToString().ToUpper()); } return(ExternalFormat.ToString().ToUpper() + "_" + Type.ToString().ToUpper()); }
public static int CalculateImageSize(int width, int height, InternalFormat format) { if (format == InternalFormat.Rgba8) { return(width * height * 4); } int blockSize = blockSizeByFormat[format.ToString()]; int imageSize = blockSize * (int)Math.Ceiling(width / 4.0) * (int)Math.Ceiling(height / 4.0); return(imageSize); }
/// <summary> /// Determines whether a format is compressed. /// Compressed formats should use GL.CompressedTexImage instead of GL.TexImage. /// </summary> /// <param name="format">The image format for the texture data</param> /// <returns>True if the format is compressed</returns> public static bool IsCompressed(InternalFormat format) { // All the enum value names should follow this convention. return(format.ToString().ToLower().Contains("compressed")); }
private static int CalculateBlockSize(InternalFormat format) { return(CompressedBlockSize.blockSizeByFormat[format.ToString()]); }
public override string ToString() { return(string.Format("[{0},{1},{2}]", InternalFormat.ToString(), Format.ToString(), Type.ToString())); }