jPCT-AE - a 3d engine for Android > Bugs

Null Object Ref. com.threed.jpct.Object3D.oneTextureSet



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:, 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(
                                                                       at com.threed.jpct.World.draw(
                                                                       at com.threed.jpct.World.draw(
                                                                       at android.opengl.GLSurfaceView$GLThread.guardedRun(
                                                                       at android.opengl.GLSurfaceView$

Sample Code :

--- Code: ---ArrayList<Object3D> objects = new ArrayList<>();
    Object3D modelObject = null;
    public void addAndRemoveObjects()
        while (objects.size() > 0)

        if (modelObject == null)modelObject = Primitives.getCube(10);

        for (int i = 0; i < 5; i++)
           Object3D obj = new Object3D(modelObject);

--- End code ---

Sample Application can be found at

Thanks for everything
Y.Selim Abidin

That's not a bug, it's...

Thanks for the answer and it reminded me RTFM  :-X


[0] Message Index

Go to full version