title: Why does my OpenGL Phong shader behave like a flat shader?
body: <p>I've been learning OpenGL for the past couple of weeks and I've run into some trouble implementing a Phong shader. It appears to do no interpolation between vertexes despite my use of the <code>smooth</code> qualifier. Am I missing something here? To give credit where credit is due, the code for the vertex and fragment shaders cribs heavily from the <a href="https://rads.stackoverflow.com/amzn/click/com/0321712617" rel="noreferrer" rel="nofollow noreferrer">OpenGL SuperBible</a> Fifth Edition. I would highly recommend this book!</p>
  
  <p>Vertex Shader:</p>
  
  <pre><code>#version 330
  in vec4 vVertex;
  in vec3 vNormal;
  uniform mat4 mvpMatrix;  // mvp = ModelViewProjection
  uniform mat4 mvMatrix; // mv = ModelView
  uniform mat3 normalMatrix;
  uniform vec3 vLightPosition;
  smooth out vec3 vVaryingNormal;
  smooth out vec3 vVaryingLightDir;
  
  void main(void) {
   vVaryingNormal = normalMatrix * vNormal;
   vec4 vPosition4 = mvMatrix * vVertex;
   vec3 vPosition3 = vPosition4.xyz / vPosition4.w;
   vVaryingLightDir = normalize(vLightPosition - vPosition3);
   gl_Position = mvpMatrix * vVertex;
  }
  </code></pre>
  
  <p>Fragment Shader:</p>
  
  <pre><code>#version 330
  out vec4 vFragColor;
  uniform vec4 ambientColor;
  uniform vec4 diffuseColor;
  uniform vec4 specularColor;
  smooth in vec3 vVaryingNormal;
  smooth in vec3 vVaryingLightDir;
  
  void main(void) {
   float diff = max(0.0, dot(normalize(vVaryingNormal), normalize(vVaryingLightDir)));
   vFragColor = diff * diffuseColor;
   vFragColor += ambientColor;
   vec3 vReflection = normalize(reflect(-normalize(vVaryingLightDir),normalize(vVaryingNormal)));
   float spec = max(0.0, dot(normalize(vVaryingNormal), vReflection));
  
   if(diff != 0) {
     float fSpec = pow(spec, 32.0);
     vFragColor.rgb += vec3(fSpec, fSpec, fSpec);
   }
  
  }
  </code></pre>
  
  <p>This (public domain) image from Wikipedia shows exactly what sort of image I'm getting and what I'm aiming for -- I'm getting the "flat" image but I want the "Phong" image.
  <img src="https://i.imgur.com/sCbrFwM.jpg"></p>
  
  <p>Any help would be greatly appreciated. Thank you!</p>
  
  <p>edit: If it makes a difference, I'm using PyOpenGL 3.0.1 and Python 2.6.</p>
  
  <p>edit2:</p>
  
  <h2>Solution</h2>
  
  <p>It turns out the problem was with my geometry; Kos was correct. For anyone else that's having this problem with Blender models, Kos pointed out that doing <code>Edit-&gt;Faces-&gt;Set Smooth</code> does the trick. I found that Wings 3D worked "out of the box."</p>