diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-03 14:09:42 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-03 14:09:42 -0700 |
commit | b847d170b41dc3679080b2e9a10fff1493be3381 (patch) | |
tree | e5731dbbcd05b5436976d23dd43ae88649ff8155 | |
parent | 2177a509f0b1262eb0aee6acbcffe98dbd368151 (diff) |
fix glGetUniformLocation return value
-rw-r--r-- | src/library_gl.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index e964c26f..3b3ce6c4 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1,9 +1,7 @@ //"use strict"; // FIXME: -// * glGetUniformLocation should return -1 when the value is not valid, not null // * glUniform1fi should be glUniform1iv -// * glGetAttribLocation should be -1 when not valid // * single-underscore deps need double underscore (and, just auto-add them all) // * glGetProgramInfoLog and *shader* should be essentially identical // * glGetIntegerv set to bool etc needs fixing @@ -396,8 +394,9 @@ var LibraryGL = { glGetUniformLocation_deps: ['$GL'], glGetUniformLocation: function(program, name) { name = Pointer_stringify(name); - return GL.hashtable("uniform").add( - Module.ctx.getUniformLocation(GL.hashtable("program").get(program), name)); + var loc = Module.ctx.getUniformLocation(GL.hashtable("program").get(program), name); + if (!loc) return -1; + return GL.hashtable("uniform").add(loc); }, glUniform1f: function(Location, v0) { |