|
The point is after you change color of a
geometry array in the scene graph, make sure that preRender() is getting called,
before you do what you are doing in the postSwap().
Now preRender(), postSwap() etc gets called
automatically by the j3d renderer thread and you shoould not call them
explicitely if you are in mixed mode rendering( which I assume you are!
).
try adding a print in the preRender() /
postSwap() calls and see if preRender() is getting called before your image dump
call from postSwap(). If not, then thats the reason. So the steps which I have
mentioned were basically to make sure and wait till the following happens in the
proper sequence :
changeColor() in application thread ,
preRender() in j3d rendering thread, postSwap() in j3d renderer
thread.
try what I had suggested. it may be handy
!
thanks
anirban
----- Original Message -----
Sent: Friday, March 07, 2003 4:08
PM
Subject: Re: [JAVA3D] Scenegraph and
renderer updations
Hi,
Thanks for the reply. Actually what i meant by frame
delay is that we are incrementing a counter in preRender and dumping the JPEG
after that in postSwap instead of postRender. Below is the section of the
preRender code.
if(saveAsJpegFlag ==
true) {
if(updateCounter == 1)
{
super.getGraphicsContext3D().clear();
updateCounter = 2 ;
} else if(updateCounter ==
0) {
updateCounter = 1 ;
} } Regarding your
second suggestion that a call to the preRender is missing, i couldn't quite
get it. Basically , i need to update the color (in the Scenegraph) and then
after the Renderer has rendered this change, to export the JPEG in postSwap.
The problem is that, since lot of multi-threading is involved, it is getting
difficult to synchronise the changes
effectively.
Thanks, Raghav
Anirban Bhadore wrote:
I know that Scenegraph updations
and Renderer threads are parallel and i have ensured that the JPEG image
is captured with a delay of one frame in the postSwap of the extended
Canvas3D object. The color change updations are very inconsistent.
Does this mean that after you update the color in the scenegraph, you wait
for a frame and then dump the image in the postSwap()? We follow a simple
step to achive something similar.
try these steps -
1.add two boolean members to extended Canvas3D class. say "preBool" and
"postBool". default to false.
2. update color in the scene graph. and set preBool to true.
3. in preRender() if preBool is true then set postBool as true.
4. in postRender() if postBool is true, then dump the jpeg.
One thing that can be missing in your case is a call to preRender() in
between your editing operation and postRender() call since they are
happening in different threads. This will ensure that preRender() is called
in between and your change has been realized by renderer thread.
This works quite well in our case.
thanks
anirban
----- Original Message -----
From: "Raghavendra R" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 3:08 PM
Subject: [JAVA3D] Scenegraph and renderer updations
Hi,
I want to know how to ensure Scenegraph updations get reflected in
Renderer consistently. I have a Java3D code which consists of a
Scenegraph with many Branchgroups (in turn having GeometryArrays, Morphs
etc) depicting an FE mesh. I need to change the color of one particular
Morph containing an array of Geometry arrays before taking a JPEG image
of the same thro' the postSwap in Renderer.
My problem is that, the color changes to the GeometryArrays do not
always get reflected in the JPEG image. I know that Scenegraph updations
and Renderer threads are parallel and i have ensured that the JPEG image
is captured with a delay of one frame in the postSwap of the extended
Canvas3D object. The color change updations are very inconsistent.
How do i ensure that the Renderer and hence the JPEG image shows the
correct and all the latest updations (color, geometry etc) to the
Scenegraph? Any info will be greatly appreciated.
Thanks in advance,
Raghav
===========================================================================
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".
===========================================================================
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".
|