Skip to main content

Geometry in Wrong Place after Locale Change

2 replies [Last post]
budnspud
Offline
Joined: 2004-06-25
Points: 0

Hi,

back on Oct 10 I posted "Hires Coordinate Locale bug?"
and received no replies.
If one of the Java3D developers could reply, I would
greatly appreciate it.
This bug is holding up an otherwise nearly completed product:
http://home.comcast.net/~meralizer/
When I switch between two hires coord Locales,
some of the geometry is not in the correct position.
Is there an extra step I'm missing?
Could someone please post an example of switching between
Locales?
As a workaround, I call the setTransform() for each of the
relevant nodes in the graph.
This workaround works, but introduces a secondary bug.
I occasionally get the dreaded intermittent:

java.lang.NullPointerException at javax.media.j3d.BHLeafNode.getLocale(BHLeafNode.java:77)
at javax.media.j3d.GeometryStructure.processTransformChanged(GeometryStructure.java:541)
at javax.media.j3d.GeometryStructure.processMessages(GeometryStructure.java:203)
at javax.media.j3d.StructureUpdateThread.doWork(StructureUpdateThread.java:83)
at javax.media.j3d.J3dThread.run(J3dThread.java:250)

I thought the above problem might have something to do with known bug ID: 4774341. So I added the following workaround, which is documented in the bug parade:

try{Thread.sleep(200);}catch(Exception ex)
{ex.printStackTrace();}

Which works 90% of the time. But I need a solution
that works 100% of the time.

Could someone at JavaSoft please reply to my problem?

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kcr
Offline
Joined: 2004-03-17
Points: 0

Hi,

Do you have a test program that demonstrates the problems you are seeing? If you could please file an issue and attach a simple test program, that would be helpful. See the following thread for more information on how to do that.

http://www.javadesktop.org/forums/thread.jspa?threadID=6406

I do have a couple of questions for you. When you say "switch between two hires coord Locales", what exactly do you mean? Do you: A) detach all BranchGroups (including the view branch) from the first Locale and reattach it to a second Locale? B) detach the ViewPlatform in the first Locale from the View and attach the second ViewPlatform in the second Locale to the View? or C) something else?

-- Kevin

budnspud
Offline
Joined: 2004-06-25
Points: 0

I don't have a test program and it will take some time to
pare my code down to a test version. I'll create one
when I finish my remaing non-j3d related code.

In the mean time, here is how I switch my view between locales:
//=====================================
class UniverseMultiLocaleMars extends SimpleUniverse{
// contains three Locale classes, each with their own
// HiResCoord classes
}

class PointOfViewLocale {
// container class for View related classes.
// One PointOfViewLocale class is created for each
// Locale class in UniverseMultiLocaleMars.
...
ViewingPlatform viewingPlatform;
ViewPlatform viewPlatform;
...
}

class Main3DViewJPanel extends JPanel {
...
Canvas3D canvas3D;
...
}

// Main program code snippet
...
Viewer viewerMine = new Viewer(main3DViewJPanel.canvas3D);
...
View viewerView = viewerMine.getView();
...
UniverseMultiLocaleMars universeMultiLocaleMars = new
UniverseMultiLocaleMars(pointOfViewLocaleCurrent.viewingPlatform,
pointOfViewLocaleCurrent.viewPlatform); // constructor passes these arguments to the parent class using super();
...
// Function used to switch view between locales:
void switchToLocaleView(PointOfViewLocale pointOfViewLocale){
if (pointOfViewLocaleCurrent.viewPlatform != null)
viewerView.attachViewPlatform(pointOfViewLocaleCurrent.viewPlatform);
}
// Where pointOfViewLocaleCurrent is switched between three PointofViewLocale classes.
//======================================

Do you have an example of the "correct" way to do this?
I've searched online and couldn't find any view switching
examples. Java3D book doesn't have one either.

Thanks
-Jeroen