title: OpenGL, diffuse shader
body: <p>I'm trying to implement very simple diffuse shader in GLSL/openGL.
  Here's what I got:
  Vertex shader:</p>
  
  <pre><code>#version 130
  
  in vec3 vertPos3D;
  in vec3 vertNormal3D;
  
  uniform mat3 transpMatrix;
  uniform mat4 projectionMatrix;
  uniform mat4 viewMatrix;
  
  uniform vec3 lightPosition;
  
  varying vec3 vertNormal;
  varying vec3 lightVector;
  
  void main() 
  { 
      vec4 res_pos = projectionMatrix * viewMatrix * vec4(vertPos3D.xyz, 1.0);
      gl_Position = res_pos;
      mat4 pm = projectionMatrix * viewMatrix;
      vertNormal = (viewMatrix * vec4(vertNormal3D, 0)).xyz;
      lightVector = (viewMatrix * vec4(lightPosition, 1.0)).xyz - (viewMatrix * vec4(vertPos3D.xyz, 1.0)).xyz;
  }
  </code></pre>
  
  <p>Fragment Shader:</p>
  
  <pre><code>#version 130
  out vec4 color; 
  
  varying vec3 lightVector;
  varying vec3 vertNormal;
  void main()
  {
      float dot_product = max(normalize(dot(lightVector, vertNormal)), 0.0);
      color = dot_product * vec4( 1.0, 1.0, 1.0, 1.0 );
  }
  </code></pre>
  
  <p>As soon as I multiply final color with dot_product, nothing displays. I remove dot_product, everything works (except diffuse lightning ofc.). I'm afraid it's something obvious I'm missing.</p>