title: GLSL Texture Size
body: <p>I have a problem with my fragment shader.
  I want to get the size of a texture (which is loaded from an image).</p>
  
  <p>I know that it is possible to use textureSize(sampler) to get an ivec2 which contains the texture size. But i don't know why this isn't working  (it doesn't compile):</p>
  
  <pre><code>#version 120
  
  uniform sampler2D tex;
  
  float textureSize;
  float texelSize;
  
  
  void main()
  {
      textureSize = textureSize(tex).x;//first line
      //textureSize = 512.0;//if i set the above line as comment and use this one the shader compiles.
      texelSize = 1.0 / textureSize;
  
      vec4 color = texture2D(tex,gl_TexCoord[0].st);
      gl_FragColor = color * gl_Color;
  }
  </code></pre>