I am currently trying to render a list of points on the screen but all I get is the following, a single dot which moves with my camera and stays in the centre of the screen.
The list of points generated change with each frame and defined in world space coordinates. I want to know where I am going wrong with the code below and what are the best practices for drawing a dynamic list of points like this without using immediate mode calls. Most online resources refer to glBegin() and glEnd() when drawing points.
void RenderPoints(const CamInfo & camInfo, const std::vector<vec4>& listofpoints )
{
Shader->Use();
Shader->setUniform("MVP",camInfo.proj * camInfo.view);
Shader->setUniform("Color",glm::vec3(0.0f,1.0f,1.0f));
glGenVertexArrays( 1, &M_VAO );
glBindVertexArray( M_VAO );
glGenBuffers( 1, &M_VBO );
glBindBuffer( GL_ARRAY_BUFFER, M_VBO );
glBufferData( GL_ARRAY_BUFFER, listofpoints.size()*sizeof(glm::vec4), NULL, GL_STATIC_DRAW );
glBufferSubData( GL_ARRAY_BUFFER, 0, listofpoints.size()*sizeof(glm::vec4), (const GLvoid*)(&listofpoints[0]) );
GLuint pos_location = glGetAttribLocation(Shader->GetProgramID(), "position");
glEnableVertexAttribArray(pos_location );
glVertexAttribPointer( pos_location, 4, GL_FLOAT, GL_FALSE, 0, 0 );
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glGenBuffers(1, &M_IBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, M_IBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_vertex_indices.size()*sizeof(GLuint), (const GLvoid*)(&m_vertex_indices[0]), GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glPointSize(10.0f);
glBindVertexArray(M_VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, M_IBO);
glDrawElements(GL_POINTS,m_vertex_indices.size(),GL_UNSIGNED_INT,&m_vertex_indices);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
glBindVertexArray(0);
Shader->Disable();
}