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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top