Skip to main content

Vertex attributes

Values that are being passed from JavaScript to the GPU and that are different for each vertex, for example position, normals, colors.

As they represent vertex properties, attributes can only exist in vertex shaders. This is why if we want to use any of these attributes in a fragment shader, we'll need to pass them as varyings.

Example:

attribute vec4 a_position;
void main() {
gl_Position = a_position;
}