glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
116 stars 56 forks source link

Issues in handling Marks #204

Closed octavianiLocator closed 7 years ago

octavianiLocator commented 7 years ago

Hi guys,

Hope you are all good. We have resumed development on our Android app and now have integrated G3M. The globe is loaded and centered on the current location Mark, showing some Marks around it. When the user moves, Marks therefore need to be added and removed dynamically. Please help us understand why the following 3 issues occur.

1. java.lang.NullPointerException at org.glob3.mobile.generated.MarksRenderer.render(MarksRenderer.java:216) at org.glob3.mobile.generated.CompositeRenderer.render(CompositeRenderer.java:145) at org.glob3.mobile.generated.G3MWidget.rawRender(G3MWidget.java:1015) at org.glob3.mobile.generated.G3MWidget.rawRenderMono(G3MWidget.java:1067) at org.glob3.mobile.generated.G3MWidget.render(G3MWidget.java:207) at org.glob3.mobile.specific.ES2Renderer.onDrawFrame(ES2Renderer.java:63) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

2. E/AndroidRuntime: FATAL EXCEPTION: GLThread 5900 Process: com.pany, PID: 22369 java.lang.IndexOutOfBoundsException: Invalid index 86, size is 86 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at org.glob3.mobile.generated.EffectsScheduler.doOneCyle(EffectsScheduler.java:74) at org.glob3.mobile.generated.G3MWidget.render(G3MWidget.java:200) at org.glob3.mobile.specific.ES2Renderer.onDrawFrame(ES2Renderer.java:63) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

3. java.lang.RuntimeException: OpenGL code executed from a Non-OpenGL thread. (OpenGLThread=Thread[GLThread 5945,5,main], CurrentThread=Thread[main,5,main]) at org.glob3.mobile.specific.NativeGL2_Android.checkOpenGLThread(NativeGL2_Android.java:54) at org.glob3.mobile.specific.NativeGL2_Android.deleteTexture(NativeGL2_Android.java:203) at org.glob3.mobile.generated.GL.deleteTexture(GL.java:253) at org.glob3.mobile.generated.TexturesHandler.releaseGLTextureId(TexturesHandler.java:110) at org.glob3.mobile.generated.TextureIDReference.dispose(TextureIDReference.java:41) at org.glob3.mobile.generated.Mark.dispose(Mark.java:627) at org.glob3.mobile.generated.MarksRenderer.removeAllMarks(MarksRenderer.java:276) at org.glob3.mobile.generated.MarksRenderer.removeAllMarks(MarksRenderer.java:266)

Thank you in advance and wish you a great week!

EDIT The issues seem to occur when removing Marks and when clearing the globe of all Marks.

Add mark: `Mark markM = new Mark(....)

    // Add Mark to MarksRenderer
    `_marksRenderer.addMark(markM);`

Remove Mark: _marksRenderer.removeMark(mark);

Clear globe of all marks: _marksRenderer.removeAllMarks();

Should these methods be called in a G3MContext (the RendererThread)?

mdelacalle commented 7 years ago

Hi octavianiLocator It's a little hard to know what's happening without more information, so if you want assistance you should explain a little more what are you doing. Anyway:

1) NullPointerException --> You are trying to access to something null, review where you are using this MarkerRenderer what's is null here. 2) Same thing, it's and IndexOutBoundsException... so, review your arrays... 3) You are trying to render something with glob3 in the Thread that is Non-OpenGL. You can see a very similar issue here: https://github.com/glob3mobile/g3m/issues/53

Thanks for using Glob3 Mobile!

octavianiLocator commented 7 years ago

Hi @mdelacalle and thanks for your quick reply. I have edited the issue to reflect extra info.

EDIT Looking at issue 2, doesn't it seem that it's caused inside g3m context?

octavianiLocator commented 7 years ago

Which is the recommended method for adding/ removing marks (one by one, or all at once)?

DiegoGomezDeck commented 7 years ago

@octavianiLocator

Please, the next time, fill individual issues per each problem. It's much more complicated to answer several of them in the same issue.

Related to the 2: May be your problem is you're removing the marks before the effect "zoomInAppears" ends. Please try setting this property to false before adding the Mark to the MarksRenderer. Note the method Mark::setZoomInAppears(bool zoomInAppears)

octavianiLocator commented 7 years ago

Thanks, @DiegoGomezDeck

Setting the "zoomInAppears" effect solved the issue.

DiegoGomezDeck commented 7 years ago

@octavianiLocator can we close this?

octavianiLocator commented 7 years ago

@DiegoGomezDeck yes, sure