import java.awt.*;
import javax.media.j3d.*;
import javax.swing.JFrame;
import javax.vecmath.Point3f;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class Wireframe {
	public static void main(String[] args) {

		// Text mit Wireframe-Aussehen anlegen
		PolygonAttributes wireframePolygonAttributes =
			new PolygonAttributes(
				PolygonAttributes.POLYGON_LINE,
				PolygonAttributes.CULL_NONE,
				0);
		Appearance wireframeAppearance = new Appearance();
		wireframeAppearance.setPolygonAttributes(wireframePolygonAttributes);
		Font3D sansSerif =
			new Font3D(
				new Font("SansSerif", Font.BOLD, 1),
				new FontExtrusion());
		Text3D text = new Text3D(sansSerif, "Java", new Point3f(-1f, -.5f, 0f));
		Shape3D textShape = new Shape3D(text);
		textShape.setAppearance(wireframeAppearance);

		// Szenengraph anlegen
		Transform3D transform = new Transform3D();
		transform.rotY(Math.PI / 180 * 60);
		TransformGroup group = new TransformGroup(transform);
		group.addChild(textShape);
		BranchGroup root = new BranchGroup();
		root.addChild(group);
		GraphicsConfiguration c = SimpleUniverse.getPreferredConfiguration();
		Canvas3D canvas = new Canvas3D(c);
		SimpleUniverse universe = new SimpleUniverse(canvas);
		universe.addBranchGraph(root);
		universe.getViewingPlatform().setNominalViewingTransform();

		// alles anzeigen
		JFrame frame = new JFrame("Wireframe Demo ohne Backface Culling");
		frame.setSize(400, 400);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().add(BorderLayout.CENTER, canvas);
		frame.show();
	}
}

