x


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

Hi

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:

    paintFrame(tex.GetInstanceID());

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?

more ▼

asked Jun 29, 2010 at 09:31 AM

Oriel Bergig gravatar image

Oriel Bergig
11 3 2 3

have you found a solution to this problem?

Jul 21, 2010 at 05:58 AM Kijun
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Hello,

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.

thanks.

Nicolas

more ▼

answered Oct 12, 2011 at 03:31 PM

NicolasHognon gravatar image

NicolasHognon
1 1 22

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3508
x2212
x156
x1

asked: Jun 29, 2010 at 09:31 AM

Seen: 2733 times

Last Updated: Oct 12, 2011 at 03:31 PM