title: Convert GLSL to C or C++
body: <p>as an exercise I am trying to convert GLSL shaders into plain c/c++ than can be executed via the CPU instead of the GPU, regardless if this is much less efficient and slower.</p>
  
  <p>Given that the data in c/c++ will be stored into an unsigned int array of pixels, how can I convert the next line to something that will perform the same operation in plain c? </p>
  
  <pre><code>// GLSL
  
  vec2 test = vec2(0.5, 0.2);
  vec2 coord = vec2(0.5, 0.5);
  vec3 output_color = texture2D(u_texture, coord - test).rgb
  </code></pre>
  
  <p>I could only get up to this</p>
  
  <pre><code>// C/C++
  
  short vec2_test_x = 127; // Equivalent to 0.5
  short vec2_test_y = 51;  // Equivalent to 0.2
  
  short vec2_coord_x = 127; // Equivalent to 0.5
  short vec2_coord_y = 127; // Equivalent to 0.5
  
  short color_r, color_g, color_b;
  int output_color = pixels[.... No idea how to continue....]    
  ......
  </code></pre>