- Home /
openGL bug in Unity 5.4, illegal operation?
Hello,
I am working on an app for iOS 9.3 on Mac OSX 10.11 and I get this message looping in the editor but it doesn't cause a crash or any bug :
OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state
This message is also present when I build in this form :
Invalid OpenGLES Api usage detected.
This happens with OpenGLES 2.0 and OpenGLES 3.0.
My scene all crash after a few seconds and it's always related to OpenGL.
Did this happen to anyone before? I assume I forgot something at some point but I really have no clue.
Thanks for your answer(s)!
Answer by Bunny83 · Aug 05, 2016 at 05:23 PM
Well, you most likely are using a native code plugin which has some errors in them. Most likely a wrong order or instructions. For example "glVertex" can only be called inside a glBegin / glEnd pair. If executed outside it would throw such an error. OpenGL is a statemachine and some operations are only allowed / possible when in a certain state.
Answer by pixel_fiend · Sep 05, 2016 at 10:51 PM
I had this bug because I was trying to read pixels into a TextureFormat.ARGB32
from a RenderTexture.RGBAFloat
. I fixed by specifying the TextureFormat in Texture2D constructor to match when creating the reading texture.
outputTexture = new RenderTexture (128, 128, 0, RenderTextureFormat.ARGBFloat);
RenderTexture.active = outputTexture;
tmpTexture = new Texture2D (outputTexture.width, outputTexture.height, TextureFormat.RGBAFloat, false); // NOTE: MUST MATCH FORMAT OF ACTIVE RENDERTEXTURE!
tmpTexture.ReadPixels (new Rect (0, 0, outputTexture.width, outputTexture.height), 0, 0, false);
tmpTexture.Apply ();
RenderTexture.active = null;
Your answer
Follow this Question
Related Questions
How to load tdb file in unity? 1 Answer
Unity 3D Scene loading Issue in iOS Build 2 Answers
AdMob in Editor? 1 Answer
Cardboard on iPhone 5 doesn't render in stereo. 2 Answers
Unity iOS build background mp3 music static noise problem 0 Answers