fix possible bug in uniform sample code

This commit is contained in:
cshesse 2019-12-22 20:39:23 -08:00 committed by GitHub
parent f67165c2bb
commit a6945cb852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -614,7 +614,7 @@ void setup_uniforms(GLuint shader, float camera_pos[4], GLuint tex1, GLuint tex2
stbvox_uniform_info sui; stbvox_uniform_info sui;
if (stbvox_get_uniform_info(&sui, i)) { if (stbvox_get_uniform_info(&sui, i)) {
GLint loc = glGetUniformLocation(shader, sui.name); GLint loc = glGetUniformLocation(shader, sui.name);
if (loc != 0) { if (loc != -1) {
switch (i) { switch (i) {
case STBVOX_UNIFORM_camera_pos: // only needed for fog case STBVOX_UNIFORM_camera_pos: // only needed for fog
glUniform4fv(loc, sui.array_length, camera_pos); glUniform4fv(loc, sui.array_length, camera_pos);