I have to draw byte array image to glsurfaceview which is continuously comes from server in xamarin android project. code is not working for direct buffer draw but its working for bitmap draw.
my code is working if I convert byte array to bitmap and draw :
mBitmap = { .. create bitmap from byte[].. }
GLUtils.TexImage2D(GLES20.GlTexture2d, 0, mBitmap, 0);
At the same code if I put following code, then its not draw. I want to draw byte array using GLES20.GlTexImage2D(). My not working code is:
// mFrameBuffer is my byte array
ByteBuffer buffer = ByteBuffer.AllocateDirect(mFrameBuffer.Length);
buffer.Order (ByteOrder.NativeOrder());
buffer.Put (mFrameBuffer);
buffer.Position (0);
GLES20.GlTexImage2D (GLES20.GlTexture2d, 0, GLES20.GlRgb565, mWidth, mHeight, 0, GLES20.GlRgb565, GLES20.GlUnsignedByte, buffer);
How to draw image using GlTexImage2D for direct byte array.