Question

Whenever I look at sample shaders, it seems this type of stuff happens almost by magic; sometimes information is saved into special places like position/color, but other times a fragment shader uses parameters and quite how fragment shader knows where to get this data I can't follow.

Can anyone provide a medium-simple GLES shader which does this, and explain how it works?

Was it helpful?

Solution

Have a look at the OpenGL ES quick reference card.

You're interested in the "Built-In Inputs, Outputs, and Constants" later where GLSL is described, in particular vertex shader outputs and fragment shader inputs.

Additional VS outputs (that become FS inputs) should be declared in both using the varying keyword.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top