Java Reference
In-Depth Information
using the setPolygonMode method to POLYGON_POINT to ensure that only the vertices
are rendered. Specifically, line 17 creates a new Appearance object, line 18 creates a new
PolygonAttributes object, line 20 sets the PolygonMode, and line 23 sets the PolygonAt-
Figure 10. Code segment PolygonAttributesExample1.java
1.
public class AppearanceCULL_NONE extends Applet
2.
{
3.
public class Letter_E extends Shape3D
4.
{
5.
int vertex = 4;
6.
//constructor
7.
public Letter_E()
8.
{
9.
this.setGeometry(Quad1Geometry());
10.
this.addGeometry(Quad2Geometry());
11.
12.
this.addGeometry(Quad3Geometry());
13.
this.addGeometry(Quad4Geometry());
14.
this.setAppearance(Letter_E_Appearance());
15.
}
16.
private Appearance Letter_E_Appearance()
17.
{
18.
Appearance look = new Appearance();
19.
PolygonAttributes polyAttrib = new PolygonAttributes();
20.
//to make both sides of the face appear
21.
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
22.
look.setPolygonAttributes(polyAttrib);
23.
return look;
24.
}
Figure 11. Results from PolygonAttributesExample1.java. Note that the CULL_NONE
attribute results in both the front and back of the letter E to be seen even after it has been
rotated
Search WWH ::




Custom Search