title: How to draw polygon with 3D points in modern openGL?
body: <p>I know in 2.0- openGL we can draw a line simply like this.</p>
  
  <pre><code>glBegin(GL_LINES);  
  glVertex3f(20.0f,150.0f,0.0f);  
  glVertex3f(220.0f,150.0f,0.0f);  
  glVertex3f(200.0f,160.0f,0.0f);  
  glVertex3f(200.0f,160.0f,0.0f);  
  glEnd();
  </code></pre>
  
  <p>but how to do similar thing in modern openGL(3.0+)</p>
  
  <p>I have read <a href="https://stackoverflow.com/questions/17274820/drawing-round-points-using-modern-opengl">Drawing round points using modern OpenGL</a> but the answer is not about certain point,since I want to draw polygon with points have certain coordinates,it's not quite helpful.</p>
  
  <p>I use this code,but it shows nothing except a blue background.what do I missed?</p>
  
  <pre><code>GLuint VertexArrayID;
      glGenVertexArrays(1, &amp;VertexArrayID);
      glBindVertexArray(VertexArrayID);
  
  static const GLfloat g_vertex_buffer_data[] = {
          20.0f, 150.0f, 0.0f, 1.0f,
              220.0f, 150.0f, 0.0f, 1.0f,
              200.0f, 160.0f, 0.0f, 1.0f
      };
  
  GLuint vertexbuffer;
  glGenBuffers(1, &amp;vertexbuffer);
  glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
  glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
  
  do{
  
      // Clear the screen
      glClear( GL_COLOR_BUFFER_BIT );
  
      // 1rst attribute buffer : vertices
      glEnableVertexAttribArray(0);
      glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
      glVertexAttribPointer(
          0,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
          4,                  // size
          GL_FLOAT,           // type
          GL_FALSE,           // normalized?
          0,                  // stride
          (void*)0            // array buffer offset
      );
  
      // Draw the triangle !
      glDrawArrays(GL_LINES, 0, 2); // 3 indices starting at 0 -&gt; 1 triangle
  
      glDisableVertexAttribArray(0);
  
      // Swap buffers
      glfwSwapBuffers(window);
  
  
  } // Check if the ESC key was pressed or the window was closed
  while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &amp;&amp;
         glfwWindowShouldClose(window) == 0 );
  </code></pre>