Java Reference
In-Depth Information
mGraphics3D.resetLights();
mGraphics3D.addLight(mLight, mTransform);
mAngle += 1.0f;
mTransform.setIdentity();
mTransform.postRotate(mAngle, 0, 0, 1.0f );
mGraphics3D.render(mVertexBuffer, mIndexBuffer,
mAppearance, mTransform);
mGraphics3D.releaseTarget();
flushGraphics();
try {Thread.sleep(40); }
catch(InterruptedException ie){
}
}
} // of while
} // of run()
}
You can probably write your own
TriangleMIDlet
to contain the
TriangleCanvas
. The one
used for this example is reproduced in Listing 15-2.
Listing 15-2.
TriangleMIDlet to Contain the TriangleCanvas
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
public class TriangleMIDlet extends MIDlet implements CommandListener {
private Display mDisplay = null;
private TriangleCanvas mCanvas = null;
private Command exitCommand = new Command("Exit", Command.ITEM, 1);
public TriangleMIDlet() {
super();
mDisplay = Display.getDisplay(this);
mCanvas = new TriangleCanvas();
mCanvas.setCommandListener(this);
mCanvas.addCommand(exitCommand);
}
public void startApp() {
mCanvas.init();
mDisplay.setCurrent(mCanvas);
mCanvas.start();
}
Search WWH ::
Custom Search