Skip to content

Fatal Exception: Error loading texture #3

Description

@ParkSangGwon

I got error report from this library.
how can I fix or check code?
is this bug?
I thik this error is not appear all time.
some device occur error

Fatal Exception: java.lang.RuntimeException: Error loading texture.
at com.yalantis.starwars.utils.gl.TextureHelper.loadTexture(TextureHelper.java:53)
at com.yalantis.starwars.render.StarWarsRenderer$2.run(StarWarsRenderer.java:290)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1471)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

Activity

  1. defHLT commented on Jan 7, 2016

    @defHLT
    Contributor

    It occurs when texture can't be generated because of a trashed OpenGL context. One way it can happen when mTilesFrameLayout.startAnimation() is called after mTilesFrameLayout.onPause(). Do you work on your own example? If so please check your onResume/onPause calls or share your code if problem persists. If you're getting this error when running provided demo sample then please share more detailed steps and I'll try to reproduce it.

  2. ParkSangGwon commented on Jan 8, 2016

    @ParkSangGwon
    Author

    ok. I will add some code.
    when mTilesFrameLayout.startAnimation() is called, I will check mTilesFrameLayout's state ( already onPause() or not )

    and I will add try/catch block like this

            if(tiles_frame!=null){
    
                try {
                    tiles_frame.startAnimation();
                }catch(Exception e){
                    finish();
                    overridePendingTransition(0, 0);
                }
    
            }
  3. bradmartin commented on Feb 18, 2016

    @bradmartin

    I'm working on taking this library and integrating a plugin for NativeScript and I get the same error when I call .startAnimation() on the instance of TilesFrameLayout view. The app isn't pausing so it's likely some app life cycle that NativeScript implements just not certain. I load the view and then on a click (tap) event I get a reference to the view and call .startAnimation() so I'm not sure about onPause() being called.

  4. defHLT commented on Feb 18, 2016

    @defHLT
    Contributor

    @bradmartin the only was I can reproduce it if I comment out mTilesFrameLayout.onResume(); call in demo app and then go from and back to activity. That would cause GL thread to pause and texture loading would throw an error unless thread will be resumed before that. Can't think of another reason for this crash right now. Could you debug and ensue onResume call is really happening in right time?

  5. defHLT commented on Feb 18, 2016

    @defHLT
    Contributor

    @bradmartin the only way I can reproduce it if I comment out mTilesFrameLayout.onResume(); call in demo app and then go from and back to activity. That would cause GL thread to pause and texture loading would throw an error unless thread will be resumed before that. Can't think of another reason for this crash right now. Could you debug and ensue onResume call is really happening in right time?

  6. reopened this on Feb 18, 2016
  7. bradmartin commented on Feb 22, 2016

    @bradmartin

    @mlatu - I've called onResume() and everything seems fine. Can any view be in the layout? I think the bitmap is not being passed correctly to the TextureHelper which is where the RunTimeException is thrown (line 53).

  8. defHLT commented on Feb 22, 2016

    @defHLT
    Contributor

    @bradmartin Yes, any view can be in the layout. If there are several views - just wrap it in any ViewGroup.

    Exception at line 53 is thrown if glGenTextures failed to do its job. It usually happens when there is no OpenGL context available. At this point it never even tries to work with the bitmap because glGenTextures fails. Could you call

    int err = GLES20.glGetError();
    String msg = GLUtils.getEGLErrorString(err);
    

    just before the throw (after glGenTextures) and see what's the results?

    I would do that but I don't have your setup

  9. bradmartin commented on Feb 22, 2016

    @bradmartin

    Working on adding this, android/java are not my specialites so I'm having a time including a forked repo into my project. If I knew the correct way to create a .jar file for this library then I could figure it out but for some reason my .jar files I generate aren't working correctly.

  10. TeeRawk commented on Mar 14, 2017

    @TeeRawk

    Hello @bradmartin ,so does this worked for you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions