glTF
glTF copied to clipboard
Unsigned integer attributes ambiguity
The spec states in section 5.24.2 that for mesh.primitive.indices
When defined, the accessor MUST have
SCALAR
type and an unsigned integer component type.
Does this mean that only 32 bit integers as indices are supported? Or is unsigned integer
referring to all possible unsigned integer types. i.e. 5121: unsigned byte
, 5123: unsigned short
and 5125: unsigned int
.
Similarly, section 3.7.2.1 mentions
Application-specific attribute semantics MUST NOT use
unsigned int
component type.
Is this referring to all integer component types or only the 32 bit variant?
Section 5.1.3 is a bit more clear about this:
UNSIGNED_INT
type MUST NOT be used for any accessor that is not referenced bymesh.primitive.indices
.
This seems to suggest only the 32 bit variant isn't allowed. But the wording makes it seem like it could be allowed as long as at least one indices accessor references it.
The short answer is that "unsigned integer" written as text means any unsigned type (u8
/u16
/u32
), while unsigned int
specifically means u32
. It's an OpenGL quirk that we should fix in the next spec language revision.
Also, u32
is never allowed for vertex attributes, so the last quoted sentence may indeed be misleading.