Vertex Shader

Changes in the vertex shader are straightforward by adding the texture coordinate input and ouput.

Add the texture coordinate attribute input

in layout(location=0) vec3 aPos;
in layout(location=1) vec3 aNormal;
// added for LabA07
in layout(location=2) vec2 aTexCoord;

Adding the texure coordinate output

out vec3 normal;
out vec3 fragPos;
// added for LabA07
out vec2 texCoord;

transfer texcoord from input to output in main()

void main()
{
    ...
    // added for LabA07
    texCoord = aTexCoord;
}

Full Source Code of the Vertex Shader

Last updated