Print

Print


Hi Glen.  The default use of CubePortrayal3D has no need to modify  
polygon attributes.  For example, PSO3DWithUI (particle swarm  
optimization) works great with CubePortrayal3D as is.  This suggests  
that your code must be doing something special to CubePortrayal3D  
which is tickling Java3D's need to modify its polygon attributes.   
Having it draw only as a wireframe maybe?  Adding gourad shading? Dunno.

But this is perfectly fine to do -- you added the right  
modification.  MASON doesn't have various attributes permissions  
turned on by default because in some cases Java3D gets slower when  
they're turned on; so we're conservative.  But if you find it helpful  
we can add it to MASON for you.  But it'd be nice to suss out why  
your code is requiring it just so to ponder over it.

Sean

On Feb 28, 2008, at 8:49 PM, glen e. p. ropella wrote:

> I'm not sure why this is happening.  But, if I run my simulation with
> the default CubePortrayal3D in MASON 12, I get the following  
> exception:
>
> ---------------------------------------------------------------------- 
> ----
> javax.media.j3d.CapabilityNotSetException: Appearance: no  
> capability to
> set polygonAttributes
>         at
> javax.media.j3d.Appearance.setPolygonAttributes(Appearance.java:446)
>         at
> sim.portrayal3d.simple.CubePortrayal3D.getModel 
> (CubePortrayal3D.java:129)
>         at
> sim.portrayal3d.SparseFieldPortrayal3D.wrapModelForNewObject 
> (SparseFieldPortrayal3D.java:77)
>         at
> sim.portrayal3d.SparseFieldPortrayal3D.updateModel 
> (SparseFieldPortrayal3D.java:157)
>         at
> sim.portrayal3d.FieldPortrayal3D.getModel(FieldPortrayal3D.java:182)
>         at sim.display3d.Display3D.updateSceneGraph(Display3D.java: 
> 1142)
>         at sim.display3d.Display3D.step(Display3D.java:1098)
>         at sim.display.GUIState$Repeat.step(GUIState.java:606)
>         at sim.display.GUIState.step(GUIState.java:428)
>         at sim.display.Console$56.run(Console.java:2277)
>         at java.lang.Thread.run(Thread.java:619)
> ---------------------------------------------------------------------- 
> ----
>
> However, if I add the following two lines to the CubePortrayal3D
> constructor:
>
> appearance.setCapability 
> (javax.media.j3d.Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);  
> appearance.setCapability 
> (javax.media.j3d.Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
>
> everything works out quite well.  Perhaps I'm violating some MASON
> pattern?
>
> -- 
> glen e. p. ropella, 971-219-3846, http://tempusdictum.com