GL_EXT_YUV_target#
Valid APIs#
OpenGL ES 3.1+
Description#
This extension adds support for three new YUV related items: first rendering to YUV images, second sampling from YUV images while keeping the data in YUV space, third it defines a new built in function that does conversion from RGB to YUV with controls to choose ITU-R BT.601-7, ITU-R BT.601-7 Full range (JFIF images), or ITU-R BT.709-5 standard.
Registry Link#
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_YUV_target.txt
Example#
uniform __samplerExternal2DY2YEXT u_sTexture;
layout (yuv) out vec4 color;
void main()
{
vec4 yuvTex = texture(u_sTexture, texcoord);
//decode yuv texture according to standard
vec3 rgbTex = yuv_2_rgb(yuvTex.xyz, itu_601); //yuv standards (could be itu_601_full_range, itu_709 as well)
//do some colour operations in RGB
//...
//convert back to yuv
yuvTex.xyz = rgb_2_yuv (rgbTex, itu_601);
//write out in yuv format
color = yuvTex;
}