3d Rendering with SonyEricsson Simulator

Hi, My game runs without any particular issues with Sun WTK22

I then tried to make it work with the sony ericsson WTK2, but when it renders the 3d world, i always have the same exception:

java.lang.IllegalStateException
at javax.microedition.m3g.Util3D.throwEx(+79)
at javax.microedition.m3g.Graphics3D.render

First of all, what is Utils3D class used for? (Sun WTK22 doens`t have such class in his m3g implementation)

Here is my code to render the world:

(in my test doAnimate() returns false)

Code:

try {
iG3D.bindTarget(g);
if (doAnimate()) {
// advance the animation
world.animate((int)(System.currentTimeMillis() - gameStart));
}

        iG3D.render(world);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        iG3D.releaseTarget();
    }

Thanks a lot for your help.
Bests,
Franck

http://cazapool3d.sourceforge.net/mobipool3d/3DShoot4_DivXCodec.avi
http://cazapool3d.sourceforge.net/mobipool3d/3DShoot5_MicrosoftCodec.avi.avi

the active camera is added in the world?

yes it is, here is the piece of code:

protected void buildScene() {
world = buildWorld();
world.setActiveCamera(mobileCamera.getCamera());

}

you have to add the camera to the world before setActiveCamera

Mik
www.miklabs.com

this is what i do, here is the exact piece of code:

protected void buildScene() {
world = buildWorld();
addCamera();
addLights();
}

private void addCamera() {
mobileCamera = buildDefaultMobileCamera();
getWorld().addChild(mobileCamera.getCameraGroup());
getWorld().setActiveCamera(mobileCamera.getCamera());
mobileCamera.initPosition();
}

I FOUND IT, I FOUND IT, I FOUND IT!!!

here is jsr184 spec about VertexBuffer:


All vertex attribute arrays are initialized to null. The application can also set them to null at any time. This is a completely legal state, as long as the VertexBuffer is not rendered or tested for intersection with a pick ray. When rendering, null vertex attributes are treated as follows:

* If the position array is null, an exception is thrown.
* If the normal array is null, and lighting is enabled, an exception is thrown.
* If a texcoord array is null, and the corresponding texturing unit is enabled, an exception is thrown.
* If the color array is null, the default color is used instead.

Lighting can be disabled for a submesh by setting a null Material in Appearance. Similarly, a particular texturing unit can be turned off by setting its Texture2D to null.

My issue comes from the appearance that holds a material. I removed the material on the appearance (i’m using on my Mesh) and BINGO, it works!!! (by setting a null material to my appearance)

So basically the issue doesn’t come from SE WTK, but more from Sun WTK that allows too much things, and which doesn’t throw an exception where it should…

Thanks for all your support,
Franck