> I have a four sided object that is 2d, but can be rotated and
> translated, etc., using java 3d. I specified the color, but it only
[quoted text clipped - 6 lines]
> Aaron Hirshberg
> aaronhirshberg@yahoo.com
I'm not sure if I understand your question correctly, and I'm only a beginner with Java 3D. I'm assuming that your four sided 2D object is something like a four-sided plane like you would get by calling QuadArray.
Something like this:
QuadArray plane = new QuadArray(4, GeometryArray.COORDINATES
| GeometryArray.COLOR_3);
//set coordinates
Point3f p = new Point3f(-1.0f, 1.0f, 0.0f);
plane.setCoordinate(0, p);
p.set(-1.0f, -1.0f, 0.0f);
plane.setCoordinate(1, p);
p.set(1.0f, -1.0f, 0.0f);
plane.setCoordinate(2, p);
p.set(1.0f, 1.0f, 0.0f);
plane.setCoordinate(3, p);
//set color
Color3f red = new Color3f(1.0f,0.0f,0.0f);
plane.setColor(0,red);
plane.setColor(1,red);
plane.setColor(2,red);
plane.setColor(3,red);
Then, when you create the Appearance() object, set CULL_NONE in the PolygonAttributes like this:
Appearance appear = new Appearance();
PolygonAttributes polyAttrib = new PolygonAttributes();
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
appear.setPolygonAttributes(polyAttrib);
Shape3D planeObj = new Shape3D(plane, appear);
When I ran this (in a rotating TransformGroup)I get a red square on both sides. But if I set CULL_BACK or CULL_FRONT instead of CULL_NONE, I get a red square on one side, black on the other. I hope this helps.
aaronhirshberg@yahoo.com - 10 Jul 2005 05:01 GMT
> > I have a four sided object that is 2d, but can be rotated and
> > translated, etc., using java 3d. I specified the color, but it only
[quoted text clipped - 41 lines]
>
> When I ran this (in a rotating TransformGroup)I get a red square on both sides. But if I set CULL_BACK or CULL_FRONT instead of CULL_NONE, I get a red square on one side, black on the other. I hope this helps.
What I did was create a second panel in the same place with reversed
vertices so the normal points the other way
and made the two polygons different colors. It worked. Culling is
important in a situation like what I have
created as culling out the nonvisible panels saves rendering time. As
soon as I figure that out I will do that, too.
Aaron
Paul Drallos - 10 Jul 2005 12:28 GMT
> What I did was create a second panel in the same place with reversed
> vertices so the normal points the other way
> and made the two polygons different colors. It worked. Culling is
> important in a situation like what I have
> created as culling out the nonvisible panels saves rendering time. As
> soon as I figure that out I will do that, too.
I'm confused again. As soon as you figure 'what' out?
aaronhirshberg@yahoo.com - 11 Jul 2005 00:59 GMT
> > What I did was create a second panel in the same place with reversed
> > vertices so the normal points the other way
[quoted text clipped - 4 lines]
>
> I'm confused again. As soon as you figure 'what' out?
I am so busy fiddling with Java 3D using my existing knowledge that I
haven't had time to read the various on-line instructions more
extensively. That is what I mean.
Aaron Hirshberg