title: bizarre GLSL texture coordinates
body: <p>I've been trying to do simple texture mapping with SOIL, and I've been having bizarre outputs..</p>
  
  <p>The output ONLY displays when a PNG texture is loaded. (SOIL_load_OGL_texture)
  Other textures appear as a greyish or a white.</p>
  
  <p>vertices passed as:</p>
  
  <pre><code>struct Vertex {
      float position[3];
      float texturepos[2];
  };
  
  Vertex vertices[] = { // w and h are width and height of square.
      0,0,0,0,0,
      w,0,0,1,0,
      0,h,0,0,1,
      w,0,0,1,0,
      w,h,0,1,1,
      0,h,0,0,1
  };
  </code></pre>
  
  <p>vertex shader:</p>
  
  <pre><code>attribute vec2 texpos;
  attribute vec3 position;
  uniform mat4 transform;
  varying vec2 pixel_texcoord;
  void main(void) {
      gl_Position=transform * vec4(position,1.0);
      pixel_texcoord=texpos;
  }
  </code></pre>
  
  <p>fragment shader:</p>
  
  <pre><code>varying vec2 pixel_texcoord;
  uniform sampler2D texture;
  void main(void) {
      gl_FragColor=texture2D(texture,pixel_texcoord);
  }
  </code></pre>
  
  <p>All of the uniforms and attributes <strong>are</strong> validated.</p>
  
  <p>Texture trying to render:</p>
  
  <p><img src="https://i.stack.imgur.com/D6QDP.png" alt="image for render">
  (is 128x128, power of 2.)</p>
  
  <p>Output [with normal shaders]:</p>
  
  <p><img src="https://i.stack.imgur.com/Ae6OE.png" alt="output1"></p>
  
  <p>However, I think the problem lies entirely in something really bizarre that happened when I tried to debug it.</p>
  
  <p>I changed the fragment shader to:</p>
  
  <pre><code>varying vec2 pixel_texcoord;
  uniform sampler2D texture;
  void main(void) {
      gl_FragColor=vec4(pixel_texcoord.x,0,pixel_texcoord.y,1);
  }
  </code></pre>
  
  <p>And got <em>this</em> result:
  <img src="https://i.stack.imgur.com/GOCPf.png" alt="output2">
  Something is very wrong with the texture coordinates, as according to the shader, Y is now X, and X no longer exists.
  Can anyone explain this?</p>
  
  <p>If my texture coordinates are correctly positioned, then I'll start looking at another image library..</p>
  
  <p>[EDIT] I tried loading an image through raw gimp-generated data, and it had the same problem.
  It's as if the texture coordinates are 1-dimensional..</p>