
// Uniform variables
uniform mat4 viewMatrix;         // View Matrix

// Varying variables
varying vec4 color;
varying vec2 texCoord0;

void main(void)
{
  vec4 positionWorld;      // Vertex position in world space
  vec4 positionView;       // Vertex position in view space

  // Output the texture coordinate
  texCoord0 = gl_MultiTexCoord0.xy;

  // Transform position into world space
  positionWorld.x = dot(gl_MultiTexCoord1, gl_Vertex);
  positionWorld.y = dot(gl_MultiTexCoord2, gl_Vertex);
  positionWorld.z = dot(gl_MultiTexCoord3, gl_Vertex);
  positionWorld.w = 1.0;

  // Transform position into view space
//  positionView = viewMatrix * positionWorld;
  positionView = gl_ModelViewMatrix * positionWorld;
//  positionView = gl_ModelViewMatrix*gl_Vertex;

  // Transform position into screen space
  gl_Position = gl_ProjectionMatrix * positionView;

  color = gl_Color;  
}