Java Reference
In-Depth Information
Figure 6. Texture modes
1.
TextureAttributes ta= new TextureAttributes();
2.
ta.setTextureMode(TextureAttributes.BLEND);
3.
4.
Color3f green =new Color3f(0f,1f,0f);
5.
ColoringAttributes ca = new ColoringAttributes(green,ColoringAttributes.FASTEST);
6.
7.
appear.setColoringAttributes(ca);
8.
appear.setTextureAttributes(ta);
9.
appear.setTexture(texture);
BLEND
MODULATE
REPLACE
DECAL
Figure 7. Texture map transform
1.
TextureAttributes ta= new TextureAttributes();
2.
ta.setTextureMode(TextureAttributes.REPLACE);
3.
4.
Color3f green =new Color3f(0f,1f,0f);
5.
ColoringAttributes ca = new ColoringAttributes(green,ColoringAttributes.FASTEST);
6.
7.
appear.setColoringAttributes(ca);
8.
appear.setTextureAttributes(ta);
9.
appear.setTexture(texture);
10.
11. Transform3D trans = new Transform3D();
12. trans.rotZ(Math.PI/2);
13. ta.setTextureTransform(trans);
texture coordInate GeneratIon
As illustrated in previous sections, using texture to enhance the appearance of objects in
a virtual 3D world is straightforward. The most cumbersome and time consuming opera-
Search WWH ::




Custom Search