diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-06-26 18:02:13 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-06-26 18:02:13 -0700 |
commit | d4c98c64c352a513caf415038530eb77e8b1fa4d (patch) | |
tree | 1e325b57e6681927d47c67f8f765aaf9806d7feb | |
parent | 0eb96e7460785ae6c2f1e34c45dee2055d8c85af (diff) |
fix potential bug in getRenderer
-rw-r--r-- | src/library_gl.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 6a337d00..5cf8f8d3 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1504,10 +1504,6 @@ var LibraryGL = { if (!cacheItem[attribute.type]) cacheItem[attribute.type] = {}; cacheItem = cacheItem[attribute.type]; } - if (GL.currProgram) { - if (!cacheItem[GL.currProgram]) cacheItem[GL.currProgram] = {}; - cacheItem = cacheItem[GL.currProgram]; - } if (GLEmulation.fogEnabled) { var fogParam = GLEmulation.fogMode; } else { @@ -1515,6 +1511,10 @@ var LibraryGL = { } if (!cacheItem[fogParam]) cacheItem[fogParam] = {}; cacheItem = cacheItem[fogParam]; + if (GL.currProgram) { // Note the order here; this one is last, and optional + if (!cacheItem[GL.currProgram]) cacheItem[GL.currProgram] = {}; + cacheItem = cacheItem[GL.currProgram]; + } if (!cacheItem.renderer) { #if GL_DEBUG Module.printErr('generating renderer for ' + JSON.stringify(attributes)); |