Hi,
I'm making a Native unity plugin in IOS which is reading a Unity RenderTexture in my native code.
I used the Unity events as describe in the documentation.
![alt text][1]
![alt text][2]
[1]: /storage/temp/91507-callback.png
[2]: /storage/temp/91508-events.png
In my plugin I simple made this code :
//Init
glGenFramebuffers(1, &_fbo);
glBindBuffer(GL_FRAMEBUFFER, _fbo);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
// Reading
glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
glClear(0);
glReadPixels(0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, _pixels);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
This is a simple code but the fbo is always set to 0, so I am not able to read my texture.
Can you help me please ?
↧