Re: Adding 2nd view for holoscreen floor projection

Hi Finn,

Nice work so far.

VisADCanvasJ3D casts to DisplayImplJ3D but that doesn't change
the fact that the actual class of your object is your extension
of DisplayImplJ3D. Of course our VisADCanvasJ3D code won't know
about any new method signatures you define for your extension,
but if you over-ride any existing method signatures your over-rides
will be invoked.

You can correct the incorrect cursor string by over-riding the
drawCursorStringVector(VisADCanvasJ3D) method in DisplayRendererJ3D.
You can pass your other VisADCanvasJ3Ds to your extension of
DisplayRendererJ3D by another method. With a little luck you can
just put the existing drawCursorStringVector() code inside a loop
over your VisADCanvasJ3Ds (might be a bit more complex than that).

Please let us know if you have more problems or questions.

Cheers,
Bill

On Mon, 5 May 2003, Finn Klug wrote:

> thanks for your answer Bill. I spend some time to take a deeper look into the
> VisAD source code before writing this reply.
> The major problem in adding one or more views to VisAD to get a
> holoscreen/cave-ready projection is the fact, that the VisAD design is 
> layouted
> to have one View and one VisADCanvasJ3D (assuming the api is JPANEL).
>
> It is no problem do a "dirty" step and add second view+canvas by getting the
> scenegraph root from the display renderer.
> Here just a snippet of code to make it clearer:
>
> ----- snip ----
> ...
> display = new DisplayImplJ3D(getTitle());
>
> // repace original view transform of first (vertical) view
> TransformGroup tg
>     ((DisplayRendererJ3D) display.getDisplayRenderer())
>         .getViewTrans();
> tg.setTransform(getHorzViewingTrans());
>
> VisADCanvasJ3D c
>     new VisADCanvasJ3D(
>         (DisplayRendererJ3D) display.getDisplayRenderer());
>
> BranchGroup b = createView(c, getVertViewingTrans());
>     ((DisplayRendererJ3D) display.getDisplayRenderer())
>         .getRoot().addChild(b);
> ...
> getContentPane().setLayout(new GridLayout(2,1));
> getContentPane().add(display.getComponent());
> getContentPane().add(c);
> ...
>
> protected BranchGroup createView(VisADCanvasJ3D c, Transform3D viewingTrans) {
>     ViewPlatform vp = new ViewPlatform();
>     View v = new View();
>     v.addCanvas3D(c);
>     v.setPhysicalBody(new PhysicalBody());
>     v.setPhysicalEnvironment(new PhysicalEnvironment());
>     v.attachViewPlatform(vp);
>
>     TransformGroup viewTG = new TransformGroup();
>     viewTG.setTransform(viewingTrans);
>     viewTG.addChild(vp);
>
>     BranchGroup viewBG = new BranchGroup();
>     viewBG.addChild(viewTG);
>     return viewBG;
> }
>
> --- snip ---
>
> So far so good. We got our second view with a working MouseBehavior. But this
> attemp has some sideeffects (and some more I haven't discovered - I'm pretty
> sure) i.e. the cursor string is incorrectly drawn on the second canvas. VisAD
> isn't aware of the second canvas. I've tried to extend some classes (i.e.
> DisplayRendererJ3D, DisplayImpl, DisplayPanelJ3D...) to add a multi canvas
> support, but while doing this, I realized that this a lot of work because all
> the VisAD is working with only _one_ VisAdCanvasJ3D. Beside this it turns out
> that VisAdCanvasJ3D is only working with DisplayImplJ3D and not with my
> extention of DisplayImpl because of the type cast to DisplayImplJ3D in the
> contructor of VisAdCanvasJ3D - if I'am right.
>
> I really don't know what I should do. Adding a full functional multi
> view/projection support to VisAD is too much work for me in my project. So, I
> guess I will use the way I described and try to bypass the sideeffects with
> some workarounds. But I'am still very intrested in a more "VisAD conform"
> solution of this problem. If anyone got a good idea to integrate another
> view/projection into VisAD I would be very happy and thankfull.