Header Sep

Mobile Java 3D Tips, Tricks & Code

Score
Login to rate page

January 2006

Use JSR 184 to create a 3D menu

Mobile Java 3D graphics can be used for more than gaming. Here is an example of how a 3D menu can be created using JSR 184.

Download MIDlet and source code>>

  Since the cube has only four menu sides and there are six menu items, we have to change the texture when rotating the menu.
 
To use different textures on the cube we must have an appearance for each side of the cube.
 
Appearance []appearance = new Appearance[6];
 
for(int i=0; i<appearance.length; i++){
    appearance[i] = new Appearance();
    appearance[i].setPolygonMode(polygonMode);
    mesh.setAppearance(i, appearance[i]);
}
  
 
So, to change the texture we can do something like this:

Appearance f,t,b;
 
f = appearance1; // front
t = appearance3; // top
b = appearance4; // bottom
 
f.setTexture(0, texMenu[front]);
t.setTexture(0, texMenu[top]);
b.setTexture(0, texMenu[bottom]);
Score
Login to rate page