Bind Texture buffer to another texture

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Bind Texture buffer to another texture

Post by white_waluigi »

I'm currently still in the process of fixeing pointlight shadows.
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);
Post Reply