Skip to main content

synchronized behaviors

2 replies [Last post]
miles
Offline
Joined: 2004-06-05

Is there a way to ensure that changes to a TransformGroup and a GeometryArray take place in the same thread?

Basically, presently it comes down to a TransformGroup with a contained GeometryArray. I move the Geometry Array to some position on the X axis, and set its containing TransformGroup to translate it back to 0,0.

This generally seems to work as I'd expect but I sometimes get "flashes" of the object at whatever position it'd be at without the TransformGroup applied.

I thought the proper way to ensure synchronized behavior was to wrap the update in a Behavior, i.e.:

class Update extends Behavior {
private WakeupCondition condition = new WakeupOnElapsedFrames(0, false);

    public void initialize()
{
wakeupOn(condition);
}

public void processStimulus(Enumeration wakeup)
{
Object w;

while(wakeup.hasMoreElements()) {
w = wakeup.nextElement();
if(w instanceof WakeupOnElapsedFrames)
recalculate();

wakeupOn(condition);
}
}

I've also tried flipping the passive parameter on the WakeupCondition, but it doesn't seem to make any difference.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miles
Offline
Joined: 2004-06-05

To update to this, further testing shows changes to the TransformGroup seem to be happen a single frame after changes to the GeometryArray. I'd heard this happens when geometry primitives are BY_REFERENCE, but mine are most certainly not. (I didn't set them that, and I use lots of methods in GeometryArray that throw exceptions for BY_REFERENCE primitives).

Anybody know have any idea what's up?

Mike Pilone

Miles,

I believe you are seeing the frame delay problem with some Java3D nodes.
>From my understanding Geometry and Texture changes will appear in the next
frame, whereas other changes will take to frames to update. It has to do
with geometry and textures not using mirror objects in the universe while
the other nodes do.

I think a work around for this is to update the transform, wake the behavior
on 0 elapsed frames, then update the geometry. This will delay the geometry
update 1 frame and everything should update at the same time.

Also make sure that you are using the latest build. A bug was fixed not too
long ago with updates having random timing based on your frame delay.

-mike

-----Original Message-----
From: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Sent: Wednesday, October 20, 2004 8:53 PM
To: interest@java3d.dev.java.net
Subject: [JAVA3D-INTEREST] Re: synchronized behaviors

To update to this, further testing shows changes to the TransformGroup seem
to be happen a single frame after changes to the GeometryArray. I'd heard
this happens when geometry primitives are BY_REFERENCE, but mine are most
certainly not. (I didn't set them that, and I use lots of methods in
GeometryArray that throw exceptions for BY_REFERENCE primitives).

Anybody know have any idea what's up?
---
[Message sent by forum member 'miles' (MPH)]

http://www.javadesktop.org/forums/thread.jspa?messageID=34418&#34418

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net