Thanks again, but I still have some problems getting this to work as intended.
I ended up defining my the external texture like this, including my final render target :
Code: Select all
Ogre::CompositorChannelVec externalChannels(2);
externalChannels[0].target = renderTarget;
externalChannels[1].textures.push_back(texture);
This is how I connect the external texture to the compositor node:
Code: Select all
workspaceDef->connectExternal(1, compositorNode->getName(), 0);
And this is how I use the texture inside the node :
Code: Select all
compoitorNodeDef->addTextureSourceName("texture_input", 0, Ogre::TextureDefinitionBase::TEXTURE_INPUT);
and later again in a quad pass :
Code: Select all
passQuad->addQuadTextureSource(0, "texture_input", 0);
When I try to run the application with this code it gives me the following error :
Exception thrown: read access violation.
**externalTarget** was nullptr.
I have tried to also include a target for the second element of the CompositorChannelVec, like this:
Code: Select all
Ogre::CompositorChannelVec externalChannels(2);
externalChannels[0].target = renderTarget;
externalChannels[1].textures.push_back(texture);
externalChannels[1].target = texture->getBuffer(0)->getRenderTarget(0);
but that just results in a black rectangle on the final render target where I want my texture to be.
Do you know what I'm doing wrong?