Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues in handling Marks #204

Closed
octavianiLocator opened this issue Oct 17, 2016 · 7 comments
Closed

Issues in handling Marks #204

octavianiLocator opened this issue Oct 17, 2016 · 7 comments

Comments

@octavianiLocator
Copy link

octavianiLocator commented Oct 17, 2016

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
Copy link
Member

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: Destroying and Recreating the Globe #53

Thanks for using Glob3 Mobile!

@octavianiLocator
Copy link
Author

octavianiLocator commented Oct 17, 2016

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
Copy link
Author

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

@DiegoGomezDeck
Copy link
Member

@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
Copy link
Author

Thanks, @DiegoGomezDeck

Setting the "zoomInAppears" effect solved the issue.

@DiegoGomezDeck
Copy link
Member

@octavianiLocator can we close this?

@octavianiLocator
Copy link
Author

@DiegoGomezDeck yes, sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants