首页 > 解决方案 > 如何用delphi绘制YUV纹理?

问题描述

据我所知,YUV 纹理是 2 个纹理(Y 和 UV)的组合。这两个纹理必须使用像这样的着色器在画布上绘制:

#version 100
    precision mediump float;

    varying vec2 vUV;
    uniform sampler2D SamplerY;
    uniform sampler2D SamplerUV;

    void main() {

        mediump vec3 yuv;
        lowp vec3 rgb;

        yuv.x = texture2D(SamplerY, vUV).r;
        yuv.yz = texture2D(SamplerUV, vUV).rg - vec2(0.5, 0.5);

        // Using BT.709 which is the standard for HDTV
        rgb = mat3(      1,       1,      1,
                         0, -.18732, 1.8556,
                   1.57481, -.46813,      0) * yuv;

        gl_FragColor = vec4(rgb, 1);
    } 

我知道如何使用带有一个纹理的着色器,但是我不知道如何在参数中使用带有 2 个纹理的着色器

标签: delphifiremonkey

解决方案


推荐阅读