Hi,
I also tried to render a background image on screen (later for scrolling effects etc.), but without success. I do as you described.
I created a quad pass, similiar like in the postprocessing examples:
Code: Select all
if (!compositorManager->hasNodeDefinition("Background"))
{
Ogre::CompositorNodeDef* backgroundDef = compositorManager->addNodeDefinition("Background");
//Input channels
backgroundDef->addTextureSourceName("rt_input", 0, Ogre::TextureDefinitionBase::TEXTURE_INPUT);
backgroundDef->addTextureSourceName("rt_output", 1, Ogre::TextureDefinitionBase::TEXTURE_INPUT);
backgroundDef->mCustomIdentifier = "Ogre/Postprocess";
//Local textures
backgroundDef->setNumLocalTextureDefinitions(1);
{
Ogre::TextureDefinitionBase::TextureDefinition *texDef = backgroundDef->addTextureDefinition("rt0");
texDef->widthFactor = 0.25f;
texDef->heightFactor = 0.25f;
texDef->formatList.push_back(Ogre::PF_R8G8B8);
}
backgroundDef->setNumTargetPass(1);
{
Ogre::CompositorTargetDef *targetDef = backgroundDef->addTargetPass("rt0");
{
Ogre::CompositorPassQuadDef *passQuad;
passQuad = static_cast<Ogre::CompositorPassQuadDef*>(targetDef->addPass(Ogre::PASS_QUAD));
passQuad->mMaterialName = "NOWABackgroundPostprocess";
passQuad->addQuadTextureSource(0, "rt_input", 0);
}
}
//Output channels
backgroundDef->setNumOutputChannels(2);
backgroundDef->mapOutputChannel(0, "rt_output");
backgroundDef->mapOutputChannel(1, "rt_input");
}
Then, like in the post processing examples, I connect the "background" node.
The material is as follow:
Code: Select all
material NOWABackgroundPostprocess
{
technique
{
pass
{
depth_check off
depth_write off
cull_hardware none
texture_unit
{
texture Far_Far_Mountain.png
filtering trilinear
tex_address_mode clamp
}
}
}
}
The texture can be found and there is no Error in the Ogre log.
As soon as I activate the compositor, everything will be just
black. When I activate e.g. dither compositor effect, that will work.
Has anybody an idea, how to get that working?
Regards
Lax