OpenGL ES draw image from buffer Android JNI

Hello,

I’m new openGL developer. I want to make my own mirroring protocol.
A client sends his desktop screen as a buffer of pixels : Red (One Byte), Green (One Byte), Blue (One Byte).
I get this buffers on Android and I want to display it on my phone screen.
I just started my project with a google sample Hello GL2 : ndk-samples/hello-gl2 at master · android/ndk-samples · GitHub

I don’t understand very well how does OpenGL works with Java Code.

For my purpose, I just retrieve the pixels buffer from socket as a byte array on a C code like this : recv(sock, buffer, BUFF_SIZE, MSG_WAITALL); BUFF_SIZE = 4096.
I’m getting 1280*720 pixels = 921600 pixels.

How can I take them and display them on a GL2View ?
Which configuration should I do ? Should I keep the configuration shown in sample for my purpose or should I change ?
I saw this function that might help but I don’t know how to use it : glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);

Thank you very much for your help ! :slight_smile: