protected void CreateSurfaceList()
{
_surfaceList.Clear();
// For all faces and mipmaps, store surfaces as HardwarePixelBufferSharedPtr
bool wantGenerateMips = ( Usage & TextureUsage.AutoMipMap ) == TextureUsage.AutoMipMap;
// Do mipmapping in software? (uses GLU) For some cards, this is still needed. Of course,
// only when mipmap generation is desired.
bool doSoftware = wantGenerateMips && !MipmapsHardwareGenerated && MipmapCount > 0;
for ( int face = 0; face < faceCount; face++ )
{
int width = Width;
int height = Height;
for ( int mip = 0; mip <= MipmapCount; mip++ )
{
HardwarePixelBuffer buf = new GLESTextureBuffer( Name, GLESTextureTarget, _textureID, width, height, (int)GLESPixelUtil.GetClosestGLInternalFormat( Format, HardwareGammaEnabled ),
face, mip, (BufferUsage)Usage, doSoftware && mip == 0, HardwareGammaEnabled, FSAA );
_surfaceList.Add( buf );
// If format is PVRTC then every mipmap is a custom one so to allow the upload of the compressed data
// provided by the file we need to adjust the current mip level's dimention
#warning Compressed Textures are not yet supported by axiom
/*
if (mFormat == PF_PVRTC_RGB2 || mFormat == PF_PVRTC_RGBA2 ||
mFormat == PF_PVRTC_RGB4 || mFormat == PF_PVRTC_RGBA4)
{
if (width > 1)
{
width = width / 2;
}
if (height > 1)
{
height = height / 2;
}
}*/
/// Check for error
if ( buf.Width == 0 ||
buf.Height == 0 ||
buf.Depth == 0 )
{
throw new AxiomException( string.Format( "Zero sized texture surface on texture: {0} face: {1} mipmap : {2}. The GL driver probably refused to create the texture.", Name, face, mip ) );
}
}
}
}