I have the following code to draw an array of points but it only draws one point in the center. How can I draw an array of 2D points using OpenGL?
GLint NumberOfPoints = 10;
GLfloat x[2],y[2];
glBegin( GL_POINTS );
for ( int i = 0; i < NumberOfPoints; ++i )
{
glVertex2f( x[i], y[i] );
}
glEnd();
Where are you setting the values for x[0], x[1], y[0], and y[1]?
If it’s only drawing one point in the center, it sounds like the values are set to 0 for all four of those variables. Be sure to initialize their values before you reference them in your call to gVertex2f().