Java Reference
In-Depth Information
image.setViewportWidth(getWidth());
image.setViewportHeight(getHeight());
setActive(active);
} catch(Exception e) {
e.printStackTrace();
} finally {
if(svgStream != null) {
try {
svgStream.close();
} catch(IOException ioe) {}
// ignore
}
}
}
public void setActive(boolean active) {
SVGSVGElement svgDoc = (SVGSVGElement)
image.getDocument().getDocumentElement();
if(active)
svgDoc.setCurrentScale(ACTIVE_SCALE); // bigger
else
svgDoc.setCurrentScale(BASE_SCALE);
// normal
}
8.4.6 Using the Mobile 3D Graphics API (JSR-184)
Entire topics have been written on 3D graphics and there is very little
that can be covered here in a few pages. Before starting, it would be a
good idea to run through some basic online tutorials 9 or even get hold
of [Malizia 2006]. We assume that the reader is familiar with 3D concepts
such as meshes, transforms, cameras, vector mathematics, and so on, and
we do not cover them in detail here.
JSR-184, also referred to as M3G, allows developers to load and
animate 3D assets with very few lines of code. Unlike many other 3D
graphics libraries (such as OpenGL and DirectX), M3G supports two
programming models which can be freely mixed together. In retained
mode, you usually require fewer lines of code to get your content on-
screen, but you do so at the cost of low-level control. Retained mode
operates on the concept of a scene graph where the world is represented
by a tree of nodes with the World node at the root. This includes meshes,
lights, cameras, 3D sprites, and so on. You can also group subsets of
nodes together and operate on the group as a whole.
Immediate mode is more like OpenGL where you send commands
directly to the graphics hardware for execution. You have much more
9 Sony Ericsson has a Mobile 3D Tips, Tricks and Code Archive at developer.
sonyericsson.com/site/global/techsupport/tipstrickscode/mobilejava3d/pmobilejava3d
tips new.jsp . The Sun Developer Network has a 'getting started' article on developers.
sun.com/mobility/apis/articles/3dgraphics .
Search WWH ::




Custom Search