title: How to draw a single pixel in OpenGL?
body: <p>Can someone tell me how to draw a single white pixel at a coordinate, say (100,200)?</p>
  
  <p>I am using GLUT and so far have figured out how to open a blank window. Once I figure out how to draw pixels, I will use that to implement the <a href="https://en.wikipedia.org/wiki/Bresenham&#39;s_line_algorithm" rel="noreferrer">Bresenham line drawing algorithm</a>. (Yes, I am aware OpenGL can draw lines. I am required to implement this myself).</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;GL/glut.h&gt;
  
  static int win(0);
  
  int main(int argc, char* argv[]){
      glutInit(&amp;argc,argv);
      glutInitDisplayMode(GLUT_RGBA|GLUT_SINGLE);
      glutInitWindowSize(500,500);
      glutInitWindowPosition(100,100);
  
      //step 2. Open a window named "GLUT DEMO"
      win = glutCreateWindow("GLUT DEMO");
      glClearColor(0.0,0.0,0.0,0.0); //set background
  
      glClear(GL_COLOR_BUFFER_BIT);
      glFlush();
      glutMainLoop();
  }
  </code></pre>