Full HTML for

Basic foilset Java Media Framework API's

Given by Byeongseob Ki, Scott Klasky, Nancy McCracken at Basic Information Track Computational Science Course CPS616 on Spring Semester 1999. Foils prepared May 19 99
Outside Index Summary of Material


The success of Java in providing cross-platform programming support in a browser has led to demand for more complex multi-media support for web-based applications.
We first give a short overview of the Media API's.
The following API's are described in more detail:
  • Java 2D
  • Java 3D

Table of Contents for full HTML of Java Media Framework API's

Denote Foils where Image Critical
Denote Foils where Image has important information
Denote Foils where HTML is sufficient
denotes presence of Additional linked information which is greyed out if missing

1 Java Media API's
2 Suns Java Media Framework page Abstract of Java Media API's
3 Overview of Media API's - I
4 Overview of Media API's - II
5 Overview of Media API's - III
6 Java 2D
7 JavaMedia 2D Resources for Foil 7 What is Java 2D?
8 Java 2D Overview
9 Java 2D Fundamentals
10 Drawing
11 Example
12 Drawing Process
13 Using Java 2D API
14 Drawing a Rectangle with Java 2D
15 Using Java 2D API (cont'd)
16 Rendering
17 Rendering Examples
18 Text and Font
19 Color Management
20 Imaging
21 Imaging Example
22 Imaging Example (cont'd)
23 Graphics Devices
24 Printing
25 To Support Printing
26 Printing Example
27 Java 3D
28 Suns JavaMedia 3D page What is Java 3D?
29 System Requirements
30 User Skill Requirements
31 Java 3D Goals
32 Java3D and VRML working group Java 3D and VRML Working Group
33 Programming Paradigm
34 Scene Graph Basics
35 Scene Graph (DAG)
36 Scene Graph
37 Group and Leaf Node
38 Java 3D Class Hierarchy
39 Java 3D vs VRML
40 VRML example
41 Java 3D example
42 Recipe for Java 3D Program
43 Shape Construction
44 Describing Geometry
45 Describing Appearance
46 Grouping Shapes
47 Controlling Lights
48 Controlling Sounds
49 Controlling Sounds (cont'd)
50 Controlling Fog
51 Controlling Backgrounds
52 Building a Universe
53 Building a Universe (cont'd)
54 View Platforms
55 Creating a View
56 Creating a View (cont'd)
57 Behavior Nodes

Outside Index Summary of Material



HTML version of Basic Foils prepared May 19 99

Foil 1 Java Media API's

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Byeongseob Ki, Scott Klasky,
and Nancy McCracken
Northeast Parallel Architectures Center
Syracuse University
111 College Place
Syracuse, NY 13244-4100

HTML version of Basic Foils prepared May 19 99

Foil 2 Abstract of Java Media API's

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index Suns Java Media Framework page
The success of Java in providing cross-platform programming support in a browser has led to demand for more complex multi-media support for web-based applications.
We first give a short overview of the Media API's.
The following API's are described in more detail:
  • Java 2D
  • Java 3D

HTML version of Basic Foils prepared May 19 99

Foil 3 Overview of Media API's - I

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 2D:Provides an abstract imaging model that extends the JDK AWT package, including line art, images, color, transforms, and compositing
Java Media Framework: Specifies a unified architecture, messaging protocol, and programming interface for media players, media capture, and conferencing; Comprises three separate packages
  • Java Media Player
  • Java Media Capture
  • Java Media Conference

HTML version of Basic Foils prepared May 19 99

Foil 4 Overview of Media API's - II

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java Collaboration: Allows for interactive, two-way, multi-party communications over a variety of networks
Java Telephony: Integrates telephones with computers and provides basic functionality for first-party and third-party call control
Java Speech: Provides Java based speech recognition and speech synthesis (text-to-speech)

HTML version of Basic Foils prepared May 19 99

Foil 5 Overview of Media API's - III

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java Animation: Provides for motion and transformations of 2D objects while utilizing the Java Media Framework for synchronization, composition, and timing
Java 3D: Provides an abstract, interactive imaging model or behavior and control of 3D objects

HTML version of Basic Foils prepared May 19 99

Foil 6 Java 2D

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Basic Concepts and Examples

HTML version of Basic Foils prepared May 19 99

Foil 7 What is Java 2D?

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index JavaMedia 2D Resources for Foil 7
The Java 2D is a set of Java 1.2 core classes that
  • extend the AWT to provide a standard, cross-platform interface for handling complex shapes, text, and images
  • Enhance graphics, text, and image capabilities of AWT
The Java 2D API
  • Enables high-quality device and resolution independent graphics
  • Supports enhanced font and text handling
  • Provides a single, comprehensive rendering model
http://www.javasoft.com/products/java-media/2D/
http://java.sun.com/products/jdk/1.2/docs/guide/2d/

HTML version of Basic Foils prepared May 19 99

Foil 8 Java 2D Overview

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Provides richer graphics, font, and image APIs
Supports enhanced color definition and composition, hit detection on arbitrary geometric shapes and text, and a uniform rendering model for printers and display devices
Enables the creation of advanced graphics libraries in Java, such as CAD/CAM and imaging special effects
Can be used to create and display animations and other multimedia presentations

HTML version of Basic Foils prepared May 19 99

Foil 9 Java 2D Fundamentals

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 2D API defines two coordinate spaces: User Coordinate Space and Device Coordinate Space
Java 2D API enhances the functionality of AWT by implementing new methods in existing classes, while extending existing classes and interfaces
(0,0)
x
y
The origin of User Coordinate Space lies in the upper left corner increasing to the right and downward

HTML version of Basic Foils prepared May 19 99

Foil 10 Drawing

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
The basic graphics rendering model has not changed with the addition of Java 2D
The Java 2D API class Graphics2D extends the Graphics class to support more graphics attributes and provide new rendering methods
Java 2D API uses the drawing model defined by the java.awt package
In this model, each Component object implements a paint(...) method that is invoked automatically whenever the component needs to be drawn

HTML version of Basic Foils prepared May 19 99

Foil 11 Example

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Example: Suppose you have a component whose job it is to draw a red rectangle
  • Using the AWT drawing model:
public void paint( Graphics g ) {
g.setColor( Color.red );
g.fillRect( 300, 300, 200, 100 );
}

HTML version of Basic Foils prepared May 19 99

Foil 12 Drawing Process

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
The basic drawing process:
  • 1. Specify the rendering attribute for the shape you want to draw and invoke a method such as setColor(...)
  • 2. Define the shape you want to draw
  • 3. Use the Graphics object to render the shape by calling a rendering method such as fillRect(...)
Java 2D provides additional features for:
  • specifying paint styles
  • defining complex shapes
  • controlling the rendering process

HTML version of Basic Foils prepared May 19 99

Foil 13 Using Java 2D API

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
To use Java 2D, implement a paint(...) method and cast the Graphics argument to a Graphics2D object
The following example demonstrates how you could use the Java 2D API to draw a red rectangle
  • The basic process for drawing the rectangle with Java 2D API is the same as with java.awt, except the usage of GeneralPath to define rectangle.
Graphics2D g2d = (Graphics2D) g;

HTML version of Basic Foils prepared May 19 99

Foil 14 Drawing a Rectangle with Java 2D

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
public void paint( Graphics g ) {
Graphics2D g2d = ( Graphics2D ) g;
g2d.setColor( Color.red );
GeneralPath rect = new GeneralPath( GeneralPath.EVEN_ODD );
rect.moveTo( 300.0f, 300.0f ); // ul corner
rect.lineTo( 500.0f, 300.0f ); // ur corner
rect.lineTo( 500.0f, 400.0f ); // lr corner
rect.lineTo( 300.0f, 400.0f ); // ll corner
rect.closePath(); // close the rectangle
g2d.fill( rect );
}

HTML version of Basic Foils prepared May 19 99

Foil 15 Using Java 2D API (cont'd)

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
To simplify the creation of standard shapes such as rectangles, Java 2D provides several subclasses of Shape in addition to GeneralPath:
In addition to supporting solid color fills, Java 2D enables you to specify complex fills such as gradients and patterns
Rectangle2D.Double rect = new Rectangle2D.Double( 300, 300, 200, 100 );

HTML version of Basic Foils prepared May 19 99

Foil 16 Rendering

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Graphics2D defines methods for drawing objects and state attributes to control rendering
With state attributes, you can
  • Set a clipping path to limit the area that is rendered
  • Define colors and patterns to fill shapes
  • Vary the stroke width
  • Change how strokes are joined together
  • Specify how multiple graphics objects should be composed

HTML version of Basic Foils prepared May 19 99

Foil 17 Rendering Examples

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Complex Paint Style
Compositing
Stroke Styles

HTML version of Basic Foils prepared May 19 99

Foil 18 Text and Font

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 2D adds new text-related classes that support sophisticated text layout and fine-grain font control
Java 2D provides an enhanced Font class that supports:
  • Specification of detailed font information
  • Access to information about a font and its glyphs
A transform is used to generate a skewed version of the font before the string is drawn

HTML version of Basic Foils prepared May 19 99

Foil 19 Color Management

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 2D provides support for high-quality color output
The key color management classes in Java 2D:
  • Color --- describes a color in terms of its components
  • ColorModel --- provides methods to convert the components of a pixel in an image into color components in a color space
  • ColorSpace --- provides methods for converting color components in a color space to and from CIEXYZ or RGB color space
http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html

HTML version of Basic Foils prepared May 19 99

Foil 20 Imaging

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 2D provides a set of classes that define operations on BufferedImage and Tile objects
  • BufferedImage extends java.awt.Image and allows you to access individual pixels in an image
  • Tile defines the data and data layout within an image
Image Processing Model
Source image
Destination image
Image processing
Filter

HTML version of Basic Foils prepared May 19 99

Foil 21 Imaging Example

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Edge detection and enhancement

HTML version of Basic Foils prepared May 19 99

Foil 22 Imaging Example (cont'd)

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Lookup-table Manipulation

HTML version of Basic Foils prepared May 19 99

Foil 23 Graphics Devices

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
GraphicsDevice
  • Represents an actual output device such as a monitor or printer
  • Encapsulates a device's capabilities and attributes
GraphicsEnvironment
  • Provides information about a list of GraphicsDevice
  • Encapsulates the text capabilities of a system
GraphicsConfiguration
  • Determines the capabilities of GraphicsDevice

HTML version of Basic Foils prepared May 19 99

Foil 24 Printing

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
The Java 2D Printing API defines three key printing abstractions:
  • Printable --- the interface that an application implements to provide the mechanism through which a document may be rendered to a printer
  • Book --- the collection of pages to be printed
  • PrintJob --- the object through which the application initiates printing

HTML version of Basic Foils prepared May 19 99

Foil 25 To Support Printing

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
1. Implement the Printable interface and provide the mechanism for imaging a page in a print(...) method
2. Provide a way for the user to trigger the print operation such as button click
3. When the user initiates printing, your application should:
  • Create a Book
  • Add the pages to be printed to the Book
  • Create a PrintJob object
  • Call print on the PrintJob object

HTML version of Basic Foils prepared May 19 99

Foil 26 Printing Example

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Illustrates a Book containing two letter size pages in portrait orientation, a legal size page in landscape orientation, and a tabloid size page in portrait orientation

HTML version of Basic Foils prepared May 19 99

Foil 27 Java 3D

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Basic Concepts and Examples

HTML version of Basic Foils prepared May 19 99

Foil 28 What is Java 3D?

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index Suns JavaMedia 3D page
Java 3D is a set of classes for writing three-dimensional graphics applications and applets
It is primarily for application developers
It enables authors to build 3D models and control animation and interaction
It also enables detailed control over rendering, input devices, the viewing model, and lots more
API implementation released by Sun Microsystems
http://java.sun.com/products/java-media/3D/

HTML version of Basic Foils prepared May 19 99

Foil 29 System Requirements

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Current version is 1.1
Java 3D requires JDK1.2:

HTML version of Basic Foils prepared May 19 99

Foil 30 User Skill Requirements

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
The developer must have at least a basic knowledge of the principles of computer graphics:
  • Graphics displays and systems
  • The mathematics of computer graphics
  • Computer graphics algorithms
The developer must possess a thorough understanding of the OOP paradigm
The prospective developer should read and analyze the Java 3D specification located at http://java.sun.com/products/java-media/3D/

HTML version of Basic Foils prepared May 19 99

Foil 31 Java 3D Goals

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
High performance
  • Layered implementation to take advantage of low-level rendering that might be available such as OpenGL, Direct3D, and QuickDraw3D
Rich set of features for creating interesting 3D worlds
  • 3D geometric primitives, sound, lighting, shading and advanced behavioral model
Provide a high-level, object-oriented paradigm that enables developers to rapidly deploy sophisticated applications and applets
Support for runtime loaders to accommodate a wide variety of file formats such as CAD and VRML

HTML version of Basic Foils prepared May 19 99

Foil 32 Java 3D and VRML Working Group

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index Java3D and VRML working group
The goal of this group is to improve interoperability between Java3D and VRML, and to maintain and extend the open source Java3D-based VRML97 browser.
http://www.web3d.org/WorkingGroups/vrml-java3d
The advantage of Java based VRML renderer is that it will run in any browser without a plug-in. The disadvantage is that the renderer is not as fast as the VRML plug-ins such as Cosmoplayer was, unless you have an underlying low-level renderer such as OpenGL.

HTML version of Basic Foils prepared May 19 99

Foil 33 Programming Paradigm

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Scene Graph Programming Model
  • A tree-like hierarchy of graphic nodes and groups
Rendering Modes
  • Immediate Mode, Retained Mode, Compiled-Retained Mode
Extensibility
  • Java 3D does not have built-in support for: primitive geometry (box, cone, cylinder, sphere), specialized geometry (elevation grid, extrusion), etc.
  • All of these can be implemented on top of Java 3D

HTML version of Basic Foils prepared May 19 99

Foil 34 Scene Graph Basics

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Scene graph superstructure:
  • A VirtualUniverse contains everything to be drawn
    • All Java 3D scene graphs must connect to a Virtual Universe object to be displayed
  • A Locale defines the origin, in high-resolution coordinates, of its attached branch groups
A scene graph itself starts with BranchGroup nodes
A BranchGroup serves as the root of a subgraph, called a branch group, of the scene graph---only BranchGroup objects can attach to Locale objects

HTML version of Basic Foils prepared May 19 99

Foil 35 Scene Graph (DAG)

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index

HTML version of Basic Foils prepared May 19 99

Foil 36 Scene Graph

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
A scene graph consists of Java 3D objects, called nodes, arranged in a tree structure
The user creates one or more scene subgraphs and attaches them to a virtual universe
A Java 3D scene graph is a directed acyclic graph (DAG), which may not contain cycles
Java 3D refines the Node object class into two subclasses: Group and Leaf node objects

HTML version of Basic Foils prepared May 19 99

Foil 37 Group and Leaf Node

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Group node objects group together one or more child nodes. A group node can point to zero or more children but can have only one parent
Leaf node objects contain the actual definitions of shapes (geometry), lights, fog, sounds, and so forth
A leaf node has no children and only one parent

HTML version of Basic Foils prepared May 19 99

Foil 38 Java 3D Class Hierarchy

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D defines a hierarchy of classes:
Object
SceneGraphObject
Node
Group
Leaf
NodeComponent
Appearance
Geometry
...
Transform3D
...

HTML version of Basic Foils prepared May 19 99

Foil 39 Java 3D vs VRML

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D has richer semantics for scoping lights, sound, fog, behaviors, and backgrounds
Java 3D and VRML share similar notions of:
  • Shapes
  • Appearance
  • Material
  • Grouping
  • Transform
  • Lighting
Example: Create a red 3D text shape "Hello World"

HTML version of Basic Foils prepared May 19 99

Foil 40 VRML example

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Shape {
appearance Appearance {
material Material {
diffuseColor 1.0 0.0 0.0
}
}
geometry Text {
string "Hello world"
fontStyle FontStyle { }
}
}

HTML version of Basic Foils prepared May 19 99

Foil 41 Java 3D example

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Material blue = new Material( );
blue.setDiffuseColor( 0.0, 0.0, 1.0 );
Appearance color = new Appearance( );
color.setMaterial( blue );
Text3D hello = new Text3D( );
hello.setFont3D( someFont );
hello.setString( "Hello world" );
Shape3D sign = new Shape3D( );
sign.setGeometry( hello );
sign.setAppearance( color );

HTML version of Basic Foils prepared May 19 99

Foil 42 Recipe for Java 3D Program

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Every Java 3D application has five tasks:
  • Create 3D shapes
  • Create content behaviors
  • Set up the 3D canvas (drawing area)
  • Configure viewing
  • Create navigation behaviors
In VRML, the last three are performed by the browser and cannot be fully controlled by a VRML script

HTML version of Basic Foils prepared May 19 99

Foil 43 Shape Construction

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
The Java 3D Shape3D leaf node creates a 3D shape with geometry and appearance node components
Text3D geometry node component creates extruded 3D text in this example
Shape3D sign = new Shape3D( );
sign.setGeometry( hello );
sign.setAppearance( color );

HTML version of Basic Foils prepared May 19 99

Foil 44 Describing Geometry

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Most Java 3D geometry node components handle triangles and quads implicit or explicit (indexed) connectivity strips, fans, and arbitrary polygon collections: LineArray, PointArray, QuadArray, LineStripArray, TriangleFanArray, etc.
VRML's primitive and specialized geometry can be implemented using Java 3D geometry arrays
The Java 3D Raster geometry node component enables pixel read and write to the screen at a transformed location

HTML version of Basic Foils prepared May 19 99

Foil 45 Describing Appearance

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Detailed rendering control is available with Java 3D's attribute node components:
Java3D Controls
ColoringAttributes Shading model
LineAttributes Line width and pattern
PointAttributes Point size
PolygonAttributes Polygon culling
RenderingAttributes Z- and alpha-buffering
TextureAttributes Transforms and rendering type
TransparencyAttributes Transparency type

HTML version of Basic Foils prepared May 19 99

Foil 46 Grouping Shapes

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java3D has a set of nodes to create groups: OrderedGroup, Switch, TransformGroup, etc.
Java 3D supports numerous utility methods to build and manipulate 4x4 matrices and vectors:
Transform3D yAxis = new Transform3D( );
yaxis.roty( 0.785 );
TransformGroup scene = new TranformGroup( );
scene.addChild( sign );
scene.setTransform( yaxis );

HTML version of Basic Foils prepared May 19 99

Foil 47 Controlling Lights

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Like VRML, Java 3D has a set of leaf nodes to create and manipulate lights:
Light
AmibientLight
DirectionalLight
PointLight
SpotLight
PointLight bulb = new PointLight( );
bulb.setColor( yellow );
bulb.setPosition( 0.0, 5.0, 3.0 );

HTML version of Basic Foils prepared May 19 99

Foil 48 Controlling Sounds

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D has a set of leaf nodes to add sounds:
Sound
BackgroundSound
PointSound
ConeSound
Soundscape
AuralAttributes
MediaContainer
PointSound ouch = new PointSound( );
ouch.setPosition( 0.0, 3.0, 8.0 );
ouch.setSoundData( ouchSound );
ouch.setLoop( 1 );

HTML version of Basic Foils prepared May 19 99

Foil 49 Controlling Sounds (cont'd)

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Sounds are scheduled only if their bounding volume intersects the viewer's activation volume
The Java 3D Soundscape leaf node and AuralAttributes node component specify environment characteristics such as Reverberation, Echo, Frequency filtering, and Doppler effects
Different parts of the world can have different characteristics
  • Aural effects are bound via a bounding volume or leaf

HTML version of Basic Foils prepared May 19 99

Foil 50 Controlling Fog

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D has a typical set of fog nodes much like their VRML counterparts:
Fog
ExponentialFog
LinearFog
LinearFog murky = new LinearFog( );
murky.setColor( 0.8, 0.8, 0.8 );
murky.setFrontDistance( 0.0 );
murky.setBackDistance( 10.0 );

HTML version of Basic Foils prepared May 19 99

Foil 51 Controlling Backgrounds

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
The Background leaf node defines either a solid color or a background image used to fill the window
A Background node is active when its application region intersects the viewer's activation volume
If no Background nodes are active, then the window is cleared to black
Background mountains = new Background();
mountains.setColor( 0.0, 0.5, 1.0 );
mountains.setGeometry( mountainWorld );

HTML version of Basic Foils prepared May 19 99

Foil 52 Building a Universe

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D VirtualUniverse object builds a "universe"
Locale object creates a world anchor point within a universe
VirtualUniverse universe = new VirtualUniverse();
Locale locale = new Locale( universe );

HTML version of Basic Foils prepared May 19 99

Foil 53 Building a Universe (cont'd)

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
A Java 3D BranchGroup node groups world scene graphs together and binds them to a locale
BranchGroup world = new BranchGroup( );
world.addChild( part_of_world );
locale.addBranchGroup( world );

HTML version of Basic Foils prepared May 19 99

Foil 54 View Platforms

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Once a universe is created, it may be viewed
Java 3D ViewPlatform leaf node establishes a viewpoint for the universe
  • TransformGroup node is used to move the viewpoint for user navigation
ViewPlatform spot = new ViewPlatform( );
TransformGroup navigate = new TransformGroup( );
navigate.addChild( spot );

HTML version of Basic Foils prepared May 19 99

Foil 55 Creating a View

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D View object describes camera features to view the universe from a view platform:
View camera = new View( );
camera.setFieldOfView( 0.785 );
camera.setFrontClipDistance( 0.1 );
camera.setBackClipDistance( 50.0 );
camera.setSceneAntialiasingEnabled( true );
camera.attachViewPlatform( spot );

HTML version of Basic Foils prepared May 19 99

Foil 56 Creating a View (cont'd)

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
Java 3D View also supports detailed specification of the real-world viewing situation
  • Physical body characteristics:
    • Left and right eye positions
    • Left and right ear positions
    • Eye height
  • Physical environment characteristics:
    • Speaker positions
    • Headphone vs speakers
    • Head tracker characteristics

HTML version of Basic Foils prepared May 19 99

Foil 57 Behavior Nodes

From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. *
Full HTML Index
A behavior node consists of a
  • scheduling region - this is the volume within which the behavior node is active (and if it is also within the activation region of the ViewPlatform.
  • initialization method specifies initial wakeup conditions.
  • stimulus method receives and processes messages from other nodes, it the behavior node is active and satisfies its wakeup criteria.

© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Mon Jul 5 1999