Author Topic: Hello World - Demo  (Read 547 times)

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Hello World - Demo
« on: March 27, 2018, 02:34:37 pm »
Hello All,

I am teaching Android UI development at a college in Canada and I would like to provide a very simplified demo of JPCL. It is not part of the curriculum but I thought that would be nice demo.

The idea was inspired on Prof. Giovanni Malnati  video:
https://youtu.be/6SLz7tMBA8k

However, I am having a hard time to make my demo to work. The App crashes while creating a framebuffer object. I tried GL ver 1 and a couple of other things and did not help. Following is the link for my App; in case someone would have some time to help would be great.

https://drive.google.com/open?id=1rAW3ybhmK9lNBX7wTG3dZ1bhu_2L-SWI


Thanks in advance,
Marcelo Varanda

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11968
    • View Profile
    • http://www.jpct.net
Re: Hello World - Demo
« Reply #1 on: March 29, 2018, 09:01:19 pm »
I can't check out the code ATM...but it might help to know what kind of crash (stack trace) you are getting.

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Re: Hello World - Demo
« Reply #2 on: March 30, 2018, 03:46:01 pm »
Thanks Egon,

It crashes in different places each time I run. If I process step by step in debugging it runs fine sometimes. It is like a thread is using something that it is not ready yet.

Once it crashed here:



03-30 13:16:28.290 4119-4140/? W/jPCT-AE: [ 1522415788290 ] - WARNING: State: 0/0/0/0/0/0/0
03-30 13:16:28.300 4119-4140/? E/AndroidRuntime: FATAL EXCEPTION: GLThread 1210
                                                 Process: com.marcelo.a3demo01, PID: 4119
                                                 java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
                                                     at com.threed.jpct.CompiledInstance._fill(CompiledInstance.java:1226)
                                                     at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:847)
                                                     at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:168)
                                                     at com.threed.jpct.World.compile(World.java:2109)
                                                     at com.threed.jpct.World.renderScene(World.java:1067)
                                                     at com.marcelo.a3demo01.MainActivity.onDrawFrame(MainActivity.java:108)
                                                     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
                                                     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
03-30 13:16:28.407 4119-4141/? D/EGL_emulation: eglMakeCurrent: 0xa3f47c40: ver 2 0 (tinfo 0xa3f0b1b0)


    @Override
    public void onDrawFrame(GL10 gl10) {
        fb.clear();
        world.renderScene(fb); // this is the line 108
        world.draw(fb);
        fb.display();
    }


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11968
    • View Profile
    • http://www.jpct.net
Re: Hello World - Demo
« Reply #3 on: March 30, 2018, 06:25:52 pm »
Looks like as if you are fiddling around with jPCT-AE related objects in a separate thread like the one that handles the touch input (for example: Adding an object on touch to the world). If that's the case: Don't do that. jPCT-AE isn't thread safe. You either have to synchronize these parts or, and IMHO better, do it in the rendering thread instead.