Binding texture directly to OpenGLES with Unity iPhone Pro via a C++ plugin


We are trying to set texture directly to OpenGLES rather than via Unity. The idea is to avoid the buffer copy to increase performance.

On Mac (OpenGL, Unity pro 2.61) the following works:

C++ Code:

void paintFrame(int textureID)
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0,GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *)imageData);

Script start:

tex = new Texture2D (width,height, TextureFormat.RGB24, false); 

this.mat.SetTexture("_MainTex", tex);

Script update:


The problem is that on iPhone (OpenGLES, Unity pro 1.7) the same does not work.

Any ideas on: a) Whether the problem arises from the textureID being handled differently between the openGL/Unity versions?

b) Whether the problem is related to the texture size (we are using 256X256) that should be different on mobile?

c) A different way of saving the need to copy the texture buffer to a unity object before it is sent to OpenGLES?


did you solve your problem ? because I have got the exact same problem.

We copy a texture generated from our C++ plugin to unity through GL functions. It is ok under windows … but we failed to make it work under iOS.

If you have any idea/recommandation your are welcom.