Sprite: Add special case shader for translucent effect
Translucent sprites (opacity < 255) are very common, so using a custom shader instead of the full blown effect one helps a lot, especially on mobile.
This commit is contained in:
		
							parent
							
								
									a53163660f
								
							
						
					
					
						commit
						3c0a530eba
					
				
					 6 changed files with 58 additions and 1 deletions
				
			
		
							
								
								
									
										11
									
								
								shader/simpleAlphaUni.frag
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								shader/simpleAlphaUni.frag
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
 | 
			
		||||
uniform sampler2D texture;
 | 
			
		||||
uniform lowp float alpha;
 | 
			
		||||
 | 
			
		||||
varying vec2 v_texCoord;
 | 
			
		||||
 | 
			
		||||
void main()
 | 
			
		||||
{
 | 
			
		||||
	gl_FragColor = texture2D(texture, v_texCoord);
 | 
			
		||||
	gl_FragColor.a *= alpha;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue