aboutsummaryrefslogtreecommitdiff
path: root/src/library_gl.js
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-06-21 13:40:47 -0400
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-06-21 13:40:47 -0400
commit3d8cea93d0b23b5ecafd155dcf403e4d11488650 (patch)
tree9a8017d5ec5b67dd2acc8e576c360f4858a38b3d /src/library_gl.js
parent37c6087206c933143e9f2cd2b369532493a46740 (diff)
Compute the color involving the shader first and then apply the fog
Diffstat (limited to 'src/library_gl.js')
-rw-r--r--src/library_gl.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 757d5874..cbec1bc5 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1579,9 +1579,9 @@ var LibraryGL = {
) : '') +
'void main() \n' +
'{ \n' +
- (GLEmulation.fogEnabled ? 'vec4 color = vec4(mix(vec3(u_fogColor), vec3(v_color), v_fogFragCoord), 1.0); \n' : '') +
- (hasTextures ? 'gl_FragColor = color * texture2D( u_texture, v_texCoord );\n' :
- 'gl_FragColor = color;\n') +
+ (hasTextures ? 'gl_FragColor = v_color * texture2D( u_texture, v_texCoord );\n' :
+ 'gl_FragColor = v_color;\n') +
+ (GLEmulation.fogEnabled ? 'gl_FragColor = vec4(mix(vec3(u_fogColor), vec3(gl_FragColor), v_fogFragCoord), gl_FragColor.a); \n' : '') +
'} \n');
Module.ctx.compileShader(this.fragmentShader);