protected virtual void SetupTexture2D(GraphicsInterface gi, int width, int height, TextureInternalFormat internalFormat, TexturePixelFormat pixelFormat, PixelComponentType pixelType, IntPtr pixelData, bool createMipMaps)
{
fWidth = width;
fHeight = height;
fInternalFormat = internalFormat;
fPixelFormat = pixelFormat;
fPixelType = pixelType;
// Setup the alignment
fGI.PixelStore(PixelStore.UnpackAlignment, 1);
// Allocate storage for the texture
// We do this once at the beginning to allocate space for the texture object
fGI.TexImage2D(0, internalFormat, fWidth, fHeight, 0, pixelFormat, pixelType, pixelData);
// Setup default filters and wrapping
SetupFiltering();
SetupWrapping();
if (createMipMaps)
{
// Make call to generate MipMap
//fGI.GenerateMipmap();
// Alter the min filter to use the mipmap
fGI.TexParameter(TextureParameterTarget.Texture2d, TextureParameterName.TextureMinFilter, TextureMinFilter.LinearMipmapLinear);
}
}