uniform vec3 up;

void main() {
	gl_FrontColor = gl_Color;
	gl_BackColor = gl_Color;

	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

	//Get the right-facing vector for this sprite
	vec3 relPos = vec3( gl_ModelViewProjectionMatrix[0][3], gl_ModelViewProjectionMatrix[1][3], gl_ModelViewProjectionMatrix[2][3]);
	vec3 right = normalize( cross( up, relPos) );

	//Create the real vertex, so it is facing the camera
	vec4 final = vec4(1.0,1.0,1.0,1.0);
	final.xyz = (right * gl_Vertex.x) + (up * gl_Vertex.y);

	gl_Position = gl_ModelViewProjectionMatrix * final;
}
