Skip to content

Commit fc747ce

Browse files
Jura-Zmarco trivellato
authored andcommitted
‘glGetUniformLocation for named uniform block’ bug fixed
1 parent 1e42813 commit fc747ce

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/library_gl.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,19 @@ var LibraryGL = {
699699
// only store the string 'colors' in utable, and 'colors[0]', 'colors[1]' and 'colors[2]' will be parsed as 'colors'+i.
700700
// Note that for the GL.uniforms table, we still need to fetch the all WebGLUniformLocations for all the indices.
701701
var loc = GLctx.getUniformLocation(p, name);
702-
var id = GL.getNewId(GL.uniforms);
703-
utable[name] = [u.size, id];
704-
GL.uniforms[id] = loc;
702+
if (loc != null)
703+
{
704+
var id = GL.getNewId(GL.uniforms);
705+
utable[name] = [u.size, id];
706+
GL.uniforms[id] = loc;
705707

706-
for (var j = 1; j < u.size; ++j) {
707-
var n = name + '['+j+']';
708-
loc = GLctx.getUniformLocation(p, n);
709-
id = GL.getNewId(GL.uniforms);
708+
for (var j = 1; j < u.size; ++j) {
709+
var n = name + '['+j+']';
710+
loc = GLctx.getUniformLocation(p, n);
711+
id = GL.getNewId(GL.uniforms);
710712

711-
GL.uniforms[id] = loc;
713+
GL.uniforms[id] = loc;
714+
}
712715
}
713716
}
714717
}

0 commit comments

Comments
 (0)