Cannot use `uint` uniforms in shaderMaterial

Hi, this is my first time writing to this forum to ask a question. :slight_smile:

I’ve been trying a few things with ShaderMaterial, and the only time I run into the error is when I try to use a uniform of type uint by setUInt.

The link below is a simple playground to reproduce the problematic situation.

Here, I’m passing 5 as a uint uniform, and checking that value through the for statement to modify the color.

I think at least the box shouldn’t be black, but right now it’s literally just showing me a black box with the following error.

[.WebGL-0x11c00deab00] GL_INVALID_OPERATION: Uniform type does not match uniform method.

I’m not sure what the reason is. Did I miss something or is it a bug? I’ve spent quite a bit of time trying to figure out the problem, but I’m at a loss.

Any help would be greatly appreciated, thank you. :blush:

Welcome aboard!

Congrats, you’ve hit your first bug! :slight_smile:

Here’s the fix:

Note that you can use a signed int instead, which is not bugged.

1 Like

Thanks for the reply and the fix! :slight_smile: