- Home /
OpenGL ES error on iPhone 4S, iPad 2 & 3rd gen iPad when combining rendering to a texture and invalidating GL state
tl;dr : This issue is fixed in Unity 3.5.2.
Hello,
Trying to narrow down another issue (about Vuforia AR + Unity Water Pro), I've created a simple sample that contains only two game objects:
a simple game object with a renderer component but no mesh filter. A script component creates a camera and a render texture, and manually renders the camera inside the render texture on "OnWillRenderObject". (This game object represents the water part in the initial issue.)
a default main camera, with a script that calls GL.InvalidateState() on "Update". (This camera represents the Vuforia part in the initial issue.)
On iPad 2, 3rd gen iPad and iPhone 4S, less than 20 seconds after "`applicationDidBecomeActive()`", this OpenGL error is displayed each frame in Xcode's console:
OpenGLES error 0x0506 in /GlError/iOSbuild/Classes/iPhone_GlesSupport.cpp:224
In pseudo-code, this is the call to glDiscardFramebufferEXT(GL_FRAMEBUFFER_OES, 2, {GL_DEPTH_ATTACHMENT_OES, GL_STENCIL_ATTACHMENT_OES})
that returns INVALID_FRAMEBUFFER_OPERATION_EXT
in the Unity code function void PreparePresentSurfaceGLES(EAGLSurfaceDesc* surface)
.
Sometimes (as in I can only reproduce this from time to time), when putting the application in the background and returning to the iOS menu by pressing the home button, the entire screen will flicker between black and what it's supposed to display (ie the menu). Once the iPad 2 or iPhone 4S has started flickering, forcing the application termination won't stop the flickering. It's only by pressing the wake/sleep button quickly that the flickering will stop.
I'm not rendering savvy so I hope that even though the sample is useless on its own, I stripped it down to something meaningful. I'm also hoping that fixing this OpenGL error will solve the initial issue.
On iPod Touch 4 and iPhone 4, the OpenGL error does not show up. Instead, the app receives a memory warning less than 2 minutes after it started, and is terminated by iOS shortly afterwards. I've never seen the flickering on these devices.
At the time of writing, the application has been running for more than 40 minutes on iPad 2 and iPhone 4S without being terminated by iOS.
I'm using Unity 3.5.0f5 and Xcode 4.3.1 under Mac OS X 10.7.3.
Thanks!
EDIT: tested the sample with 3rd gen iPad.
EDIT: tested the sample with Unity 3.5.1f2, the error still shows up.
Answer by devGuillaume · Apr 26, 2012 at 10:22 AM
My bug report 455369 was answered recently: "This issue is fixed and should be available for the next release." That would be the release after v3.5.1f2.
EDIT: As stated in the release notes for Unity 3.5.2, this issue is fixed:
iOS: Fixed GL.InvalidateState causing INVALID_FRAMEBUFFER_OPERATION_EXT.
Answer by jasksonlai · Aug 06, 2013 at 08:28 AM
We also trying the sane idea so it can work with our ipad case review blog so it can be possible to view on mobile version, but seems to not work because of the unidentified bugs perhaps. Will the guide really fix it?
Answer by Streamfall · Sep 08, 2014 at 06:27 PM
I seem to be running into this error on Unity 4.5.3.
Any ideas?
Your answer

Follow this Question
Related Questions
Why can't Unity use DLLImport twice for overloaded functions? 2 Answers
WWW http request loads way to long on IOS 0 Answers
RenderTexture runtime error on app load on iOS 1 Answer
After Unity Crash Camera RenderTexture 0 Alpha 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers