title: OpenGL how to set a shader texture from the program (sampler2D)
body: <p>I want to combine 2 textures in a GLSL shader to 1.</p>
  
  <p>the problem is that I fail to set the sampler2D in the shader from my program. (the shader/program compiles correctly, the textures load correctly, the vertex shader is correct too) I tried it with the following code from a tutorial:</p>
  
  <pre><code>glUniform1i(program.getUniformLocation("Texture0"), 0);
  glUniform1i(program.getUniformLocation("Texture1"), 1);
  
  //texture 0, first texture
  glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, colorTexture.handle);
  
  //texture 1, other texture
  glActiveTexture(GL_TEXTURE1);
  glBindTexture(GL_TEXTURE_2D, normalTexture.handle);
  </code></pre>
  
  <p>the fragment shader code looks like this</p>
  
  <pre><code>uniform sampler2D Texture0;
  uniform sampler2D Texture1;
  
  void main(void)
  {
      vec4 color = texture2D(Texture0, vec2(gl_TexCoord[0]));
      vec4 normal = texture2D(Texture1, vec2(gl_TexCoord[0]));
      gl_FragColor = normal + color;
  }
  </code></pre>
  
  <p>it gets drawn with</p>
  
  <pre><code>glUseProgram(program.handle);
  glColor3f(1, 1, 1);
      glBegin(GL_QUADS);
      glTexCoord2f(0, 0);
      glVertex3f(0, 0, 0);
      glTexCoord2f(1, 0);
      glVertex3f(500, 0, 0);
      glTexCoord2f(1, 1);
      glVertex3f(500, 500, 0);
      glTexCoord2f(0, 1);
      glVertex3f(0, 500, 0);
      glEnd();
  </code></pre>