I am keeping multiple instances of an opengl view. When I release/remove one instance of view, it affects frame buffers and render buffers of all other instances of opengl view. I observed that call made to glDeleteFrameBuffer deletes frame buffer for all
I have created a small project to demonstrate my problem, which can be downloaded from
GLEssentials_ModifiedToDemonstrateProblem.zip - Google Drive[
^]
Two views (EAGLView) are added to the screen (viewcontroller).
“Frame Buffer Status” buttons prints status of buffers of each views like: “showFrameBufferStatus: glIsFramebuffer returned true”
“Remove” button removes view from view hierarchy. Hence deallocating the view from memory.
Steps to regenerate the problem:
Step 1:
Download and run the demo project (I used XCode 7.2 - IOS 8.4)
Step 2:
Touch the button “Frame Buffer Status” for second view.
It prints “showFrameBufferStatus: glIsFramebuffer returned true” to console.
Step 3:
Touch the button “Remove” for first view. It removes first view from view hierarchy and dealloc gets called for EAGLView and ES2Renderer
Step 4:
Touch “Frame Buffer Status” for second view.
It prints “showFrameBufferStatus: glIsFramebuffer returned false”. It means frame buffer is deleted for view2 while view1 is deallocated.
Now when glDeleteFramebuffers is commented out in ES2Renderer.m, and above steps are followed, final step shows that glIsFramebuffer returned true
So root problem is glDeleteFramebuffers deletes frame buffers for both instances of ES2Render.
Note: The project is created by modifying GLEssential demo from apple (
https://developer.apple.com/library/ios/samplecode/GLEssentials/Introduction/Intro.html[
^])