java.lang.ArrayIndexOutOfBoundsException: 16 at com.jme3.renderer.IDList.moveToNew(IDList.java:58)

Waht mgiht cause this?:



[java]

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.ArrayIndexOutOfBoundsException: 16

at com.jme3.renderer.IDList.moveToNew(IDList.java:58)

at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1508)

at com.jme3.material.Material.render(Material.java:636)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:390)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:132)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:179)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:525)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:505)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:667)

at com.jme3.renderer.RenderManager.render(RenderManager.java:687)

at online.newhorizons.client.ClientApplication.update(ClientApplication.java:403)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:133)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)

at java.lang.Thread.run(Thread.java:619)

[/java]





Here is the code from the update

[java]

if (speed == 0 || paused) {

return;

}



TimedInvocation.Update();

super.update();

float tpf = timer.getTimePerFrame() * speed;

stateManager.update(tpf);



if (client != null) {

client.Update();

}



if (this.timer.getTimeInSeconds() > nextupdate) {

fixedupdatetick = true;

nextupdate += NHGlobals.TickTime / 1000f;

ConsoleCommands();

}



secondCounter += timer.getTimePerFrame();

int fps = (int) timer.getFrameRate();

if (secondCounter >= 1.0f) {

if (fpsText != null) {

fpsText.setText("Frames per second: " + fps);

secondCounter = 0.0f;

}

}



for (CEntity obj : systemobjects.values()) {

obj.update(tpf);

if (fixedupdatetick) {

obj.fixedUpdates();

}

}



ControllerManager.getInstance().update();

guiNode.updateGeometricState();

guiNode.updateLogicalState(tpf);

rootNode.updateGeometricState();

rootNode.updateLogicalState(tpf);





renderManager.render(tpf);

ViewManager.update(tpf);





this.audioRenderer.update(tpf);

fixedupdatetick = false;

[/java]

I don’t know if it has anything to do with it, but you’re supposed to call updateGeometricState() AFTER updateLogicalState()… I don’t know what all those other update() calls you have.

Does the exception happen at a specific point of time?

Nope this is not it.



Yes the exeption happens after joining the server, in the first frame where there are objects after spawn.

However it does not always occur, sometimes it works without problems



[java]



if (speed == 0 || paused) {

return;

}



TimedInvocation.Update(); //updates the callables, main difference is that i’m avle to specify a time when it will be executed,not just the next frame.



super.update();

float tpf = timer.getTimePerFrame() * speed;

stateManager.update(tpf);



if (client != null) {

client.Update(); //updates network system calls the listerner that spawns/removes updates objects

}



if (this.timer.getTimeInSeconds() > nextupdate) {

fixedupdatetick = true;

nextupdate += NHGlobals.TickTime / 1000f;

ConsoleCommands(); //processes debug console commands

}



secondCounter += timer.getTimePerFrame();

int fps = (int) timer.getFrameRate();

if (secondCounter >= 1.0f) {

if (fpsText != null) {

fpsText.setText("Frames per second: " + fps);

secondCounter = 0.0f;

}

}



for (CEntity obj : systemobjects.values()) {

obj.update(tpf); //updates entitys (mostly only interpolation controllers)

if (fixedupdatetick) {

obj.fixedUpdates(); //frame independent udate called every 50ms

}

}



ControllerManager.getInstance().update(); //updates inputs & camera, sends data to server

guiNode.updateGeometricState();

guiNode.updateLogicalState(tpf);

rootNode.updateGeometricState();

rootNode.updateLogicalState(tpf);



renderManager.render(tpf);

ViewManager.update(tpf);



this.audioRenderer.update(tpf);

fixedupdatetick = false;

[/java]



If necessary I can give you the full source if that helps

Are you adding the objects in the network thread by any chance? Any operations on the scene graph have to happen in the render thread only.

Since you’re saying it only happens sometimes it could indicate a threading issue.

Nope i don’t, thats why I call update there, cause only then stuff is processed.

Uhm, okay. It seems that this issue can be reproduced sometimes, that is good enough. Maybe you can make a test case?