Hallo,

When i want to render a onscreen canvas i use the command
renderOnce() to make sure that the frame that i want is
rendered. If i use an offscreen canvas i use the comand
waitForOffScreenRendering();

the explication in the java 3d API:
http://java.sun.com/products/java-
media/3D/forDevelopers/J3D_1_2_API/j3dguide/ViewModel.doc.html
#55510

-public void renderOnce()

This method renders one frame for a stopped View.
Functionally, this method is equivalent to startView()
followed by stopview(), except that it is atomic, which
guarantees that only one frame is rendered

-public void waitForOffScreenRendering()

This method waits for this Canvas3D's off-screen rendering to
be done. This method will wait until the postSwap method of
this off-screen Canvas3D has completed. If this Canvas3D has
not been added to an active view or if the renderer is
stopped for this Canvas3D, this method will return
immediately. This method must not be called from a render
callback method of an off-screen Canvas3D

So,

onscreen canvas 3d:

canvas3D.getView().stopView();
canvas3D.getView().renderOnce();
canvas3D.getView().startView();

offscreen canvas 3d

offCanvas.renderOffScreenBuffer();
offCanvas.waitForOffScreenRendering();

I dont know if this is the best approach but it works good
for me. I would not use a thread to do it too, but if you
need to do with a thread, i hoppe that this will work.



Tiago


> Hi Java 3D fans
>
> I do a simulation. The calculation takes about a second and
the rendering
> about 0.5 to 10 seconds. that is how it is done in a Thread
so far:
>
> in Thread.run():
>
> canvas.stopRenderer();
> heavyCalculation();
> canvas.startRenderer();
>
> //wait
> try {
>     Thread.yield();
>     Thread.sleep(500);
> } catch (InterruptedException ie) {
> }
>
> unfortunatly the canvas isn't updated when the rendering tak
es more than 500
> ms. I want to update the picture after every step in simulat
ion.
> my question: is there any possibility to ask the canvas if i
t is ready with
> rending? I need something like: repeat Thread.yield/sleep un
til
> canvas.finished. Is this possible?
>
> Thank you
>
> Chris Ender
>
> ============================================================
===============
> To unsubscribe, send email to [EMAIL PROTECTED] and incl
ude in the body
> of the message "signoff JAVA3D-
INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message
 "help".
>


---
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to