title: How to draw a sine wave in OpenGL_POINTS Function using C++
body: <p><img src="https://i.stack.imgur.com/QZMy6.png" alt="Image of a sine wave drawn over 2PI with red dots">
  I'm supposed to draw a sine wave (like the one in the image) using OpenGL_POINTS. However, after going through my loop in the code, I keep getting just one point of the wave.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;gl\GLUT.h&gt;
  #include &lt;math.h&gt;
  
  using namespace std;
  
  void RenderSineWave()
  {
      int i;  
  float x,y;  
  glClearColor(0.0, 0.0, 0.0, 1.0);  // clear background with black
  glClear(GL_COLOR_BUFFER_BIT);   
  
      glPointSize(10);
      glColor3f(1.0,0.0,0.0);
  
  
          for(i=0;i&lt;361;i=i+5)
          {
  
              x = (float)i; 
              y = 100.0 * sin(i *(6.284/360.0));
              glBegin(GL_POINTS);
              glVertex2f(x,y);
              glEnd();
          glFlush();
          glutPostRedisplay();
          }
  
  }
  
  void main(int argc, char** argv)
  {
      glutInit(&amp;argc,argv);
      glutCreateWindow("SineWave.cpp");
  glutDisplayFunc(RenderSineWave);
  glutMainLoop();
  
  }
  </code></pre>