Java Reference
In-Depth Information
Also within the loop of the run() method is code to poll the keyboard and then move the
Camera accordingly.
Summary
This chapter describes the Mobile 3D Graphics, or M3G, optional API specified by JSR 184. M3G,
which brings powerful 3D rendering capability to mobile devices, has a high-level retained
mode and a lower-level immediate mode of operation. Using the M3G API, you can render 3D
graphics to a 2D MIDP component such as a Canvas by binding to the singleton Graphics3D
instance.
In immediate mode, Graphics3D controls Lights for illuminating 3D scene and Camera to
determine the portion of the scene that is displayed. You can create 3D meshes by specifying
an array of triangle strips using the TriangleStripArray class. Each triangle strip contains
vertices that describe a set of adjoining triangles. VertexArray is used to contain the vertices
information, while a VertexBuffer holds associated normals as well as texture coordinates. An
Appearance object can be associated with a triangle strip; it controls the material, culling, and
texture map used during 3D rendering. A 3D object can be moved within the 3D scene by
defining a Transform . A Transform provides scaling, translation, and rotation for a 3D object.
Retained mode allows a prefabricated 3D world to be loaded from a standard .m3g file. The
entire world can be animated and rendered using the high-level retained mode API. In addition,
the objects inside the world can be located and manipulated using immediate mode API calls.
Search WWH ::




Custom Search