title: Using Buffers in OpenGL to draw something
body: <p>I want to draw lines by using my mouse. To do so, I am using a buffer object. </p>
  
  <p>I am trying to store the location coordinates of the place where the mouse clicks, as the vertices of these lines. These vertices are being stored in the array variable that I have created but the lines are not being drawn. </p>
  
  <p>The following is the important code:</p>
  
  <pre><code>typedef struct {
  float x;
  float y;
  } vec2;
  
  vec2 hotSpot[1000];
  </code></pre>
  
  <p>hotSpot is the variable where I store the vertex values. The buffer has been initialized as such:</p>
  
  <pre><code> glBufferData( GL_ARRAY_BUFFER, sizeof(hotSpot), NULL, GL_STATIC_DRAW);
  </code></pre>
  
  <p>In the mouse() function, I store the value of the coordinates in hotSpot, whenever I click. As I understand, the main() function is always in a loop. So this is what I have written in the main() function:</p>
  
  <pre><code>glBufferData(GL_ARRAY_BUFFER, 0, sizeof(hotSpot), &amp;hotSpot); 
  </code></pre>
  
  <p>Then in the display() function, this is what I do:</p>
  
  <pre><code>glClear(GL_COLOR_BUFFER_BIT); 
  glDrawArrays(GL_LINES, 0, 2);
  glFlush();  
  </code></pre>
  
  <p>Am I going wrong somewhere?</p>