Preview Window

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Mr. Turner
Halfling
Posts: 88
Joined: Sun Sep 05, 2004 7:01 pm
Location: Belgium

Preview Window

Post by Mr. Turner »

I'm looking for a method to make a preview window. I have a "add entity" dialog that uses name and meshfile to create an entity. Now I want to display a preview of the meshfile in a small window next to the meshlist without changing the scene in the mainwindow.

I searched the forums and I found that I should use a swapchains method and a RenderTargetListener.

But I can't figure out how it works. Are there any usefull examples? Is this method cross platform?

Thanks

Mr. Turner
User avatar
Wooden
Halfling
Posts: 58
Joined: Thu Feb 10, 2005 10:35 pm
Location: Arcachon, France

Post by Wooden »

If it's a CEGUI window, i know there's a rendertotexture in CEGUI look at the gui demo
Mr. Turner
Halfling
Posts: 88
Joined: Sun Sep 05, 2004 7:01 pm
Location: Belgium

Post by Mr. Turner »

I'm sorry, it's a wxWidget window. But I'll have a look at it anyway.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Post by jacmoe »

If it's just a preview window - it would be better to just spawn a new Ogre, since it does not need to be synchronized with the "main" Ogre. ? :? :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Mr. Turner
Halfling
Posts: 88
Joined: Sun Sep 05, 2004 7:01 pm
Location: Belgium

Post by Mr. Turner »

Is that possible? I thought you could only run 1 root, 1 scenemanager at the same time? They both have to be visible at the same time.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Post by jacmoe »

Well, of course this is a singleton ... one way to avoid it, is to spawn another program. :)
A command-line mesh-viewer ? :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Mr. Turner
Halfling
Posts: 88
Joined: Sun Sep 05, 2004 7:01 pm
Location: Belgium

Post by Mr. Turner »

Demo_Gui works differently. It hides the overlay, renders, unhides it. It gave me an idea though.

What do you guys think about this:

Hide the whole scene
Show the preview Node
Create texture of scene and send it to the previewwindow
Show the whole scene
continue rendering

Is this doable (performance related)?
Is this what is supposed to be done with RenderTargetListeners?

Mr. Turner
DarkSun
Kobold
Posts: 35
Joined: Wed Mar 10, 2004 12:10 pm
Location: Bielefeld, Germany

Post by DarkSun »

Yes, it should work.
Chronos does this the same way.
User avatar
Antiarc
Greenskin
Posts: 120
Joined: Thu Jan 23, 2003 8:40 am

Post by Antiarc »

Yes, this is how it's done in Chronos, as DarkSun said. I modified the base scene manager to give me two methods, which override and restore the root scene node, so I can essentially switch the node that acts as the root scene node. This lets me essentially switch between multiple scenes per frame.