[osg-users] switch between two camera

Lingyun Yu lingyun.yu.06 at gmail.com
Mon Mar 16 15:07:13 PDT 2009


Hi Robert,

I also meet the same problem, I have 128 snapshots of particles, and I want
to use those 128 shapshots to make an real time animation.
First thing I tried, was using a update callback function and bind it on my
geode, everytime I just updated all positions of particles. But obviously it
was quite slow.
Then I tried to use two view, and each one has it's own camera, and render
two snapshots in the same time. Well, it works, but still very slow.
Then I tried to use one view but two cameras, and load three snapshots in
the same time, two below two caremas, one below my Root. because I do really
need to update it. And link the right snapshots while I need to render it.

Somehow it is still slow, and while it switches snapshots and I use
trackball, it is played not fruently.

So my question is, basicly I need to render un-structed points dataset, and
I have a lot snapshots, do you have any idea how can I make an realtime
animation fruently?
Looking forward to your reply and thank you very much.

Yun
2009/3/16 Robert Osfield <robert.osfield at gmail.com>

> Hi Peter, Benoit et,
>
>  On Mon, Mar 16, 2009 at 8:15 PM, Peter Amstutz <
> peter.amstutz at tseboston.com> wrote:
>
>> The way I handled this in my application was to create multiple instances
>> of osgViewer::Viewer with a separate camera for each view but all bound to
>> the same output window.  On each render iteration, draw just the active
>> camera.
>
>
> I'm afraid I really wouldn't recommend this solution, having multiple
> viewers just to alternate between views is complicated implementation and
> conceptual wise and you'd be very lucky for it to work in anything other
> that very limited usage models.  Using multiple viewers will cause problems
> with threading, timing codes, it'd be a right old mess.
>
>
>> The best solution depends on exactly what you need to display; I decided
>> to switch between completely independent scenes because my 2D and 3D views
>> looks actually render somewhat different geometry (the 2D ortho view is an
>> abstracted version of the "real" 3D geometry).  Having entirely separate
>> scenes is also pretty straightforward although it imposes some overhead due
>> to duplication of resources that could otherwise be shared between among
>> views.
>
>
> In your case you are talking about multiple Views, and this is fine, but
> you don't use multiple Viewers for it, you'd use a single CompositeViewer
> with multiple Views.  You can add and remove Views, or just toggle Camera's
> on/off using NodeMask's.
>
> For Benoit having a single master Camera track different CameraView nodes
> in the scene might well be the most convinient way to manage things.
>
> Robert.
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Cheers,
Yun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090316/8187bc2a/attachment-0003.htm>


More information about the osg-users mailing list