Reset GL state before rendering sprites and lens
@@ -1726,6 +1726,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// custom render plugins (post pass)
+ this.resetGLState();
spritePlugin.render( scene, camera );
lensFlarePlugin.render( scene, camera, _currentWidth, _currentHeight );
@@ -295,8 +295,9 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
gl.useProgram( program );
- gl.enableVertexAttribArray( attributes.vertex );
- gl.enableVertexAttribArray( attributes.uv );
+ renderer.state.disableUnusedAttributes();
+ renderer.state.enableAttribute( attributes.vertex );
+ renderer.state.enableAttribute( attributes.uv );
// loop through all lens flares to update their occlusion and positions
// setup gl and common used attribs/unforms
@@ -98,8 +98,9 @@ THREE.SpritePlugin = function ( renderer, sprites ) {
- gl.enableVertexAttribArray( attributes.position );
+ renderer.state.enableAttribute( attributes.position );
gl.disable( gl.CULL_FACE );
gl.enable( gl.BLEND );