Hello!
I have GL_TEXTURE_EXTERNAL_OES which attached to SurfaceTexture in Android for video rendering (ExoPlayer) and GL_TEXTURE_2D which attached to simple Texture2D in Unity3d for display this video on Unity image component.
How i can sync them through OpenGL layer and pass data from OES to 2D texture (it happens every frame)?
I discovered not so many info about this topic, but as i understand i need pass data from OES texture to framebuffer and render from framebuffer to TEXTURE_2D, but with my current realization nothing happened and i dont know why beacause of lack of opengl knowledge.

Best regards and thanks for help!


Code :
    GLuint FramebufferName;
    glGenFramebuffers(1, &FramebufferName);
    glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
 
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_EXTERNAL_OES, g_ExtTexturePointer, 0);
 
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_EXTERNAL_OES, g_ExtTexturePointer);
 
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, g_TexturePointer);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, g_TexWidth, g_TexHeight, 0, GL_RGB, GL_FLOAT, NULL);
 
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_TexturePointer, 0);
 
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
    glBindFramebuffer(GL_FRAMEBUFFER, 0);