diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2012-06-21 18:08:39 -0400 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2012-06-21 18:08:39 -0400 |
commit | 0a014b6a0a925abc026195430ab18fb340e5ae4e (patch) | |
tree | 41080732805b2a02a2d45199f5a76b654673ec05 /src/library_gl.js | |
parent | dfab4e04fc488095c6ca830a510d3bca076e16b1 (diff) |
Take the fog into account when caching renderers
Diffstat (limited to 'src/library_gl.js')
-rw-r--r-- | src/library_gl.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 3a8873bc..538c89c3 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1504,6 +1504,13 @@ var LibraryGL = { if (!cacheItem[GL.currProgram]) cacheItem[GL.currProgram] = {}; cacheItem = cacheItem[GL.currProgram]; } + if (GLEmulation.fogEnabled) { + var fogParam = "fog" + GLEmulation.fogMode; + } else { + var fogParam = "nofog"; + } + if (!cacheItem[fogParam]) cacheItem[fogParam] = {}; + cacheItem = cacheItem[fogParam]; if (!cacheItem.renderer) { #if GL_DEBUG Module.printErr('generating renderer for ' + JSON.stringify(attributes)); @@ -1552,6 +1559,10 @@ var LibraryGL = { } this.program = GL.programs[GL.currProgram]; } else { + // IMPORTANT NOTE: If you parameterize the shader source based on any runtime values + // in order to create the least expensive shader possible based on the features being + // used, you should also update the code in the beginning of getRenderer to make sure + // that you cache the renderer based on the said parameters. this.vertexShader = Module.ctx.createShader(Module.ctx.VERTEX_SHADER); var zero = positionSize == 2 ? '0, ' : ''; if (GLEmulation.fogEnabled) { |