This is the first time I've heard of a
constant vertex attribute, but from it's definition it's clear that it's a vertex attribute. Vertex attributes are defined per vertex ( whether they're the same for every vertex or not ). That means you only have access to them in the vertex shader. Uniforms on the other hand are kept in a separate space, and they are accessible to both the fragment and the vertex shader.
Also, since we're comparing vertex attributes to uniforms:
- there's a limited number of attributes you can use per vertex ( usually small ) and they map to things like position, normal, color, etc., where as the space for uniforms is much larger.
- There are type constraints to what you can pass as a vertex attribute. You can't use a texture as a vertex attribute.
- If you try to pass the attribute to the fragment shader through a varying, you'll get an interpolated value for each fragment.
Try to think of them like this:
A vertex attribute is exactly what it's name implies: an attribute corresponding to vertex. Every vertex has that attribute. If that attribute is the same for every vertex, you can use it as a constant vertex attribute. The set of vertex attributes are the input for a vertex shader.
A uniform is something that is stored separate from the vertex or fragment shaders and it's accessible from both. You can store numbers, matrices, textures and even structures. They are not used as input but rather as a pool of resources you can access whenever and wherever you want. They're also treated differently by the video card.