Specifications

Developers guidelines | 3D graphics with Java ME
31 June 2010
Java ME platform application set up for
Micro3D Ver.3
This section describes how to properly initialise the Micro3D graphics environment
within a mobile application and display 3D graphics with it. Briefly, the proper
sequence of events to configure and use the Micro3D Ver.3 graphics engine is as
follows:
1. Load the 3D model data.
2. Initialise any attributes for the 3D objects of the model.
3. Set up the camera.
4. Set up the light and any effects.
5. Initialise the graphics environment, render the model, and display it.
Load the 3D model data
As stated above, it is far easier to assemble the 3D model by importing 3D object data.
More precisely, when an instance of a Figure is made, its 3D geometric information
and pose is imported from a .mbac file. Any required animation data must be imported
from a .mtra file and stored in an instance of an ActionTable. Finally, if the model
uses texture maps, they are imported from a .bmp file. All of these files are stored as
JAR resources in the MIDlet.
For each 3D object, the following code applies:
// Declare the 3D model elements
Texture texture;
Figure figure;
ActionTable action;
// Load (import) the 3D object data from JAR resources
try {
texture = new Texture( "/texture.bmp", true);
figure = new Figure ( "/figure.mbac" );
action - new ActionTable( "/action.mtra" );
} catch (Exception e) {}
As the code sample shows, importing the data makes the whole process of
constructing the 3D model straightforward and easy.
Initialise the 3D object attributes
The figure geometry, some action information for it, and its textures are loaded. To
associate the action information and texture map with the figure:
//Use this texture with the 3D object
figure.setTexture( texture );