I am a newbie in OpenGL Shading language. May I ask a question about the sampler data type in shading language here?
The GLESSL spec. says sampler types can only be defined as uniform or function parameters especially in the texture functions.
For example, in the following fragment shader code snippet.
uniform sampler2D sampler2d;
gl_FragColor = texture2D(sampler2d, varCoord);
And in the c code, the Uniform varible sampler2d is being set like
glUniform1i(glGetUniformLocation(m_uiProgramObject , "sampler2d"), 0); // Sets the sampler2D variable to the first texture unit
What does a sampler really mean? Why setting the uniform varible sampler2d to 0 can "Sets the sampler2D variable to the first texture unit"?