my aim is to draw a static Rectangle with (video) image content in the back ground of my scene.
Besides the videoloading, I'm stuck at the point drawing a simple Rectangle like background in setSky method of SceneManager.
I got through the code in Scenemanager, but hardly understand according sky.material and shader code. I'm having a hard time understanding the new HLMS system as a concept. I read the doc of https://ogrecave.github.io/ogre-next/api/2.2/hlms.html .
So what's my first aim is to draw a simple white rectangle. So exchanged in some Sample like V2Mesh the code in createScene01() with:
Code: Select all
mRectangle2D = sceneManager->createRectangle2D();
mRectangle2D->setGeometry(
Ogre::Vector2(-1.0f, -1.0f),
Ogre::Vector2(2.0f, 2.0f)
);
mRectangle2D->initialize( Ogre::BT_DEFAULT,
Ogre::Rectangle2D::GeometryFlagQuad | Ogre::Rectangle2D::GeometryFlagNormals );
mRectangle2D->setGeometry( -Ogre::Vector2::UNIT_SCALE, Ogre::Vector2( 2.0f ) );
mRectangle2D->setRenderQueueGroup( 212u ); // Render after most stuff
sceneManager->getRootSceneNode(Ogre::SCENE_STATIC)->attachObject( mRectangle2D );
mRectangle2D->setMaterialName("RedMaterial", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
Or I put this texture_map.material file to the other material files so it gets loaded.
Code: Select all
material Template/texture_map
{
technique
{
pass
{
texture_unit
{
texture image.png
}
}
}
}
Code: Select all
mRectangle2D->setMaterialName("RedMaterial", Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
Code: Select all
OGRE EXCEPTION(3:RenderingAPIException): Fixed Function pipeline is no longer allowed nor supported. The material BaseWhite must use shaders in HlmsLowLevel::calculateHashFor at
Passing this to a manual Object with setDatablock works. Here it doesn't.
Thanks for your help!
Peter