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.
RealTime Rendering
-
- Bronze Sponsor
- Posts: 140
- Joined: Wed Mar 02, 2005 3:41 pm
- Location: Lake Constance, Germany
-
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
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.
Maybe it would be easier for others to provide ideas, if you gave a few more details, what these real world events are.
-
- Bronze Sponsor
- Posts: 140
- Joined: Wed Mar 02, 2005 3:41 pm
- Location: Lake Constance, Germany
-
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
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.
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.
-
- Bronze Sponsor
- Posts: 140
- Joined: Wed Mar 02, 2005 3:41 pm
- Location: Lake Constance, Germany