<Shader>
	<VertexShader>
		<InsCode code="utilityLib/fragDeferredRead.glsl" />
		<Code>
			#version 120
			attribute float Indx;
		</Code>	
		
		<ifdef def="VertexColor">
			const int ColorAraySize = 64;
		</ifdef>
		<ifndef def="VertexColor">
			const int ColorAraySize = 16;
		</ifndef>
		
		<Code>
			uniform vec4 PosTexCoord[64]; 
			uniform vec4 QuadColor[ColorAraySize]; 
			
			varying vec4 Color;
			varying vec2 Texcoord;
		
			const vec2 v[4] = vec2[](vec2(0.0, 0.0), vec2(1.0, 0.0), 
									   vec2(1.0, 1.0), vec2(0.0, 1.0));
			void main( void )
			{
				int i = int(Indx);
				vec4 PosTex = PosTexCoord[i];
		</Code>	
			<ifdef def="VertexColor">
				Color = QuadColor[i];
			</ifdef>
			<ifndef def="VertexColor">
				Color = QuadColor[int(floor(Indx/4.0))];
			</ifndef>
		<Code>		
				PosTex.xy = PosTex.xy * 2.0 -1.0;
				PosTex.y = -PosTex.y;

				gl_Position = vec4( PosTex.xy, 1.0, 1.0);
				Texcoord = PosTex.zw;
			}
		</Code>
	</VertexShader>
	
	<FragmentShader>
		<Code>
			#version 120
			uniform sampler2D baseMap;

			varying vec4 Color;
			varying vec2 Texcoord;

			void main( void )
			{
				gl_FragColor = texture2D(baseMap, Texcoord.xy)*Color;
			}
		</Code> 
	</FragmentShader>
</Shader>
