Subject: | |
From: | |
Reply To: | |
Date: | Wed, 2 Sep 2009 16:21:27 +0200 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Okay, here's the deal.
Java3D isn't, shall we say, the easiest to use rendering system. But
it's what we need to make do with. :-( One of the problems with
Java3D is that it has a lot of hidden, undocumented nonsense.
Changing colors in spheres is one of them. Things that Sun never told
us:
1. You can't create a *new* Appearance object once the scene is live
-- you have to change the existing one.
2. BUT you still have to call setAppearance(...) with this existing
object.
3. AND you have to call setAppearance on the shape, not the
SpherePortrayal3D. Even though the SpherePortrayal3D has... as
setAppearance method.
Grrr...
Okay, I've got something working, so if you need something immediately
I can provide you with an example, and two revised files, which will
change colors as you like. But to do it well and properly, I'll need
to make a few more tweaks.
Sean
On Sep 2, 2009, at 6:59 AM, Joerg Hoehne wrote:
> Dear developers,
>
> I'm trying to change the color of an SpherePortrayal3D object during
> runtime. I've checked my
> code and I'm positive the color of the object will be changed but
> not visualized accordingly.
>
> I've got the impression the color of a XXXPortrayal3D object can't
> be changed after the first
> construction (or display) of the 3D scene by j3d. Before the first
> construction/display I was able to
> change the color with the same code snipped found below.
> Here is the code snippet anyway ('this' references to a subclassed
> SpherePortrayal3D object):
>
> this.appearance = SpherePortrayal3D.appearanceForColor(color);
>
> There has been a discussion some years ago about a similar topic
> (changing the transparency
> during runtime) and I wonder if a solution has been found.
>
> I'm working on a Mac with OS X 10.6. The monitored effect might be
> os depended because j3d
> might cache some information about the displayed objects and assumes
> some properties won't
> change in the future.
>
> Help!
>
>
> Jörg
|
|
|