hm.
I'm sure you're getting fed up of this by now. But I believe there is still another bug regarding scaling (or possibly my code).
My main rendering loop looks like this:
while (true)
{
buffer.clear();
theWorld.renderScene(buffer);
theWorld.draw(buffer);
buffer.update();
buffer.displayGLOnly();
}
I have a Java GUI which can set the scale of an object via the functions:
getLevel().disableLazyTransformations();
getLevel().setScale(Float.parseFloat(scale));
getLevel().rotateMesh();
getLevel().setScale(1.0f);
getLevel().calcNormals();
rebuildOctree(getLevel());
Occasionally, seemingly randomly, when I set the scale of a loaded object, I get the following exception:
Exception in thread "main" java.lang.NullPointerException
at com.threed.jpct.Object3D.render(Unknown Source)
at com.threed.jpct.World.renderScene(Unknown Source)
at MainWindow.mainLoop(MainWindow.java:217)
Where line 217 of MainWindow refers to the line theWorld.renderScene(buffer); (above).
Now the weird bit here is that if theWorld was null, the exception stack wouldn't show entries for Object3D.render and World.renderScene (I believe) and buffer cannot be null, because the previous line uses the buffer object.
My previous investigations suggested that *something* to do with scaling caused buffer to be set to null, but I couldn't for the life of me manage to narrow it down.
Any ideas? It seems non deterministic, so I can only assume it's some kind of synchronisation error between my Java GUI affecting an item and perhaps messing up the buffer as the buffer is being accessed by that function but immediately after the clear() function?