Hello
I have been developing an application and had a bug or normal behavior?
Scenario :
I use object pooling pattern in my application, so there are around 10 prepared Object3D instance in my ArrayList.
According to data i have from server, I remove all objects from world and add some objects from my ArrayList to world. Everything works fine but time to time, i have this error.
E/AndroidRuntime: FATAL EXCEPTION: GLThread 122452
Process: anka.ysa.com.test, PID: 28259
java.lang.NullPointerException: Attempt to read from field 'boolean com.threed.jpct.Object3D.oneTextureSet' on a null object reference
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2355)
at com.threed.jpct.World.draw(World.java:1419)
at com.threed.jpct.World.draw(World.java:1102)
at anka.ysa.com.test.TestRenderer.onDrawFrame(TestRenderer.java:48)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1561)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1278)Sample Code :
ArrayList<Object3D> objects = new ArrayList<>();
Object3D modelObject = null;
public void addAndRemoveObjects()
{
while (objects.size() > 0)
{
scene.removeObject(objects.remove(0));
}
if (modelObject == null)modelObject = Primitives.getCube(10);
for (int i = 0; i < 5; i++)
{
Object3D obj = new Object3D(modelObject);
obj.translate(0,0,50);
scene.addObject(obj);
objects.add(obj);
}
}
Sample Application can be found at
https://github.com/SelimAbidin/JPCTBugTestThanks for everything
Y.Selim Abidin