So far I'm trying to use the Shadow textures of 6 invisible spotlights to generate the cubic texture.
(Don't worry, I will solve this in a better way later on.)
So how can I bind the hardware pixel buffer of one texutre to another?
This is what i tried and failed:
Code: Select all
TextureUnitState* tus = pass->getTextureUnitState("ShadowMap");
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().createManual("dontcrash",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_CUBE_MAP, 2048, 2048, 0, Ogre::PF_FLOAT16_RGBA, Ogre::TU_DYNAMIC);
Ogre::TexturePtr * ptrs=new Ogre::TexturePtr[6];
for(int i=0;i<6;i++){
//This part doesn't work; it does nothing:
tex.get()->getBuffer(i)=sm->getShadowTexture((i+1)%6).get()->getBuffer(0);
}
ptrs[0]=tex;
tus->setCubicTexture(ptrs,true);