Wednesday, January 9, 2008

Technical: Applied Colouring to Text

Colourings can be applied to the text to change the appearing colour, thus making it more creative and lively.

Using the Appearance object. We must first import the class
- import javax.media.j3d.Appearance


/**   Begin of sample codes   */
Appearance textAppear = new Appearance();
ColoringAttributes textColor = new ColoringAttributes();
textColor.setColor(1.0f0.0f0.0f);
textAppear.setColoringAttributes(textColor);
textAppear.setMaterial(new Material());
/**   End of sample codes   */

As you can see above, the setColor method interprets the 3 floats together as an RGB colour.

The appearance object actually defines all rendering state, like material, textures as well.. more study will be done.


Appearance API here.

No comments: