|
|
FB 4
Internationale Media and Computing
MeSoII: Media Software II
Sommersemester 2002
|
Exercise 8: Getting
Started with the Java 3D API
I wanted to do the Advanced Imaging
with you this week, but if I can't get it to work on my machine, I can't ask you
to try! So we will skip that and go on to the 3D stuff, so you can soon be writing
your own 3D StudioMax!
The exercise for this week is not a jGuru one. It
is a major .pdf file, more like a book and not really suited for reading on screen.
Oh well. It's a book by Dennis J Bouvier published by Sun Microsystems. The link
ist http://java.sun.com/products/java-media/3D/collateral/.
You can find the API, the tutorial, and the source code for all the example programs
at this address. The author suggests three modules for working with the tutorial.
We will spend one exercise on each module; however, we won't cover everything
in the book.
- Chapter 0 has some information on using this tutorial,
including a discussion of all the example programs, a glossary, and solutions
to selected exercises. Start reading Chapter 1, explaining how a virtual world
is constructed. This should sound a lot like what you learned about VRML in MMK
in the 4th semester. Copy and compile the program HelloJava3Da.java. Note that
you have to include a good many imports statements for this to compile! Can you
figure out why the cube is red?
- Chapter 1.7 tells you about rotating the
cube. Think waaaaay back to Mathematics to remember what degrees of rotation are
and that funny number PI. Copy and compile HelloJava3Db.java, making a slight
rotation on your cube. What would be the difference if you reversed the order
of the multiplication in the specification of the rotation? Alter the program
to see if your answer is correct. There are only two lines of code to change here!
- Just breeze through 1.8 and read 1.9. Try HelloJava3Dc.java and see if
you can get that cube to spin!
- HelloJava3Dd.java puts it all together.
What would be the difference if you reverse the order of the TransformNodes above
the ColorCube in the content branch graph? Alter the program to see if your answer
is correct.
- Chapter 2 goes deeper into using geometry to create worlds.
This is only for the bored! The rest of us skip to
Chapter 3 and skip over to 3.4. Here we meet our old friend, 2D Text, but now
in a 3D context. Copy out Text2DApp.java, compile and run it. Do you have the
font on your system? If all else fails, use Ariel! And now for the crowning touch:
can you get Text3DApp.java to run? Make some cool text and include a snapshot
in your report.
- (only for the bored) Playing
with the BackgroundApp.java example program, if you move far enough away from
the origin of the virtual world, the background disappears. Why does this happen?
If you add another Background object to the BackgroundApp, what will the effect
be?
The URL to your report, which will describe what you did
during the exercise and include links to your code, is due in my email box by
the start of exercise 4. This means Tuesday at 8.00 for Group 1 and Thursday at
12.00 for Group 2. Do not forget to put your names on the report! When you send
the URL to me, include your partner in the CC. That way I don't get either 2 emails
or none, while each thought the other was doing it. And when I answer you, I can
immediately answer both of you without having to look up your preferred email
account.
Debora Weber-Wulff
(weberwu@fhtw-berlin.de)