Guillaume Bilodeau wrote:

> Hi,
>
>         Finally, I have been able to get it to work!  The worse is, I don't know why 
>it
> works now, it seems that I didn't change much.  I did make a major overhaul of
> the scene graph structure (I dropped the SimpleUniverse to build my own
> VirtualUniverse), but I don't think this might have had any effect.  Anyway, it
> works fine so I'm not complaining!
>

Glad you've been able to get it to work!  I'm submitting this to the whole Java 3D 
mailing
list so that anyone else with the same
question (below) can benefit:

>
>         There is one little annoyance though...  Since the code to take the snapshot 
>is
> in the postSwap() method, it is executed only when a new frame is rendered.  Is
> there any way to render a new frame manually?  This is a 3D objet viewer so the
> objects are pretty much still for most of the time.  One might take a snapshot
> and immediately exit the viewer and the snapshot wouldn't be taken.

The trick here is structuring your code correctly.    The way I would do it is to take 
all
of the capturing code out of postSwap() and
put it into another method (for example, doCapture).   The only call in postSwap() 
would
then be a call to doCapture().  Then, anytime you wanted to do a frame grab, just call 
the
doCapture() method.

The benefit of doing it this way is that you can set an internal flag  in the 
postSwap()
of  your subclassed Canvas3D object to tell it when to continually capture things.  If 
you
want to capture on every frame, set the flag to true.   If you want to only catch one
frame, call doCapture() directly.


        public void postSwap() {
                super.postSwap();
                if (recording)
                        doCapture();
        }



>
>
>         Thank you very much for your help, you don't know how much I appreciate it!

I'm happy I could help.


--
Steve Pietrowicz - [EMAIL PROTECTED]    Project Manager - NCSA Java 3D Group

NCSA Portfolio:      http://havefun.ncsa.uiuc.edu/Java3D/portfolio/
   New Beta 2a release!  New Loaders, record and replay of your
   Java 3D apps and more! Freely available for non-commercial use!
You Build It VR:     http://havefun.ncsa.uiuc.edu/Java3D/YouBuildItVR/
   Build your own multi-user virtual worlds with no programming experience!
The Java3D FAQ:      http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
Java News Network:   http://tintoy.ncsa.uiuc.edu/~srp/java/javanews.html



=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to