OpenGL bool uniform?
问题 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. 回答1: § 4.1 Basic Types The OpenGL Shading Language supports