I'm trying to send a boolean to an OpenGL glsl shader.
Currently I have this in the shader:
uniform bool foo;
And I use this to set it:
glUniform1i(glGetUniformLocation(shader, "foo"), true);
There doesn't seem to be a glUniform1b
, so I'm setting it as an integer. This seems to work fine.
Is there any problem with this approach? Is it portable, or could it break on other graphics cards / drivers? I'm using OpenGL 4.3 at the moment.
question from:
https://stackoverflow.com/questions/33690186/opengl-bool-uniform 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…