title: glGetUniformLocation OpenGL ES 2.0 (wrong return result on ipad 3 iOS 7.0.3)
body: <p>This is my vertex shader:</p>
  
  <pre><code>attribute vec4 a_position;
  uniform mat4 u_projection;
  uniform vec4 u_origin_translation;
  uniform vec4 u_translation;
  attribute vec2 a_texCoord;
  varying vec2 v_texCoord;
  uniform vec4 u_color;
  varying vec4 v_color;
  attribute vec4 a_color;
  
  void main()
  {
      vec4 pos = a_position + u_origin_translation + u_translation;
      gl_Position = u_projection * pos;
      v_texCoord = a_texCoord;
      v_color = a_color * u_color;
  }
  </code></pre>
  
  <p>And pixel shader:</p>
  
  <pre><code>precision mediump float;
  varying vec2 v_texCoord;
  uniform sampler2D s_texture;
  varying vec4 v_color;
  void main()
  {
      vec4 texColor = texture2D(s_texture, v_texCoord);
      gl_FragColor = texColor * v_color;
  }
  </code></pre>
  
  <p>I trying to render textured quad within OpenGL ES 2.0 context on Marmalade 7.1 platform;</p>
  
  <p>Source code of sending matrix data (projection uniform "<strong>u_projection</strong>") into shader:</p>
  
  <pre><code>GLint projectionUniformLocation = glGetUniformLocation(m_ShaderProgram-&gt;GetHandle(), m_ShaderProgram-&gt;GetProjectionUniformName().c_str());
  
  glUniformMatrix4fv(projectionUniformLocation, 1, 0, &amp;m_Ortho[0]);
  </code></pre>
  
  <p>My tracing code:</p>
  
  <pre><code>glGetActiveUniform(m_ShaderProgram-&gt;GetHandle(), projectionUniformLocation, maxUniformLength, 0, &amp;size, &amp;type, &amp;buffer[0]);
  
  TRACE_OUT("Context::ApplyOrtho: type is matrix " &lt;&lt; (type == GL_FLOAT_MAT4));
  TRACE_OUT("Context::ApplyOrtho: type is " &lt;&lt; type);
  TRACE_OUT("Context::ApplyOrtho: buffer is " &lt;&lt; &amp;buffer[0]);
  TRACE_OUT("Context::ApplyOrtho: projectionUniformLocation is " &lt;&lt; projectionUniformLocation);
  </code></pre>
  
  <p>Entire program works well in simulator on Windows. It shows textured quad and from tracing my <em>projectionUniformLocation</em> is type of <strong>GL_FLOAT_MAT4</strong> so it is right.</p>
  
  <p>BUT!!! When I run it on ipad 3 the same code works by another way.
  Tracing says that my <em>projectionUniformLocation</em> is NOT <strong>GL_FLOAT_MAT4</strong>, but it is <strong>GL_SAMPLER_2D</strong> and output buffer message contains "<strong>s_texture</strong>"!!! <strong>Visible result is black quad without texture</strong>.</p>
  
  <p><strong>Update:</strong> On Windows in simulator <em>projectionUniformLocation</em> index is 3, but on ipad it's index is 2;</p>
  
  <p><strong>Update2:</strong> Listing of active uniforms from simulator:</p>
  
  <pre><code>Context::PrintActiveUniforms: active is s_texture and it's location is 0
  Context::PrintActiveUniforms: active is u_color and it's location is 1
  Context::PrintActiveUniforms: active is u_origin_translation and it's location is 2
  Context::PrintActiveUniforms: active is u_projection and it's location is 3
  Context::PrintActiveUniforms: active is u_translation and it's location is 4
  </code></pre>
  
  <p>and listing from ipad:</p>
  
  <pre><code>Context::PrintActiveUniforms: active is u_origin_translation and it's location is 0
  Context::PrintActiveUniforms: active is u_color and it's location is 1
  Context::PrintActiveUniforms: active is s_texture and it's location is 7
  Context::PrintActiveUniforms: active is u_projection and it's location is 2
  Context::PrintActiveUniforms: active is u_translation and it's location is 6
  </code></pre>
  
  <p><strong>Update3:</strong> More information about uniforms on ipad 3 (Andon M. Coleman thank you for source code):</p>
  
  <pre><code>eTB_GLSL__print_uniforms: (loc=0) type=vec4 name=u_origin_translation size=1
  eTB_GLSL__print_uniforms: (loc=1) type=vec4 name=u_color size=1
  eTB_GLSL__print_uniforms: (loc=7) type=sampler2D name=s_texture size=1
  eTB_GLSL__print_uniforms: (loc=2) type=mat4 name=u_projection size=1
  eTB_GLSL__print_uniforms: (loc=6) type=vec4 name=u_translation size=1
  </code></pre>
  
  <p><strong>Why glGetActiveUniform says that my u_projection is not mat4 and why I do not see my texture?</strong></p>
  
  <p>Any ideas?</p>