title: glGetUniformLocation() returning -1 even though used in vertex shader
body: <p>I'm trying to render a simple cube with normals. I'm using the following code to initialize the shaders. </p>
  
  <pre><code>void initShader(const char* vertexShaderPath, const char* fragmentShaderPath){
      cout&lt;&lt;"Initializing Shaders"&lt;&lt;endl&lt;&lt;"==="&lt;&lt;endl;
      cout&lt;&lt;"Vertex shader ";
      vs = loadShader(vertexShaderPath, GL_VERTEX_SHADER);
      cout&lt;&lt;"Fragment shader ";
      fs = loadShader(fragmentShaderPath, GL_FRAGMENT_SHADER);
  
      cout&lt;&lt;"Creating program: ";
      program = glCreateProgram();
      if(0==program) cout&lt;&lt; "Failed"&lt;&lt;endl; else cout&lt;&lt; "OK"&lt;&lt;endl;
  
      glAttachShader(program, vs);
      glAttachShader(program, fs);
  
      cout&lt;&lt;"Linking program: ";
      glLinkProgram(program); 
      GLint linkstatus = 0;
      glGetProgramiv(program, GL_LINK_STATUS, &amp;linkstatus);
      if(GL_TRUE==linkstatus) cout&lt;&lt;"OK"&lt;&lt;endl; else cout&lt;&lt;"Failed" &lt;&lt;endl;
  
      cout&lt;&lt;endl&lt;&lt;endl&lt;&lt;"Memory status"&lt;&lt;endl&lt;&lt;"==="&lt;&lt;endl;
  
      mvpmat = glGetUniformLocation(program,"mvpMatrix");
      mvmat = glGetUniformLocation(program,"mvMatrix");
      normalmat = glGetUniformLocation(program,"normalMatrix");
  
      cout &lt;&lt; "mvpMatrix: "&lt;&lt;mvpmat&lt;&lt;" mvMatrix: "&lt;&lt;mvmat&lt;&lt;" normalMatrix: " &lt;&lt; normalmat&lt;&lt;endl;
  }
  </code></pre>
  
  <p>The output of the last cout statement appears as follows (There is no error during compilation or linking).</p>
  
  <pre><code>mvpMatrix: 0 mvMatrix: -1 normalMatrix: 1
  </code></pre>
  
  <p>This is my vertex shader code</p>
  
  <pre><code>uniform mat4 mvpMatrix;
  uniform mat4 mvMatrix;
  uniform mat3 normalMatrix;
  attribute vec3 vertex;
  attribute vec3 normal;
  varying vec3 outNormal;
  varying vec3 outPos;
  
  void main(){
      gl_Position = mvpMatrix*vec4(vertex,1.0);
      outPos = (mvMatrix*vec4(vertex,1.0)).xyz;
      outNormal = normalize(normalMatrix*normal);
  }
  </code></pre>
  
  <p>I've used all mvpMatrix, mvMatrix and normalMatrix in the code. Thus i'm really confused why getUniformLocation() is returning mvMatrix = -1?</p>