예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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));
 }