Screen fade out...

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Darkness
Greenskin
Posts: 121
Joined: Sat Mar 19, 2005 3:32 am
Location: Austin, Texas

Screen fade out...

Post by Darkness »

Sorry for the many questions, but I'm an old school 2D programmer who is now trying to learn how to do 3D things. Which is the main purpose of working on my little project.

What I need to know is how do I fade a scene in and out and what's the best way to release everything in the scene? Up until now I"ve just been displaying the entities and then turning them off when done. But this is pretty crazy, because nothing ever gets destroyed so all of these objects are just piling up.

What I want to do is build the scene (say a title screen), then fade it out after the user hits a key and load another scene. I'm still trying to figure this out with the way the FrameListener works. Especially since I haven't figured out how to manage states with the automatic frame update it does. Anyway, anyone have any ideas? I've looked in the API reference for fading out a scene, but haven't found anything yet.

By the way, the Wiki tutorials are pretty awesome. They really helped me get started. Good work on that, guys.


-Darkness
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 67
Contact:

Post by sinbad »

Just use a fullscreen black overlay and gradually increase it's opacity:
http://www.ogre3d.org/phpBB2/viewtopic. ... light=fade
User avatar
Game_Ender
Ogre Magi
Posts: 1269
Joined: Wed May 25, 2005 2:31 am
Location: Rockville, MD, USA

Game States

Post by Game_Ender »

Hopefully you will find this wiki article on Managing Game States very informative. You can probably add Sinbad's fade routine to the start or change state method of the Game Manager class.
Darkness
Greenskin
Posts: 121
Joined: Sat Mar 19, 2005 3:32 am
Location: Austin, Texas

Post by Darkness »

Okay, Sinbad, that brings up some interesting questions...

1. How do I setup an overlay that covers the whole screen? As of now , I setup a script that looks like this:

Code: Select all

Screen/Overlay
{
zorder 600

container MPanel(Screen/Panel)
{

metrics_mode pixels
left -5
top -5
height 780
width 1040

}

}
I didn't see the need to add a text area because there won't ever be any text on it. Though, I could be wrong about that.

2. Can you add a material to a container? Because if that is the case, I may just do that.

What I've really been thinking is making a rect that covers the whole screen. There will be a materal placed on it that is black. The problem I see with that is how to set the zorder so that it is the absolute last thing drawn (i.e. in front of everything else).

I guess I don't know much about how this stuff works, so perhaps a little guidance is in order. :(


-Darkness
User avatar
SuprChikn
Bugbear
Posts: 863
Joined: Tue Apr 19, 2005 6:10 am
Location: Melbourne, Aus
Contact:

Post by SuprChikn »

Yes, you can give a container panel a material.
And I believe that by default an overlay is created to be the size of the screen. The elements within it can be smaller and placed accordingly.

You might want to take a look at the Manual, and specifically for info on overlays, click here.

HTH
Darkness
Greenskin
Posts: 121
Joined: Sat Mar 19, 2005 3:32 am
Location: Austin, Texas

Post by Darkness »

Thanks for the idea. The only thing about overlays is that I'm confused about what you can do with them. I've read the documentation many times, but I can't seem to grasp it. I'll have to take a look at it when I get home today. Am I at least setting up the overlay script right? I'm not sure what constitutes the whole screen, and I also don't know what happens if I just setup a script that does nothing...as in there's nothing there.

Anyone know?


-Darkness
Post Reply