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.
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 usingARB_texture_swizzle
.