What's the difference between Vertex Attribute stride and relative offset?

glVertexAttribFormat use the term “relative offset” but all other VertexAttrib functions I’ve seen use the term “stride.”
Both constants are different values, so I might assume they are different things? I’ve tried searching for information about relative offset but only found a spec that included this function, and that wasn’t very clear.

Also, the glGet reference page is missing quite a few constants that I’ve seen on some other pages. Is there somewhere to post for fixes?

The difference is that they’re not the same at all. It’s like asking the difference between the size of an object and it’s alignment.

You’re getting confused because you’re mixing up two different things. You’re mixing data from traditional vertex array specification methods with data from the newer separate format/buffer specification method.

[var]GL_VERTEX_ATTRIB_ARRAY_STRIDE[/var] is the byte difference from one element in the array to the next. It’s what allows interleaving.

The [var]GL_VERTEX_ATTRIB_RELATIVE_OFFSET[/var] is only relevant when using separate format/buffer stuff. If you use glVertexAttribPointer, it’s just 0. The relative offset is the byte offset from the base offset of the vertex buffer (as defined by glBindVertexBuffer) to the first element in the attribute array.

The stride says how many bytes lie between two array elements. The offset says where the first element starts. They have nothing in common.

Thanks Alfonse. I have seen this before but I obviously need to do a thorough read.

The reason I’m still confused is probably because the documentation is off.

The distance between elements within the buffer.
The distance between elements within the buffer.

Note the copy paste typos. Although, it corrects itself later in the page.

relativeoffset is the offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from.

Found the actual line that describes it. Thanks again Alfonse.

relativeoffset​ is new. Vertex formats are associated with vertex buffer bindings from glBindVertexBuffer​. So every vertex format that uses the same vertex buffer binding will use the same buffer object and the same offset. In order to allow interleaving (where different attributes need to offset themselves from the base offset), relativeoffset​ is used. It is effectively added to the buffer binding’s offset to get the offset for this attribute.

That’s why you should use the Wiki documentation. It’s never wrong. And no, I didn’t just fix that a few seconds ago; it was always like that. Regardless of what the edit history of that page says.