Problems with fade out.... NOT radiohead.

Problems building or running the engine, queries about how to use features etc.
User avatar
NoBrain2k
Gnoblar
Posts: 12
Joined: Tue Dec 21, 2004 3:31 am
Location: UK

Problems with fade out.... NOT radiohead.

Post by NoBrain2k »

Hey there!

I'm trying to implement a fade to white using the technique described here:

http://ogre.sourceforge.net/phpBB2/viewtopic.php?t=593

im trying to start simple by just setting my panel's vertex colour to red.. problem is - it stays white. Here's my code:


Code: Select all

	Overlay* o = (Overlay*)OverlayManager::getSingleton().getByName("Overlay/loadingScreenBk");
	o->show();
	GuiElement* loadingScreenBk = (GuiManager::getSingleton().getGuiElement("LoadingBk"));
	loadingScreenBk->setColour(ColourValue(1,0,0,1));
my material:

Code: Select all

material OverlayM/LoadingScreenBk
{
   technique
   {
      pass
      {
         scene_blend alpha_blend
         texture_unit
         {
         }
      }
   }
}
Aaaaand the overlay:

Code: Select all

Overlay/loadingScreenBk
{
	zorder 500
	// Stats block
	   container Panel(LoadingBk)
  	 {
      	left 0
      	top 0
      	width 1
      	height 1
      	material OverlayM/LoadingScreenBk
   }
	
}

its probably my poor OO or a misunderstanding of the Overlay, ermm, stuff.

If anyone has any suggestions, they would be much appreciated.

Many Thanks!
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Not all overlay elements use that colour to generate their geometry (they don't use vertex colour); TextAreaOverlayElement does, but others like PanelOverlayElement do not (they're just positions and texture coords). You can set the colour in the material though, like this:

Code: Select all

material OverlayM/LoadingScreenBk
{
   technique
   {
      pass
      {
         scene_blend alpha_blend
         texture_unit
         {
            colour_op_ex source1 src_manual src_current 1 0 0
         }
      }
   }
} 
User avatar
NoBrain2k
Gnoblar
Posts: 12
Joined: Tue Dec 21, 2004 3:31 am
Location: UK

Post by NoBrain2k »

Hi Sinbad, thanks for your reply!
I have since modified my code to use a TextArea overlay element and that just doesn't ever seem to be visible, no matter what i set the colour to!!

Any ideas?

Code: Select all

Overlay* o = (Overlay*)OverlayManager::getSingleton().getByName("Overlay/loadingScreenBk");
o->show();
static_cast<TextAreaGuiElement*>(GuiManager::getSingleton().getGuiElement("LoadingBk"))->setColour(ColourValue(1,1,1,1));

Code: Select all

Overlay/loadingScreenBk
{
	zorder 500
	   container TextArea(LoadingBk)
  	 {
	left 0
      	top 0
      	width 1
      	height 1
      	material OverlayM/LoadingScreenBk
   }
	
}
User avatar
leedgitar
OGRE Community Helper
OGRE Community Helper
Posts: 61
Joined: Wed Jan 22, 2003 1:58 am
Location: Baltimore, MD

Post by leedgitar »

Have you tried using Rectangle2D instead of an overlay element? It's the same full screen quad used for rendering the shadows; I've used it in the past for a fade in effect with a little manual blending.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

NoBrain2k wrote:Hi Sinbad, thanks for your reply!
I have since modified my code to use a TextArea overlay element and that just doesn't ever seem to be visible, no matter what i set the colour to!!
Well, since TextArea only displays text, it ain't gonna show anything unless you give it some text to render. It's not appropriate for a fullscreen effect.

The facilities are there in material like I showed you to change the material to give you the colour you need, you don't need to switch elements.
User avatar
NoBrain2k
Gnoblar
Posts: 12
Joined: Tue Dec 21, 2004 3:31 am
Location: UK

Post by NoBrain2k »

sinbad wrote: Well, since TextArea only displays text, it ain't gonna show anything unless you give it some text to render. It's not appropriate for a fullscreen effect.

The facilities are there in material like I showed you to change the material to give you the colour you need, you don't need to switch elements.
Well as i said changing it to red was only going to be a way of testing that I was doing things right before working on the fade effect so changing it in the material doesn't really get me any further.

I think i'll have a crack at leedgitar's suggestion since it sounds a little simpler than what I'm currently attempting.

Thanks, both of you, for your help so far :)