title: Translate a 3d object in WebGL
body: <p>I am trying to move a 3d object in a WebGL app, the problem is I'm getting the error:</p>
  
  <blockquote>
    <p>GL ERROR :GL_INVALID_OPERATION : glUniformMatrix4fv: wrong uniform function for type</p>
  </blockquote>
  
  <pre><code>// Vertex Shader
  
      var vertCode =
          'attribute vec4 coordinates;' + 
          'uniform vec4 translation;'+
          'void main(void) {' +
          'gl_Position = coordinates * translation;' +
      '}';
  
  ...
  
  // Associating shaders to buffer objects 
  
           gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);    
           var coordinatesVar = gl.getAttribLocation(shaderProgram, "coordinates");
           gl.vertexAttribPointer(coordinatesVar, 3, gl.FLOAT, false, 0, 0);   
           gl.enableVertexAttribArray(coordinatesVar); 
  
  // Translation
          var Tx = 0.5, Ty = 0.5, Tz =-0.5;
          var translationMatrix = new Float32Array([
              1,0,0,0,
              0,1,0,0,
              0,0,1,0,
              Tx,Ty,Tz,1
           ]);
  
           var translation = gl.getUniformLocation(shaderProgram, 'translation');
           gl.uniformMatrix4fv(translation, false, translationMatrix);
  
  // Draw
  
      gl.clearColor(0.5, 0.5, 0.5, 0.9);
      gl.enable(gl.DEPTH_TEST);
      gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
      gl.viewport(0,0,canvas.width,canvas.height);
      gl.drawElements(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT, 0);
  </code></pre>