//Comment out the following package statement to compile separately.


 * Example01 illustrates the basics of Java 3D.  We construct
 * the simplest possible view branch and insert it into our
 * scene graph.  We do not specify any content for the content
 * branch of our scene graph, so Java 3D renders an empty
 * universe.
 * <P>
 * This example is designed so that we can swap out the
 * content of our constructView(), constructViewBranch(),
 * and constructContentBranch() methods to change our physical
 * viewing parameters, view branch portion of our scene graph,
 * or content portion of the scene graph independently from each
 * other.
 * <P>
 * This version is compliant with Java 1.2 Beta 4 and
 * Java 3D 1.1 Beta 2, Nov 1998.  Please refer to: <BR>
 * <P>
 * @author Bill Day <>
 * @version 1.0
 * @see
 * @see
 * @see
 * @see
 * @see
 * @see
 * @see
 * @see
 * @see

import java.awt.*;

import java.awt.event.*;


public class Example01 extends Frame {
   * Instantiates an Example01 object.
  public static void main(String args[]) {
    new Example01();

   * The Example01 constructor sets the frame's size, adds the
   * visual components, and then makes them visible to the user.
   * <P>
   * We place a Canvas3D object into the Frame so that Java 3D
   * has the heavyweight component it needs to render 3D
   * graphics into.  We then call methods to construct the
   * View and Content branches of our scene graph.
  public Example01() {
    //Title our frame and set its size.

    super("Java 3D Example01");

    //Here is our first Java 3d-specific code.  We add a

    //Canvas3D to our Frame so that we can render our 3D

    //graphics.  Java 3D requires a heavyweight component

    //Canvas3D into which to render.

    Canvas3D myCanvas3D = new Canvas3D(null);

    //Turn on the visibility of our frame.


    //We want to be sure we properly dispose of resources 

    //this frame is using when the window is closed.  We use 

    //an anonymous inner class adapter for this.

    addWindowListener(new WindowAdapter() 
      {public void windowClosing(WindowEvent e) 
         {dispose(); System.exit(0);}  

    //Now that we have our Frame and Canvas3D, we are ready

    //to start building our scene graph.  We need to construct

    //both a view branch and a content branch.  In order to

    //actually use our view branch, we also need to construct

    //a View and connect it to our view branch's ViewPlatform.

    View myView = constructView(myCanvas3D);
    Locale myLocale = constructViewBranch(myView);

   * constructView() takes a Canvas3D reference and constructs
   * a View to display in that Canvas3D.  It uses the default
   * PhysicalBody and PhysicalEnvironment (both required to be
   * set or else the 3D runtime will throw exceptions).  The
   * returned View is used by constructViewBranch() to attach
   * the scene graph's ViewPlatform to a Canvas3D for rendering.
   * @see constructViewBranch(View)
  private View constructView(Canvas3D myCanvas3D) {
    View myView = new View();
    myView.setPhysicalBody(new PhysicalBody());
    myView.setPhysicalEnvironment(new PhysicalEnvironment());

   * constructViewBranch() takes as input a View which we
   * attached to our Canvas3D in constructView().  It constructs
   * a default view branch for the scene graph, attaches
   * the View to the ViewPlatform, and returns a reference to
   * our Locale for use by constructContentBranch()
   * in creating content for our scene graph.
   * @see constructView(Canvas3D)
   * @see constructContentBranch(Locale)
  private Locale constructViewBranch(View myView) {

    //First, we create the necessary coordinate systems 

    //(VirtualUniverse, Locale), container nodes

    //(BranchGroup, TransformGroup), and platform which 

    //determines our viewing position and direction (ViewPlatform).  

    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    BranchGroup myBranchGroup = new BranchGroup();
    TransformGroup myTransformGroup = new TransformGroup();
    ViewPlatform myViewPlatform = new ViewPlatform();

    //Next, we insert the platform into the transform group, 

    //the transform group into the branch group, and the branch

    //group into the locale's branch graph portion of the 

    //scene graph.


    //Finally, we attach our view to the view platform and we

    //return a reference to our new universe.  We are ready to 

    //render 3D content!


   * constructContentBranch() is where we specify the 3D graphics
   * content to be rendered into the Locale referenced
   * in the passed parameter.  Nothing is currently specified, so we
   * render an empty universe.
   * @see constructViewBranch(View)
  private void constructContentBranch(Locale myLocale) {
    //Insert content to be rendered here.



Linux System Admin Tips: There are over 200 Linux tips and tricks in this article. That is over 100 pages covering everything from NTP, setting up 2 IP address on one NIC, sharing directories among several users, putting running jobs in the background, find out who is doing what on your system by examining open sockets and the ps command, how to watch a file, how to prevent even root from deleting a file, tape commands, setting up cron jobs, using rsync, using screen conveniently with emacs, how to kill every process for a user, security tips and a lot more. These tip grow weekly. The above link will download the text version for easy grep searching. There is also an html version here.

Breaking Firewalls with OpenSSH and PuTTY: If the system administrator deliberately filters out all traffic except port 22 (ssh), to a single server, it is very likely that you can still gain access other computers behind the firewall. This article shows how remote Linux and Windows users can gain access to firewalled samba, mail, and http servers. In essence, it shows how openSSH and Putty can be used as a VPN solution for your home or workplace.

MySQL Tips and Tricks: Find out who is doing what in MySQL and how to kill the process, create binary log files, connect, create and select with Perl and Java, remove duplicates in a table with the index command, rollback and how to apply, merging several tables into one, updating foreign keys, monitor port 3306 with the tcpdump command, creating a C API, complex selects, and much more.

Create a Live Linux CD - BusyBox and OpenSSH Included: These steps will show you how to create a functioning Linux system, with the latest 2.6 kernel compiled from source, and how to integrate the BusyBox utilities including the installation of DHCP. Plus, how to compile in the OpenSSH package on this CD based system. On system boot-up a filesystem will be created and the contents from the CD will be uncompressed and completely loaded into RAM -- the CD could be removed at this point for boot-up on a second computer. The remaining functioning system will have full ssh capabilities. You can take over any PC assuming, of course, you have configured the kernel with the appropriate drivers and the PC can boot from a CD. This tutorial steps you through the whole processes.

SQLite Tutorial : This article explores the power and simplicity of sqlite3, first by starting with common commands and triggers, then the attach statement with the union operation is introduced in a way that allows multiple tables, in separate databases, to be combined as one virtual table, without the overhead of copying or moving data. Next, the simple sign function and the amazingly powerful trick of using this function in SQL select statements to solve complex queries with a single pass through the data is demonstrated, after making a brief mathematical case for how the sign function defines the absolute value and IF conditions.

The Lemon Parser Tutorial: This article explains how to build grammars and programs using the lemon parser, which is faster than yacc. And, unlike yacc, it is thread safe.

How to Compile the 2.6 kernel for Red Hat 9 and 8.0 and get Fedora Updates: This is a step by step tutorial on how to compile the 2.6 kernel from source.

Virtual Filesystem: Building A Linux Filesystem From An Ordinary File. You can take a disk file, format it as ext2, ext3, or reiser filesystem and then mount it, just like a physical drive. Yes, it then possible to read and write files to this newly mounted device. You can also copy the complete filesystem, since it is just a file, to another computer. If security is an issue, read on. This article will show you how to encrypt the filesystem, and mount it with ACL (Access Control Lists), which give you rights beyond the traditional read (r) write (w) and execute (x) for the 3 user groups file, owner and other.

Working With Time: What? There are 61 seconds in a minute? We can go back in time? We still tell time by the sun?

Chirico img Mike Chirico, a father of triplets (all girls) lives outside of Philadelphia, PA, USA. He has worked with Linux since 1996, has a Masters in Computer Science and Mathematics from Villanova University, and has worked in computer-related jobs from Wall Street to the University of Pennsylvania. His hero is Paul Erdos, a brilliant number theorist who was known for his open collaboration with others.

Mike's notes page is souptonuts. For open source consulting needs, please send an email to All consulting work must include a donation to Logo Logo