title: How to use OpenGL and GLSL to change color (C++)?
body: <p>I am working on an OpenGL project in C++, and I want to learn how to use GLSL shaders. The problem is that, while I can complete my program without using my own shaders, I want to write my own (at this time there are no shaders that I load myself - not sure if OpenGL defaults any).</p>
  
  <p>To draw a bunch of lines on the image (whose vertices are stored in a vector and color values are stored in another vector), I use the following code to run through and render them whenever the frame is updated - I use the GLUT display function for this.</p>
  
  <pre><code>glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_LINES);  
  vector&lt;point2&gt;::iterator it;
  int c_index = 0;
  for(it=points.begin(); it&lt;points.end(); it++){
      if(c_index % 2 == 0) //set color for every pair of points (each line)
          glColor3f(colors[c_index/2][0], colors[c_index/2][1], colors[c_index/2][2]);
      c_index++;
  
      glVertex2f(it-&gt;x, it-&gt;y); //set vertex
  }
  glEnd();
  glFlush();
  </code></pre>
  
  <p>Now, the problem is when I try to use shaders that I found in another example program, the color is all red (even though the shaders do not explicitly define any colors). It also makes glColor3f do nothing.</p>
  
  <p>My question is, assuming I can use shaders to do this, what do the shaders have to look like, and how would I load them?</p>