PDA

View Full Version : How does indexing change with different data types for vertex attributes?



MrUNOwen
08-30-2017, 02:04 PM
So I know from vec4 to vec4 (vertex attributes) the delta in index location is 1 and for mat4, the delta is 4. However, how does it change with different data types like boolean and int? So lets say I have a bvec4, that's still having the same footprint of a vec4 in terms of the index location? I also vaguely recall something about all types being converted to float? If that's true, in terms of reducing overhead, am I better off sending everything as a float and converting it back the intended type?

GClements
08-30-2017, 07:54 PM
So I know from vec4 to vec4 (vertex attributes) the delta in index location is 1 and for mat4, the delta is 4. However, how does it change with different data types like boolean and int? So lets say I have a bvec4, that's still having the same footprint of a vec4 in terms of the index location?
Yes. Double-precision values will take twice the space, but bool and int are the same size as a float.


I also vaguely recall something about all types being converted to float?
That's incorrect. In particular, converting large integers (> 224) to floats would be unreliable (single-precision floats only have a 24-bit significand).