VRML 2.0 Tutorials
Finally! All the worlds are VRML 2.0 Final. This means you'll need
SGI's CosmoPlayer
to view them.
Whoa! A new world! I've put the button script into a PROTO in button6.wrl.
Push Button Tutorial
This is a "tutorial by example," at least for now. We'll start with a
"button" then make it do things. You should view the source of the worlds
to see how they work.
- The Button Shape
The basic shapes we'll be using for buttons.
-
-
World
Source
- Simple Push Button
Here we've added a "push-button" behavior. Click on the green button
to depress it (and turn it red.) Click on it when it's red and it will
pop back out and turn green again. We use JavaScript
to give the button a state.
-
-
World
Source
- Push Button Moves Cube
Now, the button has been linked to a cube. Push the putton to make the
cube float up. Push it again to move the cube back down.
-
-
World
Source
- Behaviors Driven by Push Buttons
We've got 4 buttons, now. Each one is ROUTEd to a shape
and drives a behavior for that shape. Notice that this file is much bigger
and has a lot of replicated code.
-
-
World
Source
- Introduction of PROTO (same look and actions)
Here, we get our first look at PROTOs. This one hasn't
saved us much in terms of size, but the concept will come in very handy.
Appearance and functionality are identical to the previous example.
-
-
World
Source
- Better use of PROTO (same look and actions)
Now, we use PROTO on the Script that drives button
functionality. We see a savings in file size (and readability/
comprehensibility in my opinion.)
Appearance and functionality are identical to the previous example.
-
-
World
Source
Some Notes on the Button Tutorial:
-
- I am hoping to dramatically increase the size and quality of this
tutorial soon--coming next: lots of commenting in
the HTML version of the source files.
- I'm not going to concentrate on the basics of drawing shapes,
rather my focus is behaviors.
- These worlds are designed to be informational rather than
beautiful.
- I've been running with 256 colors, but I think the worlds will look
better with more.
I comment the ends of blocks like this:
Shape {
geometry Box {
} # geometry
} # Shape
This way I (and you) can match braces more easily.
LAST MODIFIED: March 8, 1997