1

I have a FloatBuffer as an output from the neural network, where the RGB channels are encoded with [-1 .. +1] values. I would like to render them on-screen, using GLSurfaceView. What is the best way to handle it?

I can dump the buffer into SSBO and write a compute shader, which maps it to ByteBuffer of [0 .. 255] range, then somehow bind it to regular texture. Or maybe I can set up my compute shader to output directly to some texture buffer? Or maybe I am supposed to read my SSBO directly from the fragment shader (and implement my own linear interpolation)?

So, which is the best way to render stuff via OpenGL ES? Please, help.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
SadSido
  • 2,511
  • 22
  • 36
  • The source format of a texture can be a floating point, just like the internal format, too. – Rabbid76 Feb 06 '20 at 17:26
  • AFAIK, floating point textures have very limited support among android devices. But worth trying, thank you – SadSido Feb 07 '20 at 08:29
  • If SSBOs are provided, then floating point textures are provided, too (most probably) – Rabbid76 Feb 07 '20 at 08:31
  • Well, they are not. Samsung Galaxy S7 and S8, for example, do not expose OES_texture_float extension and render just nothing, given a floating point texture. Same app for Google Pixel 3 works fine, and OES_texture_float is among the extensions ... – SadSido Feb 11 '20 at 09:44

1 Answers1

0

You can try to load it with but it depends how many update you need per seconde. That is to test with you machine.

First Bind your texture (you must create one) then when your input buffer is ready use

GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width, height, GLES30.GL_RGB, GLES20.GL_FLOAT, InputFloatBuffer);

It work well with ByteBuffer and i did not try with Float but there is no Signed_float format.

Use a kernel to change the signed float to byte.

Simas Joneliunas
  • 2,890
  • 20
  • 28
  • 35
hterrolle
  • 49
  • 8