- Real-Time 3D Graphics with WebGL 2
- Farhad Ghayour Diego Cantor
- 119字
- 2021-06-10 19:42:54
Attributes
Attributes are input variables that are used in the vertex shader. Attributes are used to specify how to pull data out of buffers and provide them to the vertex shader. For example, you may put positions in a buffer as three 32-bit floats per position. You would tell a particular attribute which buffer to pull the positions out of, what type of data it should pull out (3-component, 32-bit floating point numbers), what offset in the buffer the positions start at, and how many bytes to get from one position to the next. Since the vertex shader is called on each vertex, the attributes will be different every time the vertex shader is invoked.