- Home /
Question by
Kuertz · Apr 06, 2017 at 10:09 PM ·
iosnative pluginopengl es2.0
FBO always 0 in native plugin IOS
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.
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 ?
callback.png
(7.7 kB)
events.png
(6.5 kB)
Comment
It's seems that the EAGLContext is null, why ? I am not an expert in opengl so ...