0

In Android, in order to pass YUV420sp into a fragment shader I pass the information spliting the data into Y-U-V, and passing each sugin glTexImage2D with GL_LUMINANCE format

But now I need to do Offscren-Rendering for which I require FBOs, the problem is that FBOs do not support GL_LUMINANCE.

So what would be the best way to pass the YUV data without using GL_LUMINANCE?

By the way, I cannot process the YUV in the CPU and convert it to RGB or something else, as the whole point is to pass the YUV as it is into the GPU.

EDIT: As this is for android, the single channel GL_RED will not work as such has not been implemented.

PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
  • FBO is just a container. Attachment format is what you probably need.Also how are you going to process YUV in shader? You need to convert it to RGB AFAIK. – Michael IV Sep 07 '13 at 23:06
  • YUV is converted inside the shader, which works as expected and is blazing fast. About attachment format, do you have any more information about that? Thanks – PerracoLabs Sep 07 '13 at 23:09
  • Read in the web what is FBO and how you use it.and you bind your input texture to the FBO the same way you do to default FBO – Michael IV Sep 07 '13 at 23:17

1 Answers1

1

GL_LUMINANCE is completely unnecessary in the programmable pipeline.

At its most basic level, it was a hack that allowed texture swizzling in the days of the fixed-function pipeline. These days you use GL_RED for a single-channel texture and you can swizzle it any way you want in your fragment shader.

What you want to duplicate GL_LUMINANCE is: vec4 (texture (...).rrr, 1.0). You can even do this in the fixed-function pipeline in recent OpenGL implementations using ARB_texture_swizzle.

Andon M. Coleman
  • 42,359
  • 2
  • 81
  • 106
  • Hi, GL_RED was my hope, but in the Android GLES 2.0 is not implemented. I can't really understand why they missed something such as this. So I can't use that solution – PerracoLabs Sep 08 '13 at 09:16
  • @Zhenya: Does your implementation have the extension `GL_EXT_texture_rg`? The format: `GL_R8_EXT` is color-renderable in OpenGL ES 2.0 (if you have this extension). Otherwise you can render to the R channel of an RGB[A] texture and simply ignore the other two/three components (waste of bandwidth definitely, but it might be your only option). – Andon M. Coleman Sep 08 '13 at 20:37