79095053

Date: 2024-10-16 16:55:17
Score: 1.5
Natty:
Report link

This is an old question but it still shows up when I google "webgl integer attribute" so I'll add an updated answer.

This is now possible using WebGL2:

// In your shader
in int index;
// In your JS, instead of calling vertexAttribPointer
gl.vertexAttribIPointer(...);

Note the I (for integer) in vertexAttribIPointer. Here are the MDN docs:

https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttribIPointer

Many thanks to this other StackOverflow answer, which goes into more detail:

WebGL 2.0 unsigned integer input variable

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Blacklisted phrase (1): StackOverflow
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Brian Putnam