Chapter 28.3.
Playing Movies in a Java 3D World (Part 1)
[ This chapter does not appear in the book. ]
The ability to play a movie clip inside a Java 3D scene opens up
opportunities for richer, more interesting 3D content. A movie
can display more believable backgrounds, such as moving clouds,
a busy city street, or the view out of a window. Movies can be
employed in help screens, or as transitions between game levels.
This article, which is split into two parts, describes how I
implemented a Java 3D movie screen. In this part, I'll explain how
I utilized the
Java Media Framework
(JMF), more specifically the JMF Performance Pack for Windows v.2.1.1e
The other tools in my arsenal were J2SE 5.0 and Java 3D 1.3.2. In part two,
I'll discuss another version of the movie screen, using Quicktime
for Java.
Two screenshots of the JMF Movie3D application are shown at the top
of this page, taken at different times: the one on the right is a
view of the screen from the back.
The important elements of this application are:
- An integration of JMF and Java 3D. There can be multiple screens
in an application, of any size. Since a screen is a subclass of Java 3D's
Shape3D class, it can be easily integrated into different Java 3D scenes.
- The implementation uses the Model-View-Controller design pattern.
The screen is the view element, represented by the JMFMovieScreen
class. The movie is the model part, and is managed by the JMFSnapper
class. A Java 3D Behavior class, TimeBehavior, is the controller,
triggering periodic updates of the movie. All the JMF code is localized
in the JMFSnapper class, making it easier to test and changes. Part two
of this article essentially replaces JMFSnapper by a Quicktime for Java
version called QTSnapper.
- The use of Java 3D performance tricks to speed up rendering. The result
is a movie which runs at 25 frames/second without any difficulty.
- A discussion of the problems I had with JMF, problems which meant that
my preferred solution wouldn't work. JMF has the potential to be a great
API, but beneath its gleaming surface there are some poorly implemented
features lying in wait.
Downloads
Navigation:
Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to my home page