Motorola maxx V6 manual Draft Subject to Change 105/201, Using the Graphics3D object

Models: maxx V6

1 201
Download 201 pages 31.32 Kb
Page 105
Image 105

Java ME Developer Guide

Chapter 13 - JSR-184 - Mobile 3D Graphics API

public void startApp() throws MIDletStateChangeException

{

myDisplay.setCurrent(myCanvas);

try

{

// Load a file.

Objects3D[] roots = Loader.load(getAppProperty("Content-1"));

//Assume the world is the first root node loaded. myWorld = (World) roots[0];

}

catch(Exception e)

{

e.printStackTrace();

}

//Force a repaint so the update loop is started. myCanvas.repaint();

}

Code Sample 4 Initializing the world

13.4.4 Using the Graphics3D object

Using the Graphics3D is very straightforward. Get the Graphics3D instance, bind a target to it, render everything, and release the target.

public class myCanvas extends Canvas

{

Graphics3D myG3D = Graphics3D.getInstance();

public void paint(Graphics g)

{

myG3D.bindTarget(g);

try

DRAFT - Subject to Change [105/201]

Page 105
Image 105
Motorola maxx V6 manual Draft Subject to Change 105/201, Using the Graphics3D object