PDA

View Full Version : Using same textures across different GLSurfaceVIews!



v.arjunramaswamy
07-06-2014, 11:54 PM
hi,
I ve different GLSurfaceViews, four of them in a single activity in android. Is it possible to share a texture between all these surfaceviews. I am nt able to use the texture ID generated in one surfaceview in another. So it is creating the same texture in all four and taking 4 times the memory. Is there a sample code or way or somting to adddress this issue?

carsten neumann
07-07-2014, 03:25 AM
I'm not familiar with GLSurfaceView, but presumably each of those create their own OpenGL context. If the API allows it you would have to set things up so that your GLSurfaceViews share the same OpenGL context (or the contexts are configured to share resources [1]). Depending on what you are doing it may be simpler to use one large GLSurfaceView and only render to portions of it using glViewport.

[1] for GLX GLX_ARB_create_context (http://www.opengl.org/registry/specs/ARB/glx_create_context.txt) this is the 'share_context' argument to glxCreateContextAttribsARB