Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the counterpart for gl_TexCoord in OpenGL ES 2.0

I have a OpenGL shader which uses gl_TexCoord like the following does. But in OpenGL ES, gl_TexCoord is not supported. I wonder what can I do to refactor the code to get it work on 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));
    }

    ...
}
like image 300
tom Avatar asked Jul 26 '12 22:07

tom


People also ask

Is gl_FragColor deprecated?

Yes, gl_FragColor is deprecated. You should use the following syntax: layout(location = 0) out vec4 diffuseColor; It is included in the GLSL 4.60 spec under the section 7.1.

What is gl_PointSize?

One output variable defined by GLSL is called gl_PointSize that is a float variable where you can set the point's width and height in pixels. By setting the point's size in the vertex shader we get per-vertex control over this point's dimensions.


1 Answers

There isn't one. You do it manually with a user-defined varying passed from your vertex shader. That's all it ever was anyway; a per-vertex output that your fragment shader took.

like image 137
Nicol Bolas Avatar answered Nov 06 '22 16:11

Nicol Bolas