0

In one fragment in my app, I use a GLSurfaceView to render a 3d model. When this Fragment is visible, the user can navigate to another Fragment from it. While that Fragment transition happens, the whole GLSurfaceView turns black.

I started having this problem when I changed from setZOrderOnTop(true) to false. I understand the difference this makes, but It's not possible for me to use setZOrderOnTop(true) (I Have other Views and animations that needs to overlay the GLSurfaceView).

I have tried everything I could think of and everything related from Google searches, such as using backgrounds, hiding the view, replacing it with dummy view during transition etc. without any luck.

Does anyone have an idea how I can solve this?

Notes:

  • I must not use setZOrderOnTop(true)
  • I use Support Fragments
  • I'm currently testing this on a Sony xperia z3, running 6.0 marshmallow
  • The only time I have this issue is when transitioning from the fragment with the GLSurfaceView, not when I transition to it.
  • My Renderer uses glClear(..) to color render the whole view in a white color. My issue is not in the GL Code
Joakim
  • 3,224
  • 3
  • 29
  • 53
  • Can you use a TextureView instead? – fadden Dec 28 '16 at 19:26
  • It was mentioned in one of the related SO Posts. I have never used it before so I don't know if I can yet. But it seems like I will have to try that. Would you recommend it? – Joakim Dec 29 '16 at 16:45
  • TextureView is a View, as opposed to SurfaceView/GLSurfaceView, which have both a View and a Surface. So it generally plays better with other View elements. You will need to do your own EGL context and render thread management though. "Simple GL in TextureView" in [Grafika](https://github.com/google/grafika) provides an example. – fadden Dec 29 '16 at 17:23
  • I think I can handle the manual render threading, but what do you mean with "do your own EGL Context"? I have read that using multiple OpenGL Contexts can come with severe problems on some Android devices, is that what you mean? – Joakim Jan 04 '17 at 09:17
  • GLSurfaceView creates and manages an EGLContext for you. TextureView doesn't. In the Grafika example I referred to above, note the use of the EglCore class. You don't need to use multiple contexts, but you do need the one. :-) – fadden Jan 04 '17 at 20:39
  • Thank you for that. Sounds like it can be done and I will try. – Joakim Jan 05 '17 at 09:22

0 Answers0