diffuseTex
	
>> vertex <<

// Input Attributes
vec3 IN_position;
vec2 IN_texCoords;

uniform mat4 worldMatrix;
uniform mat4 viewProjMatrix;

uniform vec2 viewport;

varying	vec4 OUT_position;
varying	vec2 OUT_texCoords;

void main()
{
	IN_position = gl_Vertex.xyz;
	IN_texCoords = gl_MultiTexCoord0.xy;
	vec4 pos4 = vec4(IN_position, 1);
	OUT_position = worldMatrix * pos4;
	OUT_texCoords = IN_texCoords;
	gl_Position = viewProjMatrix * OUT_position * vec4(1,-1,1,1);;
}

>> vertex-flip <<

// Input Attributes
vec3 IN_position;
vec2 IN_texCoords;

uniform mat4 worldMatrix;
uniform mat4 viewProjMatrix;

uniform vec2 viewport;

varying	vec4 OUT_position;
varying	vec2 OUT_texCoords;

void main()
{
	IN_position = gl_Vertex.xyz;
	IN_texCoords = gl_MultiTexCoord0.xy;
	vec4 pos4 = vec4(IN_position, 1);
	OUT_position = worldMatrix * pos4;
	OUT_texCoords = IN_texCoords;
	gl_Position = viewProjMatrix * OUT_position * vec4(1,-1,1,1);;
}

>> fragment <<
//#extension GL_EXT_gpu_shader4 : enable //Enabled for texelFetch

uniform sampler2D diffuseTex;

uniform vec4 textColor;
uniform vec4 cutoff;

varying	vec4 OUT_position;
varying	vec2 OUT_texCoords;

void main()
{
	vec4 diffuse = texture2D(diffuseTex, OUT_texCoords).xxxx;
	if (diffuse.x == 0)
		discard;
	if (OUT_position.y > cutoff.y)
		discard;
	gl_FragColor = diffuse * textColor;
}

>> vertex/CG <<

struct input 
{
	float3 position 	: POSITION;
	float2 texCoords 	: TEXCOORD0;
};

struct output
{
	float4 position;
	float4 glPosition : POSITION;
	float2 texCoords 	: TEXCOORD0;
};

output main(
	input IN,
	uniform float4x4 worldMatrix,
	uniform float4x4 viewProjMatrix,
	uniform float2 viewport
)  
{
	float4 pos4 = float4(IN.position, 1); 
	output OUT;
	OUT.position = mul(worldMatrix, pos4);
	OUT.texCoords = IN.texCoords;
	OUT.glPosition = mul(viewProjMatrix, OUT.position) * float4(1,-1,1,1);
	return OUT;
} 
 
>> vertex-flip/CG <<
	
struct input
{
float3 position 	: POSITION;
float2 texCoords 	: TEXCOORD0;
};

struct output
{
float4 position;
float4 glPosition : POSITION;
float2 texCoords 	: TEXCOORD0;
};

output main(
input IN,
uniform float4x4 worldMatrix,
uniform float4x4 viewProjMatrix,
uniform float2 viewport
)
{
float4 pos4 = float4(IN.position, 1);
output OUT;
OUT.position = mul(worldMatrix, pos4);
OUT.texCoords = IN.texCoords;
OUT.glPosition = mul(viewProjMatrix, OUT.position) * float4(1,-1,1,1);
return OUT;
}


>> fragment/CG <<
	
struct input
{
float4 position;
float4 glPosition;
float2 texCoords 	: TEXCOORD0;
};

struct output
{
float4 color 	: COLOR;
};

output main(input IN, uniform sampler2D diffuseTex: TEXUNIT0, uniform float4 textColor, uniform float4 cutoff) : COLOR
{
	float4 diffuse = tex2D(diffuseTex, IN.texCoords.xy).xxxx;

	if (diffuse.x < 0.5)
	discard;
	if (IN.glPosition.y > cutoff.y)
		discard;
	diffuse = float4(1);
	output OUT;
	OUT.color = diffuse * textColor;
	return OUT;
}

