Several EAGLViews, but only one copy of each texture - how?

I have an application running on an iPad that uses many textures, rendering in one EAGLView. Now I need a second EAGLView, an exchange of textures with the first.

I can get both rendering views perfectly, in parallel, on the screen, fixing some design errors in the Apple code (for example, by default, the ViewController needs some settings to support several EAGLView child objects). But I can not get the texture to share.

I can’t duplicate textures (to double the memory usage - and we already use most of mem).

I can’t find any documentation from Apple on how to distribute textures between several EAGLViews - there are β€œhints” that this is what EAGLShareGroup is for, which allows each GLView to have its own context, but two contexts for sharing a ShareGroup - but nothing obvious that I could find.

I tried to answer this question: Textures are not drawn if multiple EAGLViews are used

... but that was not quite the answer. He pointed to EAGLSharegroup, without actually explaining how to use it - it seems to make no difference. He also indirectly pointed to a page about rendering from multiple threads - this is a completely different problem, and I don't have any problems listed there (application crashes, etc.).

+3
2

, Apple EAGLShareGroup (http://developer.apple.com/library/ios/#documentation/OpenGLES/Reference/EAGLSharegroup_ClassRef/Reference/EAGLSharegroup.html)... (-) .

, - , EAGLContext , .

, :

EAGLShareGroup *group = [[EAGLShareGropu alloc] init];
EAGLContext *context1 = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:group];
EAGLContext *context2 = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:group];

, :

EAGLContext *context1 = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
EAGLContext *context2 = [[EAGLContext alloc] initWithAPI:[context1 API] sharegroup:context1.sharegroup];

(, context2 API- context1 - Apple ES Pivot)

+3

, , , .

. , , ViewController. , , glBindFramebuffer() framebuffer view -presentRenderbuffer . , , .

+3

Source: https://habr.com/ru/post/1748213/


All Articles