/// <summary> /// Initializes a compressed cube map with mipmaps. /// Each face should have the same dimensions, image format, and number of mipmaps. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="faceSideLength">The side length in pixels of each face.</param> /// <param name="internalFormat"></param> /// <param name="mipsPosX">Mipmaps for the positive x target</param> /// <param name="mipsNegX">Mipmaps for the negative x target</param> /// <param name="mipsPosY">Mipmaps for the positive y target</param> /// <param name="mipsNegY">Mipmaps for the negative y target</param> /// <param name="mipsPosZ">Mipmaps for the positive z target</param> /// <param name="mipsNegZ">Mipmaps for the negative z target</param> /// <exception cref="ArgumentException"><paramref name="internalFormat"/> is not a compressed format.</exception> /// <exception cref="ArgumentOutOfRangeException">The mipmap counts are not equal for all faces.</exception> public void LoadImageData <T>(int faceSideLength, InternalFormat internalFormat, List <T[]> mipsPosX, List <T[]> mipsNegX, List <T[]> mipsPosY, List <T[]> mipsNegY, List <T[]> mipsPosZ, List <T[]> mipsNegZ) where T : struct { Width = faceSideLength; Height = faceSideLength; if (!TextureFormatTools.IsCompressed(internalFormat)) { throw new ArgumentException(TextureExceptionMessages.expectedCompressed); } bool equalMipCounts = CheckMipMapCountEquality(mipsPosX, mipsNegX, mipsPosY, mipsNegY, mipsPosZ, mipsNegZ); if (!equalMipCounts) { throw new ArgumentOutOfRangeException(TextureExceptionMessages.cubeFaceMipCountDifferent); } // Necessary to access mipmaps past the base level. MinFilter = TextureMinFilter.LinearMipmapLinear; Bind(); MipmapLoading.LoadFacesMipmaps(faceSideLength, internalFormat, mipsPosX, mipsNegX, mipsPosY, mipsNegY, mipsPosZ, mipsNegZ); }
/// <summary> /// Loads RGBA texture data with mipmaps generated from the specified bitmap. /// Binds the texture. /// </summary> /// <param name="image">the image data for the base mip level</param> public void LoadImageData(Bitmap image) { Width = image.Width; Height = image.Height; Bind(); MipmapLoading.LoadBaseLevelGenerateMipmaps(TextureTarget, image); }
/// <summary> /// /// </summary> /// <param name="width">The width of the base mip level in pixels</param> /// <param name="height">The height of the base mip level in pixels</param> /// <param name="mipmaps">The image data for each mip level</param> /// <param name="format">The image format of <paramref name="mipmaps"/></param> public void LoadImageData(int width, int height, IList <BufferObject> mipmaps, TextureFormatUncompressed format) { Width = width; Height = height; MipmapLoading.LoadUncompressedMipmaps(TextureTarget.Texture2D, width, height, mipmaps, format); }
/// <summary> /// Loads a mip level of uncompressed texture data /// for each array in <paramref name="mipmaps"/>. /// </summary> /// <typeparam name="T">The data type of the image data</typeparam> /// <param name="width">The width of the base mip level in pixels</param> /// <param name="height">The height of the base mip level in pixels</param> /// <param name="mipmaps">The image data for each mip level</param> /// <param name="format">The image format of <paramref name="mipmaps"/></param> public void LoadImageData <T>(int width, int height, IList <T[]> mipmaps, TextureFormatUncompressed format) where T : struct { Width = width; Height = height; MipmapLoading.LoadUncompressedMipmaps(TextureTarget.Texture2D, width, height, mipmaps, format); }
/// <summary> /// Loads texture data of the specified format for the first mip level. /// Mipmaps are generated by OpenGL. /// </summary> /// <param name="width">The width of the base mip level in pixels</param> /// <param name="height">The height of the base mip level in pixels</param> /// <param name="baseMipLevel">The image data of the first mip level</param> /// <param name="format">The image format for all mipmaps</param> public void LoadImageData(int width, int height, BufferObject baseMipLevel, TextureFormatUncompressed format) { Width = width; Height = height; Bind(); MipmapLoading.LoadBaseLevelGenerateMipmaps(TextureTarget, width, height, baseMipLevel, format); }
/// <summary> /// Loads texture data of the specified format for the first mip level. /// Mipmaps are generated by OpenGL. /// </summary> /// <typeparam name="T">The data type of the image data</typeparam> /// <param name="width">The width of <paramref name="baseMipLevel"/> in pixels</param> /// <param name="height">The height of <paramref name="baseMipLevel"/> in pixels</param> /// <param name="baseMipLevel">The image data of the first mip level</param> /// <param name="format">The image format for all mipmaps</param> public void LoadImageData <T>(int width, int height, T[] baseMipLevel, TextureFormatUncompressed format) where T : struct { Width = width; Height = height; Bind(); MipmapLoading.LoadBaseLevelGenerateMipmaps(TextureTarget, width, height, baseMipLevel, format); }
/// <summary> /// Initializes an uncompressed cube map without mipmaps. /// Each face should have the same dimensions and image format. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="faceSideLength">The side length in pixels of each face.</param> /// <param name="format"></param> /// <param name="facePosX">The base mip level for the positive x target</param> /// <param name="faceNegX">The base mip level for the negative x target</param> /// <param name="facePosY">The base mip level for the positive y target</param> /// <param name="faceNegY">The base mip level for the negative y target</param> /// <param name="facePosZ">The base mip level for the positive z target</param> /// <param name="faceNegZ">The base mip level for the negative z target</param> public void LoadImageData <T>(int faceSideLength, TextureFormatUncompressed format, T[] facePosX, T[] faceNegX, T[] facePosY, T[] faceNegY, T[] facePosZ, T[] faceNegZ) where T : struct { Width = faceSideLength; Height = faceSideLength; // Don't use mipmaps. MagFilter = TextureMagFilter.Linear; MinFilter = TextureMinFilter.Linear; MipmapLoading.LoadFacesBaseLevel(faceSideLength, format, facePosX, faceNegX, facePosY, faceNegY, facePosZ, faceNegZ); }
/// <summary> /// /// </summary> /// <param name="width">The width of the base mip level in pixels</param> /// <param name="height">The height of the base mip level in pixels</param> /// <param name="mipmaps">The image data for each mip level</param> /// <param name="internalFormat">The image format of <paramref name="mipmaps"/></param> public void LoadImageData(int width, int height, IList <BufferObject> mipmaps, InternalFormat internalFormat) { if (!TextureFormatTools.IsCompressed(internalFormat)) { throw new ArgumentException(TextureExceptionMessages.expectedCompressed); } if (TextureFormatTools.IsGenericCompressed(internalFormat)) { throw new NotSupportedException(TextureExceptionMessages.genericCompressedFormat); } Width = width; Height = height; MipmapLoading.LoadCompressedMipmaps(TextureTarget.Texture2D, width, height, mipmaps, internalFormat); }
/// <summary> /// Loads texture data of the specified format for the first mip level. /// Mipmaps are generated by OpenGL. /// </summary> /// <param name="width">The width of <paramref name="baseMipLevel"/> in pixels</param> /// <param name="height">The height of <paramref name="baseMipLevel"/> in pixels</param> /// <param name="baseMipLevel">The image data of the first mip level</param> /// <param name="internalFormat">The image format for all mipmaps</param> public void LoadImageData(int width, int height, BufferObject baseMipLevel, InternalFormat internalFormat) { if (!TextureFormatTools.IsCompressed(internalFormat)) { throw new ArgumentException(TextureExceptionMessages.expectedCompressed); } if (TextureFormatTools.IsGenericCompressed(internalFormat)) { throw new NotSupportedException(TextureExceptionMessages.genericCompressedFormat); } Width = width; Height = height; Bind(); MipmapLoading.LoadBaseLevelGenerateMipmaps(TextureTarget, width, height, baseMipLevel, internalFormat); }
public void LoadImageDataCubeBitmap() { // Doesn't throw exception. // Width and height must be equal for cube maps. MipmapLoading.LoadBaseLevelGenerateMipmaps(TextureTarget.TextureCubeMapPositiveX, new Bitmap(128, 128)); }
public void LoadImageData2DBitmap() { // Doesn't throw exception. MipmapLoading.LoadBaseLevelGenerateMipmaps(TextureTarget.Texture2D, new Bitmap(128, 64)); }