title: Can't get OpenGL code to work properly
body: <p>I'm very new to OpenGL, GLSL and WebGL. I'm trying to get this sample code to work in a tool like <a href="http://shdr.bkcore.com/" rel="nofollow">http://shdr.bkcore.com/</a> but I can't get it to work.</p>
  
  <p>Vertex Shader:</p>
  
  <pre><code>void main()
  { 
      gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
      gl_TexCoord[0] = gl_MultiTexCoord0;
  }
  </code></pre>
  
  <p>Fragment Shader:</p>
  
  <pre><code>precision highp float;
  uniform float time;
  uniform vec2 resolution;
  varying vec3 fPosition;
  varying vec3 fNormal;
  
  uniform sampler2D tex0;
  
  void main()
  {
    float border = 0.01;
    float circle_radius = 0.5;
    vec4 circle_color = vec4(1.0, 1.0, 1.0, 1.0);
    vec2 circle_center = vec2(0.5, 0.5);
  
    vec2 uv = gl_TexCoord[0].xy;
    vec4 bkg_color = texture2D(tex0,uv * vec2(1.0, -1.0));
  
    // Offset uv with the center of the circle.
    uv -= circle_center;
    float dist = sqrt(dot(uv, uv));
  
    if ( (dist &gt; (circle_radius+border)) || (dist &lt; (circle_radius-border)) )
  gl_FragColor = bkg_color;
  else
  gl_FragColor = circle_color;
  }
  </code></pre>
  
  <p>I figured that this code must be from an outdated version of the language, so I changed the vertex shader to:</p>
  
  <pre><code>precision highp float;
  attribute vec2 position;
  attribute vec3 normal;
  
  varying vec2 TextCoord;
  attribute vec2 textCoord;
  
  uniform mat3 normalMatrix;
  uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
  varying vec3 fNormal;
  varying vec3 fPosition;
  
  void main()
  {
  
    gl_Position = vec4(position, 0.0, 1.0);
    TextCoord = vec2(textCoord);
  }
  </code></pre>
  
  <p>That seemed to fix the error messages about undeclared identifiers and not being able to "convert from 'float' to highp 4-component something-or-other", but I have no idea if, functionally, this will do the same thing as the original intended.</p>
  
  <p>Also, when I convert to this version of the Vertex Shader I have no idea what I'm supposed to do with this line in the Fragment Shader:</p>
  
  <pre><code>vec2 uv = gl_TexCoord[0].xy;
  </code></pre>
  
  <p>How do I convert this line to fit in with the converted vertex shader and how can I be sure that the vertex shader is even converted correctly?</p>