Texture2D example code

Load a texture image

TextureLoader myLoader = new TextureLoader( "brick.jpg", this );
ImageComponent2D myImage = myLoader.getImage( );

or without the util classes

Toolkit tk = Toolkit.getDefaultToolkit();
   
img = tk.getImage("AnyImage.gif");
   
try {
	MediaTracker tracker = new MediaTracker(this);
	tracker.addImage(img, 0);
	tracker.waitForID(0);
	}
catch ( Exception e ) {}

ImageComponent2D image = 
	new ImageComponent2D(ImageComponent2D.FORMAT_RGB, img);

Create a Texture2D using the image (ImageComponent2D), and turn it on

Texture2D myTex = new Texture2D( );
myTex.setImage( 0, myImage );
myTex.setEnable( true );

Create an Appearance and set the texture in it

Appearance myAppear = new Appearance( );
myAppear.setTexture( myTex );

Assemble the shape

Shape3D myShape = new Shape3D( myText, myAppear );