Fragment Shader Challenge

Now that our varying is declared and set, we can access and utilize within our fragment shader.

Accessing the varying is relatively simple, all we have to do is declare the varying at the top of our file with the exact same syntax we used within our vertex shader.

For instance, we just declared the varying within vertex.glsl with the following syntax:

varying vec2 vertexUV;

To import this into fragment.glsl, all we have to do is copy and paste this line of code into our file at some point before main.

Import this vertexUV varying below:

fragment.glsl

Providing the lift to launch your development career

© 2024 Chris Courses. All rights reserved.