RealTime Rendering

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
Yavin
Bronze Sponsor
Bronze Sponsor
Posts: 140
Joined: Wed Mar 02, 2005 3:41 pm
Location: Lake Constance, Germany
Contact:

RealTime Rendering

Post by Yavin » Thu Mar 03, 2005 12:12 pm

Hello,

we are working on a app that renders a scene depending on real world states. On this account we will get situations we can't wait until a frame is rendered. At the moment I'm thinking about a solution that doesn't use the default render loop and monitors the real world in a second thread. This thread will touch the specific render loop if a real world event is given.

What's your opinion? Is this a possible solution? Other ideas?
Thanks in advance.
0 x

User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
Contact:

Post by haffax » Thu Mar 03, 2005 12:50 pm

What exactly do you mean with you can't wait until a frame is rendered? Would the rendering take too long, so that your program might miss real world events? I nthis case this might be a solution, but you have to be careful not to change the scene in the second thread while the first one is rendering. Ogre is by no means thread save.

Maybe it would be easier for others to provide ideas, if you gave a few more details, what these real world events are.
0 x
team-pantheon programmer
creators of Rastullahs Lockenpracht

User avatar
Yavin
Bronze Sponsor
Bronze Sponsor
Posts: 140
Joined: Wed Mar 02, 2005 3:41 pm
Location: Lake Constance, Germany
Contact:

Post by Yavin » Thu Mar 03, 2005 2:14 pm

Yes you are right it could happen that events will be missed during rendering (in fact of an big scene). Okay OGRE is not thread save, I read this already, so what would be the best way to change a scene from a external thread?
0 x

User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
Contact:

Post by haffax » Thu Mar 03, 2005 2:41 pm

As I said: It is very difficult to give hints without knowing what it is all about. When you are able to get deltas for the real world changes (e.g. Object A moved Vector3(3, 67, -1)) you could feed a shared threadsafe queue with these changes. So the world wathcing thread feeds this queue, the rendering thread renders and in between it commits all queued changes to the scene and renders again.

Edit: Of course this approach has its issues too. Once in a while you must include a scene correction, that sets all positions/orientations to absolute values, because reality and scene will drift apart sooner or later when you only apply deltas.
0 x
team-pantheon programmer
creators of Rastullahs Lockenpracht

User avatar
Yavin
Bronze Sponsor
Bronze Sponsor
Posts: 140
Joined: Wed Mar 02, 2005 3:41 pm
Location: Lake Constance, Germany
Contact:

Post by Yavin » Fri Mar 04, 2005 4:55 pm

thx for your answer, it's helpful enough. No need for detailed description of my app.
0 x

Post Reply