Our DDS codec was originally written to support the DX9 DDS format, which did not have texture arrays. We extended support for reading DX10 DDS format, but it just ignores the array slice flag.
On top of that, loading texture arrays from file in 2.1 is... complicated due to technical reasons, which is why Ogre 2.2 was started.
The best I can think of is to write a small tool to load these textures manually separately, merged them, and save it as an OITD format (our raw internal format). OITD in 2.1 cannot save mipmaps for texture arrays though due to these technical reasons I mentioned (it can on 2.2).
Also note that the OITD format from 2.1 is not compatible with 2.2's OITD.
Another solution: We added the notion of pools very recently. The following code can load independent files into the same array using the HlmsTextureManager path:
Code: Select all
//Load the first slice manually to know its parameters for reservePoolId
Ogre::Image image;
image.load( first_slice_filename, group );
//The important call so all the slices go to the same myPoolId, up to num_slices
hlmsTextureManager->reservePoolId(
myPoolId, Ogre::HlmsTextureManager::TEXTURE_TYPE_DIFFUSE,
image.getWidth(), image.getHeight(), num_slices,
image.getNumMipmaps(), image.getFormat(),
false, true );
//Create the texture now, from the Image in memory
hlmsTextureManager->createOrRetrieveTexture(
first_slice_filename, first_slice_filename,
Ogre::HlmsTextureManager::TEXTURE_TYPE_DIFFUSE, myPoolId, &image );
//Load the next slice directly from file
hlmsTextureManager->createOrRetrieveTexture(
second_slice_filename, second_slice_filename, Ogre::HlmsTextureManager::TEXTURE_TYPE_DIFFUSE, myPoolId );
reservePoolId was meant for explicitly controlling which textures go into which array (by manipulating myPoolId, which is an arbitrary number, must be non-zero). Watch out for Ogre.log warnings if something goes wrong (for example, if two textures do not have the same pixel format we cannot put them in the same array despite having the same myPoolId)