sharpgl icon indicating copy to clipboard operation
sharpgl copied to clipboard

ShaderProgram.SetUniform1 does not work for int uniforms

Open VE3NEA opened this issue 2 years ago • 1 comments

This statement does not change the integer uniform:

shaderProgram.SetUniform1(gl, "my_texture", 1);

This one works orrectly:

 gl.Uniform1(shaderProgram.GetUniformLocation(gl, "my_texture"), 1);

The problem with the first statement is that the third parameter of SetUniform1 is declared as float, so if an int value is passed, it is typecasted to float before the call to gl.Uniform1.

VE3NEA avatar Oct 29 '23 22:10 VE3NEA

This got me as well! Took us a week to figure it out before my friend found this ticket...

brisingre avatar May 21 '24 13:05 brisingre