The AsciiText Node

Our first world file demonstrates the fact that ASCII VRML is not easily taught linearly; you will notice that along with the AsciiText node are both a Material node and a Separator node. As can be seen by the context of the Material node, its purpose is to specify surface material properties for shapes. The Separator node is a 'group node;' it isolates (or separates) the nodes within the Separator from the rest of the objects in the scene. The second line of code of every VRML world file is always a group node, essentially grouping the entire world together. Thus, the properties in the Material Node will apply to every shape in the scene. The uses of Separator nodes will become more apparent as we move through the tutorial.
For now let's focus on the AsciiText node. This node creates the text string "This is a cool demo world!" The spacing parameter refers to the height of the text, in this case, 1 unit. Justification CENTER places the center of the text at the default coordinates (0,0,0). Finally, the width parameter is used to limit the width of the text, if necessary. Here, the value of 0 specifies no width constraints.
#VRML V1.0 ascii
Separator {

	Material {
		ambientColor 0.2 0.2 0.2
		diffuseColor 0.8 0.8 0.8
		specularColor 0 0 0 
		emissiveColor 0 0 0
		shininess 0.2
		transparency 0
	} #Material

	AsciiText {
		string 	"This is a cool demo world!"
		spacing	1
		justification CENTER
		width 0
	} #AsciiText

} #Separator	

View the world.
Move on.
Move back.
Move back to the beginning
Page designed by Pete Clark
Last updated on Feb. 11, 1996.
E-mail me with any comments or suggestions! Come again!