ios - OpenGL ES 2.0 中 gl_TexCoord 的对应物是什么

标签 ios opengl-es fragment-shader

我有一个使用 gl_TexCoord 的 OpenGL 着色器,如下所示。但在 OpenGL ES 中,不支持 gl_TexCoord。我想知道如何重构代码以使其在 OpenGL ES 上运行。

void main() 
{
    //scene depth calculation
    float depth = linearize(texture2D(inputImageTexture2,gl_TexCoord[0].xy).x);
    if (depthblur)
    {
        depth = linearize(bdepth(gl_TexCoord[0].xy));
    }

    ...
}

最佳答案

没有一个。您使用从顶点着色器传递的用户定义的 varying 手动执行此操作。无论如何,这就是它的全部;您的片段着色器采用的逐顶点输出。

关于ios - OpenGL ES 2.0 中 gl_TexCoord 的对应物是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11678769/

相关文章:

javascript - 如何使用着色器在 Three.js 中操作场景的背景颜色?

iphone - 连续切换 Sprite 图像(不显示动画)

android - 在 Android 设备上的 fragment 着色器中使用循环变量进行数组索引

iphone - 在类之间共享结构信息 - Objective C - OpenGL ES

ios - 使用 OpenGL ES 平滑改变线宽

ios - 将 GL_COLOR_ATTACHMENT1 设置为 GL_DRAW_BUFFER0 时,glDrawBuffers 会导致 GL_INVALID_OPERATION

opengl - LookAt函数: I'm going crazy

ios - 清除我的配置文件会使我的应用商店提交无效吗?

ios - subview Controller View 不适合 parent 在 iPhone X 上的 View

android - iOS:具有扩展单元格的 TableView